updates.
[silc.git] / apps / irssi / src / silc / core / client_ops.c
index 0a7234c42c658c96ae546b6775aa8fb26540b638..bb95f116a7b3e7fb8860c5ac0b04865e71d31208 100644 (file)
@@ -184,7 +184,7 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
    or connecting failed.  This is also the first time application receives
    the SilcClientConnection objecet which it should save somewhere. */
 
-void  silc_connect(SilcClient client, SilcClientConnection conn, int success)
+void silc_connect(SilcClient client, SilcClientConnection conn, int success)
 {
   SILC_SERVER_REC *server = conn->context;
 
@@ -223,6 +223,23 @@ void silc_command(SilcClient client, SilcClientConnection conn,
                  SilcClientCommandContext cmd_context, int success,
                  SilcCommand command)
 {
+  SILC_SERVER_REC *server = conn->context;
+
+  if (!success)
+    return;
+
+  switch(command) {
+  case SILC_COMMAND_INVITE:
+    printformat_module("fe-common/silc", server, NULL,
+                      MSGLEVEL_CRAP, SILCTXT_CHANNEL_INVITING,
+                      cmd_context->argv[2], 
+                      (cmd_context->argv[1][0] == '*' ?
+                       (char *)conn->current_channel->channel_name :
+                       (char *)cmd_context->argv[1]));
+    break;
+  default:
+    break;
+  }
 }
 
 /* Client info resolving callback when JOIN command reply is received.
@@ -431,18 +448,24 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
     {
       SilcChannelEntry channel;
       char *invite_list;
+      SilcArgumentPayload args;
+      int argc = 0;
       
       if (!success)
        return;
       
       channel = va_arg(vp, SilcChannelEntry);
       invite_list = va_arg(vp, char *);
-      
+
+      args = silc_command_get_args(cmd_payload);
+      if (args)
+       argc = silc_argument_get_arg_num(args);
+
       if (invite_list)
        printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
                           SILCTXT_CHANNEL_INVITE_LIST, channel->channel_name,
                           invite_list);
-      else
+      else if (argc == 3)
        printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
                           SILCTXT_CHANNEL_NO_INVITE_LIST, 
                           channel->channel_name);
@@ -457,6 +480,9 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
       SilcBuffer client_id_list;
       uint32 list_count;
 
+      if (!success)
+       return;
+
       channel = va_arg(vp, char *);
       channel_entry = va_arg(vp, SilcChannelEntry);
       modei = va_arg(vp, uint32);
@@ -469,9 +495,6 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
       list_count = va_arg(vp, uint32);
       client_id_list = va_arg(vp, SilcBuffer);
 
-      if (!success)
-       return;
-
       chanrec = silc_channel_find(server, channel);
       if (chanrec != NULL && !success)
        channel_destroy(CHANNEL(chanrec));
@@ -484,7 +507,9 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
        signal_emit("channel topic changed", 1, chanrec);
       }
 
-      mode = silc_client_chmode(modei, channel_entry);
+      mode = silc_client_chmode(modei, 
+                               channel_entry->channel_key->cipher->name,
+                               channel_entry->hmac->hmac->name);
       g_free_not_null(chanrec->mode);
       chanrec->mode = g_strdup(mode == NULL ? "" : mode);
       signal_emit("channel mode changed", 1, chanrec);
@@ -644,6 +669,9 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
       unsigned char *pk;
       uint32 pk_len;
       
+      if (!success)
+       return;
+      
       id_type = va_arg(vp, uint32);
       entry = va_arg(vp, void *);
       public_key = va_arg(vp, SilcPublicKey);
@@ -656,6 +684,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
                                        NULL, NULL);
       silc_free(pk);
     }
+    break;
     
   case SILC_COMMAND_TOPIC:
     {