Thu Nov 14 09:44:54 CET 2002 Jochen Eisinger <c0ffee@penguin-breeder.org>
[silc.git] / apps / irssi / src / silc / core / client_ops.c
index 1a539869022a2bb85c820cbbe375856b66dbe1ef..f8e0897193ea8f2d0773981c8a3fd7ffee44d564 100644 (file)
@@ -1408,6 +1408,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
   case SILC_COMMAND_UMODE:
     {
       SilcUInt32 mode;
+      char *reason;
       
       if (!success)
        return;
@@ -1424,6 +1425,20 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
        printformat_module("fe-common/silc", server, NULL,
                           MSGLEVEL_CRAP, SILCTXT_ROUTER_OPER);
 
+      if ((mode & SILC_UMODE_GONE) != (server->umode & SILC_UMODE_GONE)) {
+       if (mode & SILC_UMODE_GONE) {      
+         if ((server->away_reason != NULL) && (server->away_reason[0] != '\0'))
+           reason = g_strdup(server->away_reason);
+         else
+           reason = g_strdup("away");
+       } else
+         reason = g_strdup("");
+
+       silc_set_away(reason, server);
+
+       g_free(reason);
+      }
+
       server->umode = mode;
       signal_emit("user mode changed", 2, server, NULL);
     }