Watcher list support added.
[silc.git] / apps / irssi / src / silc / core / silc-servers.c
index 9ae0003bc4922a135c155e73489881526722304f..d258c4c7802eec282e83b1a2521e20cc470fd9ce 100644 (file)
@@ -41,6 +41,8 @@
 #include "window-item-def.h"
 
 #include "fe-common/core/printtext.h"
+#include "fe-common/core/fe-channels.h"
+#include "fe-common/core/keyboard.h"
 #include "fe-common/silc/module-formats.h"
 
 #include "silc-commands.h"
@@ -204,8 +206,7 @@ static void sig_connected(SILC_SERVER_REC *server)
   /* Try to read detached session data and use it if found. */
   memset(&params, 0, sizeof(params));
   memset(file, 0, sizeof(file));
-  snprintf(file, sizeof(file) - 1, "%s/session", get_irssi_dir(),
-          server->connrec->address, server->connrec->port);
+  snprintf(file, sizeof(file) - 1, "%s/session", get_irssi_dir());
   params.detach_data = silc_file_readfile(file, &params.detach_data_len);
 
   /* Add connection to the client library */
@@ -215,6 +216,11 @@ static void sig_connected(SILC_SERVER_REC *server)
                                    server);
   server->conn = conn;
 
+  if (params.detach_data)
+    keyboard_entry_redirect(NULL,
+                           "-- Resuming old session, may take a while ...",
+                           ENTRY_REDIRECT_FLAG_HIDDEN, server);
+
   silc_free(params.detach_data);
   unlink(file);
 
@@ -239,7 +245,7 @@ static void sig_disconnected(SILC_SERVER_REC *server)
 
   if (server->conn && server->conn->sock != NULL) {
     silc_client_close_connection(silc_client, server->conn);
-    
+
     /* SILC closes the handle */
     g_io_channel_unref(net_sendbuffer_handle(server->handle));
     net_sendbuffer_destroy(server->handle, FALSE);
@@ -343,6 +349,7 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 /* SYNTAX: FILE */
 /* SYNTAX: JOIN <channel> [<passphrase>] [-cipher <cipher>] [-hmac <hmac>] [-founder <-pubkey|passwd>] */
 /* SYNTAX: DETACH */
+/* SYNTAX: WATCH [<-add | -del> <nickname>] */
 
 void silc_command_exec(SILC_SERVER_REC *server,
                       const char *command, const char *args)
@@ -893,6 +900,7 @@ void silc_server_init(void)
   command_bind_silc("sconnect", MODULE_NAME, (SIGNAL_FUNC) command_sconnect);
   command_bind_silc("file", MODULE_NAME, (SIGNAL_FUNC) command_file);
   command_bind_silc("detach", MODULE_NAME, (SIGNAL_FUNC) command_self);
+  command_bind_silc("watch", MODULE_NAME, (SIGNAL_FUNC) command_self);
 
   command_set_options("connect", "+silcnet");
 }
@@ -927,6 +935,7 @@ void silc_server_deinit(void)
   command_unbind("sconnect", (SIGNAL_FUNC) command_sconnect);
   command_unbind("file", (SIGNAL_FUNC) command_file);
   command_unbind("detach", (SIGNAL_FUNC) command_self);
+  command_unbind("watch", (SIGNAL_FUNC) command_self);
 }
 
 void silc_server_free_ftp(SILC_SERVER_REC *server,