diff --git a/src/common.h b/src/common.h index d63ec3cf..4b86d225 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 45 +#define IRSSI_ABI_VERSION 46 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 diff --git a/src/fe-common/irc/fe-irc-queries.c b/src/fe-common/irc/fe-irc-queries.c index 7a13542a..22aaa145 100644 --- a/src/fe-common/irc/fe-irc-queries.c +++ b/src/fe-common/irc/fe-irc-queries.c @@ -24,6 +24,11 @@ #include #include #include +#include +#include +#include + +int query_type; static QUERY_REC *query_find_address(SERVER_REC *server, const char *address) { @@ -88,14 +93,42 @@ static void event_privmsg(SERVER_REC *server, const char *data, } } +static void sig_window_bound_query(SERVER_REC *server) +{ + GSList *wtmp, *btmp, *bounds; + + if (!IS_IRC_SERVER(server)) + return; + + for (wtmp = windows; wtmp != NULL; wtmp = wtmp->next) { + WINDOW_REC *win = wtmp->data; + bounds = g_slist_copy(win->bound_items); + + for (btmp = bounds; btmp != NULL; btmp = btmp->next) { + WINDOW_BIND_REC *bound = btmp->data; + + if (bound->type == query_type && + g_strcmp0(server->tag, bound->servertag) == 0) { + irc_query_create(bound->servertag, bound->name, TRUE); + } + } + + g_slist_free(bounds); + } +} + void fe_irc_queries_init(void) { - settings_add_bool("lookandfeel", "query_track_nick_changes", TRUE); + query_type = module_get_uniq_id_str("WINDOW ITEM TYPE", "QUERY"); + settings_add_bool("lookandfeel", "query_track_nick_changes", TRUE); + + signal_add("server connected", sig_window_bound_query); signal_add_first("event privmsg", (SIGNAL_FUNC) event_privmsg); } void fe_irc_queries_deinit(void) { + signal_remove("server connected", sig_window_bound_query); signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg); }