updates.
[silc.git] / apps / irssi / src / silc / core / client_ops.c
index 16415900889e9d758e0eb05ad89f1f77f0ee7bfd..727079c8a63a9a61393d5c179387df4fecc17cc5 100644 (file)
@@ -81,7 +81,8 @@ void silc_say_error(char *msg, ...)
 
 void silc_channel_message(SilcClient client, SilcClientConnection conn,
                          SilcClientEntry sender, SilcChannelEntry channel,
-                         SilcMessageFlags flags, char *msg)
+                         SilcMessageFlags flags, const unsigned char *message,
+                         SilcUInt32 message_len)
 {
   SILC_SERVER_REC *server;
   SILC_NICK_REC *nick;
@@ -89,7 +90,7 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn,
   
   SILC_LOG_DEBUG(("Start"));
 
-  if (!msg)
+  if (!message)
     return;
 
   server = conn == NULL ? NULL : conn->context;
@@ -108,13 +109,13 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn,
   if (flags & SILC_MESSAGE_FLAG_ACTION)
     printformat_module("fe-common/silc", server, channel->channel_name,
                       MSGLEVEL_ACTIONS, SILCTXT_CHANNEL_ACTION, 
-                       nick == NULL ? "[<unknown>]" : nick->nick, msg);
+                       nick == NULL ? "[<unknown>]" : nick->nick, message);
   else if (flags & SILC_MESSAGE_FLAG_NOTICE)
     printformat_module("fe-common/silc", server, channel->channel_name,
                       MSGLEVEL_NOTICES, SILCTXT_CHANNEL_NOTICE, 
-                       nick == NULL ? "[<unknown>]" : nick->nick, msg);
+                       nick == NULL ? "[<unknown>]" : nick->nick, message);
   else
-    signal_emit("message public", 6, server, msg,
+    signal_emit("message public", 6, server, message,
                nick == NULL ? "[<unknown>]" : nick->nick,
                nick == NULL ? "" : nick->host == NULL ? "" : nick->host,
                chanrec->name, nick);
@@ -125,7 +126,8 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn,
 
 void silc_private_message(SilcClient client, SilcClientConnection conn,
                          SilcClientEntry sender, SilcMessageFlags flags,
-                         char *msg)
+                         const unsigned char *message,
+                         SilcUInt32 message_len)
 {
   SILC_SERVER_REC *server;
   char userhost[256];
@@ -137,7 +139,7 @@ void silc_private_message(SilcClient client, SilcClientConnection conn,
   if (sender->username)
     snprintf(userhost, sizeof(userhost) - 1, "%s@%s",
             sender->username, sender->hostname);
-  signal_emit("message private", 4, server, msg,
+  signal_emit("message private", 4, server, message,
              sender->nickname ? sender->nickname : "[<unknown>]",
              sender->username ? userhost : NULL);
 }
@@ -516,10 +518,12 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
 
     client_entry = va_arg(va, SilcClientEntry);
     tmp = va_arg(va, char *);
+    client_entry2 = va_arg(va, SilcClientEntry);
   
     if (client_entry == conn->local_entry) {
       printformat_module("fe-common/silc", server, NULL,
                         MSGLEVEL_CRAP, SILCTXT_CHANNEL_KILLED_YOU, 
+                        client_entry2 ? client_entry2->nickname : "",
                         tmp ? tmp : "");
     } else {
       list1 = nicklist_get_same_unique(SERVER(server), client_entry);
@@ -533,6 +537,7 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
       printformat_module("fe-common/silc", server, NULL,
                         MSGLEVEL_CRAP, SILCTXT_CHANNEL_KILLED, 
                         client_entry->nickname,
+                        client_entry2 ? client_entry2->nickname : "",
                         tmp ? tmp : "");
     }
     break;
@@ -596,7 +601,7 @@ void silc_connect(SilcClient client, SilcClientConnection conn, int success)
   SILC_SERVER_REC *server = conn->context;
 
   if (!server && !success) {
-    silc_client_close_connection(client, NULL, conn);
+    silc_client_close_connection(client, conn);
     return;
   }
 
@@ -619,6 +624,9 @@ void silc_disconnect(SilcClient client, SilcClientConnection conn)
 
   SILC_LOG_DEBUG(("Start"));
 
+  if (!server || server->connection_lost)
+    return;
+
   if (server->conn && server->conn->local_entry) {
     nicklist_rename_unique(SERVER(server),
                           server->conn->local_entry, server->nick,
@@ -876,12 +884,22 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
        if ((mode & SILC_UMODE_SERVER_OPERATOR) ||
            (mode & SILC_UMODE_ROUTER_OPERATOR)) {
          strcat(buf, (mode & SILC_UMODE_SERVER_OPERATOR) ?
-                "Server Operator " :
+                "Server Operator" :
                 (mode & SILC_UMODE_ROUTER_OPERATOR) ?
-                "SILC Operator " : "[Unknown mode] ");
+                "SILC Operator" : "[Unknown mode]");
        }
        if (mode & SILC_UMODE_GONE)
-         strcat(buf, "away");
+         strcat(buf, " away");
+       if (mode & SILC_UMODE_INDISPOSED)
+         strcat(buf, " indisposed");
+       if (mode & SILC_UMODE_BUSY)
+         strcat(buf, " busy");
+       if (mode & SILC_UMODE_PAGE)
+         strcat(buf, " page to reach");
+       if (mode & SILC_UMODE_HYPER)
+         strcat(buf, " hyper active");
+       if (mode & SILC_UMODE_ROBOT)
+         strcat(buf, " robot");
 
        printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
                           SILCTXT_WHOIS_MODES, buf);
@@ -1171,8 +1189,18 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
        mode = silc_client_chumode_char(chu->mode);
        if (e->mode & SILC_UMODE_GONE)
          strcat(stat, "G");
-       else
+       else if (e->mode & SILC_UMODE_INDISPOSED)
+         strcat(stat, "I");
+       else if (e->mode & SILC_UMODE_BUSY)
+         strcat(stat, "B");
+       else if (e->mode & SILC_UMODE_PAGE)
+         strcat(stat, "P");
+       else if (e->mode & SILC_UMODE_HYPER)
          strcat(stat, "H");
+       else if (e->mode & SILC_UMODE_ROBOT)
+         strcat(stat, "R");
+       else
+         strcat(stat, "A");
        if (mode)
          strcat(stat, mode);