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

trigger: add hook "info"

This commit is contained in:
Sébastien Helleu
2019-04-13 08:52:40 +02:00
parent 299c308f00
commit 8bc06ea101
25 changed files with 283 additions and 68 deletions
+30
View File
@@ -1170,6 +1170,36 @@ end:
TRIGGER_CALLBACK_CB_END(info);
}
/*
* Callback for an info hooked.
*/
char *
trigger_callback_info_cb (const void *pointer, void *data,
const char *info_name, const char *arguments)
{
const char *ptr_info;
char *info;
TRIGGER_CALLBACK_CB_INIT(NULL);
TRIGGER_CALLBACK_CB_NEW_EXTRA_VARS;
/* add data in hashtable used for conditions/replace/command */
weechat_hashtable_set (extra_vars, "tg_info_name", info_name);
weechat_hashtable_set (extra_vars, "tg_arguments", arguments);
weechat_hashtable_set (extra_vars, "tg_info", "");
/* execute the trigger (conditions, regex, command) */
trigger_callback_execute (trigger, NULL, pointers, extra_vars, NULL);
end:
ptr_info = weechat_hashtable_get (extra_vars, "tg_info");
info = (ptr_info) ? strdup (ptr_info) : NULL;
TRIGGER_CALLBACK_CB_END(info);
}
/*
* Initializes trigger callback.
*/