diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-11-06 11:38:48 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-11-06 11:38:48 +0100 |
commit | e001c057108a573d9e67cc37c0c5f8462e1fbdf6 (patch) | |
tree | d5e153942e4c8b08a870ee49325e3d953f887770 /src/plugins/irc/irc-info.c | |
parent | a56dc00b2f7a01ee3c52fcb49bea2638c877d1ff (diff) | |
download | weechat-e001c057108a573d9e67cc37c0c5f8462e1fbdf6.zip |
Add IRC command /notify, new options for notify and infolist "irc_notify" (task #5441)
This commit provides:
- new IRC command /notify
- new options: irc.look.notify_tags_ison, irc.look.notify_tags_whois,
irc.network.notify_check_ison, irc.network.notify_check_whois
- new option "notify" in servers (but should not be changed, only /notify
command should be used)
- infolist "irc_notify" to get notify list (by server or for all servers).
Diffstat (limited to 'src/plugins/irc/irc-info.c')
-rw-r--r-- | src/plugins/irc/irc-info.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c index 5d9562f34..8fb518b4b 100644 --- a/src/plugins/irc/irc-info.c +++ b/src/plugins/irc/irc-info.c @@ -31,6 +31,7 @@ #include "irc-config.h" #include "irc-ignore.h" #include "irc-nick.h" +#include "irc-notify.h" #include "irc-protocol.h" #include "irc-server.h" @@ -273,6 +274,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name, struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; struct t_irc_ignore *ptr_ignore; + struct t_irc_notify *ptr_notify; char **argv; int argc; @@ -495,6 +497,49 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name, } } } + else if (weechat_strcasecmp (infolist_name, "irc_notify") == 0) + { + if (pointer && !irc_notify_valid (NULL, pointer)) + return NULL; + + ptr_infolist = weechat_infolist_new (); + if (ptr_infolist) + { + if (pointer) + { + /* build list with only one notify */ + if (!irc_notify_add_to_infolist (ptr_infolist, pointer)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + return ptr_infolist; + } + else + { + /* build list with notify list of all servers matchin arguments */ + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + if (!arguments || !arguments[0] + || weechat_string_match (ptr_server->name, arguments, 0)) + { + for (ptr_notify = ptr_server->notify_list; ptr_notify; + ptr_notify = ptr_notify->next_notify) + { + if (!irc_notify_add_to_infolist (ptr_infolist, + ptr_notify)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + } + } + } + return ptr_infolist; + } + } + } return NULL; } @@ -575,4 +620,9 @@ irc_info_init () N_("ignore pointer (optional)"), NULL, &irc_info_get_infolist_cb, NULL); + weechat_hook_infolist ("irc_notify", + N_("list of notify"), + N_("notify pointer (optional)"), + N_("server name (can start or end with \"*\" as wildcard) (optional)"), + &irc_info_get_infolist_cb, NULL); } |