diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-05-20 15:21:07 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-05-20 15:21:07 +0200 |
commit | afb1d0305313edef297e2f1f6ced9058a4560556 (patch) | |
tree | 789625c55c21c377a2618c709bfef2b56ad90693 /src/plugins/irc/irc-server.c | |
parent | 0329a9c7cde1334d0de17440b6d2d304bdf2e6eb (diff) | |
parent | 0a348f0b9dd31fe8546e61d445f23b44a26d1abf (diff) | |
download | weechat-afb1d0305313edef297e2f1f6ced9058a4560556.zip |
Merge remote-tracking branch 'origin/pr/623' into irc-3.2-cap
Diffstat (limited to 'src/plugins/irc/irc-server.c')
-rw-r--r-- | src/plugins/irc/irc-server.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index ae403360b..2e43afab5 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1314,9 +1314,18 @@ irc_server_alloc (const char *name) new_server->nick_alternate_number = -1; new_server->nick = NULL; new_server->nick_modes = NULL; - new_server->cap_away_notify = 0; - new_server->cap_account_notify = 0; - new_server->cap_extended_join = 0; + new_server->checking_cap_ls = 0; + new_server->cap_ls = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, + NULL); + new_server->checking_cap_list = 0; + new_server->cap_list = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, + NULL); new_server->isupport = NULL; new_server->prefix_modes = NULL; new_server->prefix_chars = NULL; @@ -3350,7 +3359,7 @@ irc_server_timer_cb (const void *pointer, void *data, int remaining_calls) /* check away (only if lag check was not done) */ away_check = IRC_SERVER_OPTION_INTEGER( ptr_server, IRC_SERVER_OPTION_AWAY_CHECK); - if (!ptr_server->cap_away_notify + if (!weechat_hashtable_has_key (ptr_server->cap_list, "away-notify") && (away_check > 0) && ((ptr_server->last_away_check == 0) || (current_time >= ptr_server->last_away_check + (away_check * 60)))) @@ -3669,7 +3678,7 @@ irc_server_login (struct t_irc_server *server) if (irc_server_sasl_enabled (server) || (capabilities && capabilities[0])) { - irc_server_sendf (server, 0, NULL, "CAP LS"); + irc_server_sendf (server, 0, NULL, "CAP LS " IRC_SERVER_VERSION_CAP); } username2 = (username && username[0]) ? @@ -5027,9 +5036,10 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address, weechat_bar_item_update ("input_prompt"); weechat_bar_item_update ("irc_nick_modes"); } - server->cap_away_notify = 0; - server->cap_account_notify = 0; - server->cap_extended_join = 0; + server->checking_cap_ls = 0; + weechat_hashtable_remove_all (server->cap_ls); + server->checking_cap_list = 0; + weechat_hashtable_remove_all (server->cap_list); server->is_away = 0; server->away_time = 0; server->lag = 0; @@ -5578,9 +5588,10 @@ irc_server_hdata_server_cb (const void *pointer, void *data, WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, 0, NULL, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, cap_away_notify, INTEGER, 0, NULL, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, cap_account_notify, INTEGER, 0, NULL, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, cap_extended_join, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, checking_cap_ls, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, cap_ls, HASHTABLE, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, checking_cap_list, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, cap_list, HASHTABLE, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, 0, NULL, NULL); @@ -5802,11 +5813,13 @@ irc_server_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_string (ptr_item, "nick_modes", server->nick_modes)) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "cap_away_notify", server->cap_away_notify)) + if (!weechat_infolist_new_var_integer (ptr_item, "checking_cap_ls", server->checking_cap_ls)) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "cap_account_notify", server->cap_account_notify)) + if (!weechat_hashtable_add_to_infolist (server->cap_ls, ptr_item, "cap_ls")) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "cap_extended_join", server->cap_extended_join)) + if (!weechat_infolist_new_var_integer (ptr_item, "checking_cap_list", server->checking_cap_list)) + return 0; + if (!weechat_hashtable_add_to_infolist (server->cap_list, ptr_item, "cap_list")) return 0; if (!weechat_infolist_new_var_string (ptr_item, "isupport", server->isupport)) return 0; @@ -6186,9 +6199,14 @@ irc_server_print_log () weechat_log_printf (" nick_alternate_number: %d", ptr_server->nick_alternate_number); weechat_log_printf (" nick . . . . . . . . : '%s'", ptr_server->nick); weechat_log_printf (" nick_modes . . . . . : '%s'", ptr_server->nick_modes); - weechat_log_printf (" cap_away_notify. . . : %d", ptr_server->cap_away_notify); - weechat_log_printf (" cap_account_notify . : %d", ptr_server->cap_account_notify); - weechat_log_printf (" cap_extended_join. . : %d", ptr_server->cap_extended_join); + weechat_log_printf (" checking_cap_ls. . . : %d", ptr_server->checking_cap_ls); + weechat_log_printf (" cap_ls . . . . . . . : 0x%lx (hashtable: '%s')", + ptr_server->cap_ls, + weechat_hashtable_get_string (ptr_server->cap_ls, "keys_values")); + weechat_log_printf (" checking_cap_list. . : %d", ptr_server->checking_cap_list); + weechat_log_printf (" cap_list . . . . . . : 0x%lx (hashtable: '%s')", + ptr_server->cap_list, + weechat_hashtable_get_string (ptr_server->cap_list, "keys_values")); weechat_log_printf (" isupport . . . . . . : '%s'", ptr_server->isupport); weechat_log_printf (" prefix_modes . . . . : '%s'", ptr_server->prefix_modes); weechat_log_printf (" prefix_chars . . . . : '%s'", ptr_server->prefix_chars); |