updates.
[silc.git] / apps / irssi / src / silc / core / silc-servers.c
index b2986eacae22aa64180ec79ab45530c1b2ccbab7..a692475281a100b8bd40f19f1a4545eef9cdbe92 100644 (file)
@@ -247,6 +247,40 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
   return ret;
 }
 
+/* Syntaxes of all SILC commands for HELP files (the help file generation
+   will snoop these from here). */
+
+/* SYNTAX: BAN <channel> [+|-[<nickname>[@<server>[!<username>[@hostname>]]]]] */
+/* SYNTAX: CMODE <channel> +|-<modes> [{ <arguments>}] */
+/* SYNTAX: CUMODE <channel> +|-<modes> <nickname>[@<server>] [-pubkey|<passwd>] */
+/* SYNTAX: GETKEY <nickname> */
+/* SYNTAX: INVITE <channel> [<nickname>[@server>] */
+/* SYNTAX: INVITE <channel> [+|-[<nickname>[@<server>[!<username>[@hostname>]]]]] */
+/* SYNTAX: KEY MSG <nickname> set|unset|list|agreement|negotiate [<arguments>] */
+/* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
+/* SYNTAX: KICK <channel> <nickname>[@<server>] [<comment>] */
+/* SYNTAX: KILL <channel> <nickname>[@<server>] [<comment>] */
+/* SYNTAX: OPER <username> [<public key>] */
+/* SYNTAX: SILCOPER <username> [<public key>] */
+/* SYNTAX: TOPIC <channel> [<topic> */
+/* SYNTAX: UMODE +|-<modes> */
+/* SYNTAX: WHOIS <nickname>[@<server>] [<count>] */
+/* SYNTAX: WHOWAS <nickname>[@<server>] [<count>] */
+/* SYNTAX: CLOSE <server> [<port>] */
+/* SYNTAX: SHUTDOWN */
+/* SYNTAX: MOTD [<server>] */
+/* SYNTAX: LIST [<channel>] */
+/* SYNTAX: ME <message> */
+/* SYNTAX: ACTION <channel> <message> */
+/* SYNTAX: AWAY [<message>] */
+/* SYNTAX: INFO [<server>] */
+/* SYNTAX: NICK <nickname> */
+/* SYNTAX: NOTICE <message> */
+/* SYNTAX: PART [<channel>] */
+/* SYNTAX: PING [<server>] */
+/* SYNTAX: SCONNECT <server> [<port>] */
+/* SYNTAX: USERS <channel> */
+
 void silc_command_exec(SILC_SERVER_REC *server,
                       const char *command, const char *args)
 {
@@ -287,6 +321,8 @@ void silc_command_exec(SILC_SERVER_REC *server,
   (*cmd->cb)(ctx);
 }
 
+/* Generic command function to call any SILC command directly. */
+
 static void command_self(const char *data, SILC_SERVER_REC *server)
 {
   if (!IS_SILC_SERVER(server) || !server->connected) {
@@ -298,6 +334,20 @@ static void command_self(const char *data, SILC_SERVER_REC *server)
   signal_stop();
 }
 
+/* SCONNECT command.  Calls actually SILC's CONNECT command since Irssi
+   has CONNECT command for other purposes. */
+
+static void command_sconnect(const char *data, SILC_SERVER_REC *server)
+{
+  if (!IS_SILC_SERVER(server) || !server->connected) {
+    printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Not connected to server");
+    return;
+  }
+
+  silc_command_exec(server, "CONNECT", data);
+  signal_stop();
+}
+
 static void event_text(const char *line, SILC_SERVER_REC *server,
                       WI_ITEM_REC *item)
 {
@@ -338,12 +388,12 @@ void silc_server_init(void)
   command_bind("kill", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("kick", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("info", MODULE_NAME, (SIGNAL_FUNC) command_self);
-  command_bind("connect", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("ping", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("motd", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("close", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("shutdown", MODULE_NAME, (SIGNAL_FUNC) command_self);
   command_bind("getkey", MODULE_NAME, (SIGNAL_FUNC) command_self);
+  command_bind("sconnect", MODULE_NAME, (SIGNAL_FUNC) command_sconnect);
 
   command_set_options("connect", "+silcnet");
 }
@@ -370,11 +420,11 @@ void silc_server_deinit(void)
   command_unbind("kill", (SIGNAL_FUNC) command_self);
   command_unbind("kick", (SIGNAL_FUNC) command_self);
   command_unbind("info", (SIGNAL_FUNC) command_self);
-  command_unbind("connect", (SIGNAL_FUNC) command_self);
   command_unbind("ping", (SIGNAL_FUNC) command_self);
   command_unbind("motd", (SIGNAL_FUNC) command_self);
   command_unbind("ban", (SIGNAL_FUNC) command_self);
   command_unbind("close", (SIGNAL_FUNC) command_self);
   command_unbind("shutdown", (SIGNAL_FUNC) command_self);
   command_unbind("getkey", (SIGNAL_FUNC) command_self);
+  command_unbind("sconnect", (SIGNAL_FUNC) command_sconnect);
 }