summaryrefslogtreecommitdiff
path: root/src/fe-common/irc
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2017-02-27 23:42:57 -0300
committerdequis <dx@dxzone.com.ar>2017-02-27 23:43:37 -0300
commit7c09b72848f99886964266ff531b41c69fe138f5 (patch)
tree423ea48e05b82367c9f073aeab8764ad29f655f2 /src/fe-common/irc
parentfa1a0562916c2c8ef8f7087a59795973bf0927ac (diff)
downloadirssi-7c09b72848f99886964266ff531b41c69fe138f5.zip
fe-netjoin: remove irc servers on "server disconnected" signal
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r--src/fe-common/irc/fe-netjoin.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c
index 4eb388c0..8272093f 100644
--- a/src/fe-common/irc/fe-netjoin.c
+++ b/src/fe-common/irc/fe-netjoin.c
@@ -470,6 +470,20 @@ static void read_settings(void)
}
}
+static void sig_server_disconnected(IRC_SERVER_REC *server)
+{
+ NETJOIN_SERVER_REC *netjoin_server;
+
+ g_return_if_fail(server != NULL);
+
+ if (!IS_IRC_SERVER(server))
+ return;
+
+ if ((netjoin_server = netjoin_find_server(server))) {
+ netjoin_server_remove(netjoin_server);
+ }
+}
+
void fe_netjoin_init(void)
{
settings_add_bool("misc", "hide_netsplit_quits", TRUE);
@@ -480,6 +494,7 @@ void fe_netjoin_init(void)
read_settings();
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
+ signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
}
void fe_netjoin_deinit(void)
@@ -492,6 +507,7 @@ void fe_netjoin_deinit(void)
}
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
+ signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_remove("message quit", (SIGNAL_FUNC) msg_quit);
signal_remove("message join", (SIGNAL_FUNC) msg_join);