1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 23:06:38 +02:00

trigger: add option "copy" in command /trigger

This commit is contained in:
Sebastien Helleu
2014-02-14 14:21:24 +01:00
parent 93038a3634
commit c25bd9c26b
3 changed files with 86 additions and 3 deletions
+26
View File
@@ -968,6 +968,32 @@ trigger_rename (struct t_trigger *trigger, const char *name)
return 1;
}
/*
* Copies a trigger.
*
* Returns a pointer to the new trigger, NULL if error.
*/
struct t_trigger *
trigger_copy (struct t_trigger *trigger, const char *name)
{
if (!name || !name[0] || !trigger_name_valid (name)
|| trigger_search (name))
{
return NULL;
}
return trigger_new (
name,
weechat_config_string (trigger->options[TRIGGER_OPTION_ENABLED]),
weechat_config_string (trigger->options[TRIGGER_OPTION_HOOK]),
weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
weechat_config_string (trigger->options[TRIGGER_OPTION_CONDITIONS]),
weechat_config_string (trigger->options[TRIGGER_OPTION_REGEX]),
weechat_config_string (trigger->options[TRIGGER_OPTION_COMMAND]),
weechat_config_string (trigger->options[TRIGGER_OPTION_RETURN_CODE]));
}
/*
* Deletes a trigger.
*/