Corrected use of silc_file_readfile.
[silc.git] / apps / irssi / src / silc / core / silc-servers.c
index a67fc0b81505b3f58c83248f720ce5bb0c58045a..dd900ce7426b623dd475ad2233153b1d36d6aa37 100644 (file)
@@ -273,6 +273,8 @@ static void sig_connected(SILC_SERVER_REC *server)
   memset(file, 0, sizeof(file));
   snprintf(file, sizeof(file) - 1, "%s/session", get_irssi_dir());
   params.detach_data = silc_file_readfile(file, &params.detach_data_len);
+  if (params.detach_data)
+    params.detach_data[params.detach_data_len] = 0;
 
   /* Add connection to the client library */
   conn = silc_client_add_connection(silc_client, &params,
@@ -294,6 +296,9 @@ static void sig_connected(SILC_SERVER_REC *server)
   /* Start key exchange with the server */
   silc_client_start_key_exchange(silc_client, conn, fd);
 
+  /* Put default attributes */
+  silc_query_attributes_default(silc_client, conn);
+
   server->ftp_sessions = silc_dlist_init();
   server->isnickflag = isnickflag_func;
   server->ischannel = ischannel_func;
@@ -391,7 +396,7 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 /* SYNTAX: SILCOPER <username> [-pubkey] */
 /* SYNTAX: TOPIC <channel> [<topic>] */
 /* SYNTAX: UMODE +|-<modes> */
-/* SYNTAX: WHOIS <nickname>[@<hostname>] [<count>] */
+/* SYNTAX: WHOIS <nickname>[@<hostname>] [-details] [<count>] */
 /* SYNTAX: WHOWAS <nickname>[@<hostname>] [<count>] */
 /* SYNTAX: CLOSE <server> [<port>] */
 /* SYNTAX: SHUTDOWN */
@@ -414,6 +419,8 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 /* SYNTAX: JOIN <channel> [<passphrase>] [-cipher <cipher>] [-hmac <hmac>] [-founder] */
 /* SYNTAX: DETACH */
 /* SYNTAX: WATCH [<-add | -del> <nickname>] */
+/* SYNTAX: STATS */
+/* SYNTAX: ATTR [<-del> <option> [{ <value>}]] */
 
 void silc_command_exec(SILC_SERVER_REC *server,
                       const char *command, const char *args)
@@ -966,6 +973,8 @@ void silc_server_init(void)
   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_bind_silc("stats", MODULE_NAME, (SIGNAL_FUNC) command_self);
+  command_bind_silc("attr", MODULE_NAME, (SIGNAL_FUNC) command_attr);
 
   command_set_options("connect", "+silcnet");
 }
@@ -1002,6 +1011,8 @@ void silc_server_deinit(void)
   command_unbind("file", (SIGNAL_FUNC) command_file);
   command_unbind("detach", (SIGNAL_FUNC) command_self);
   command_unbind("watch", (SIGNAL_FUNC) command_self);
+  command_unbind("stats", (SIGNAL_FUNC) command_self);
+  command_unbind("attr", (SIGNAL_FUNC) command_attr);
 }
 
 void silc_server_free_ftp(SILC_SERVER_REC *server,