Implemented CHANNEL_UMODE_QUEIT mode. Fixed fatal bugs in server.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 15 Jun 2002 13:31:41 +0000 (13:31 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 15 Jun 2002 13:31:41 +0000 (13:31 +0000)
See CHANGES for more :)

16 files changed:
CHANGES
TODO
apps/irssi/docs/help/in/cumode.in
apps/irssi/src/fe-common/silc/module-formats.c
apps/irssi/src/fe-common/silc/module-formats.h
apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/silc-channels.c
apps/irssi/src/silc/core/silc-core.c
apps/silcd/command.c
apps/silcd/packet_receive.c
apps/silcd/server.c
apps/silcd/server_util.c
lib/silcclient/client_channel.c
lib/silcclient/command.c
lib/silccore/silcmode.h
lib/silcutil/silcutil.c

diff --git a/CHANGES b/CHANGES
index bb94fa24d8a7f7befc1b3e36b6464e0d4afa71d7..78742aa6de19d2ae6127303cdad3f75848572138 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,34 @@
+Sat Jun 15 12:09:14 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+       * Added some better info printing for client during connecting.
+         Affected file silcd/server_util.c.
+
+       * Implemented the SILC_CHANNEL_UMODE_QUIET mode that can be used
+         to silence a user on a channel.  Affected files are
+         lib/silcclient/client_channel.c, irssi/src/silc/core/client_ops.c,
+         irssi/src/fe-common/silc/module-formats.[ch], silcd/command.c
+         and silcd/packet_receive.c.
+
+       * Fixed a fatal bug in handling of malformed command payload.
+         Affected file silcd/command.c.
+
+       * Fixed a double free when announcing channel users to router.
+         Affected file silcd/server.c.
+
+       * After successful authentication to channel founder mode, check
+         that there isn't anyone else with founder mode on the channel.
+         The one that authenticated will become founder and anyone
+         else is demoted.  Affected file silcd/command.c.
+
+       * Added error printing of any error that has occurred during
+         any command in client library.  Affected file is
+         irssi/src/silc/core/client_ops.c.
+
+       * Removed some error printing from the client library and left
+         it for the application to worry (from the error status it
+         receives in 'command' client operation.  Affected file is
+         lib/silcclient/command.c.
+
 Fri Jun 14 22:59:02 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
 
        * Added new status types KEY_AGREEMENT_ALREADY_STARTED and
diff --git a/TODO b/TODO
index 044d2ae325afcd06d06fdacbbda92980d2e33e27..3ab775e25ee3e5ff350abac419c471fa83b954ca 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,10 +1,6 @@
 TODO/bugs in Irssi SILC client
 ==============================
 
- o /cumode for unknown nick does not give any error message (Fix this to
-   0.9.x).
-
-
 TODO/bugs In SILC Client Library
 ================================
 
@@ -18,8 +14,6 @@ TODO/bugs In SILC Client Library
 TODO/bugs In SILC Server
 ========================
 
- o Implement the SILC_CUMODE_QUIET user mode (Do this to 0.9.x).
-
  o Implement the <Requested Attributes> and the Attribute Payload to
    the core library, client and server.  Maybe implementations of
    RFC 2425 and RFC 2426 to make it complete.
index 5da46eb40b2a560e345c5dd775aa4fffd78fed31..2bb44bcab4e1d5a28883e12b36c17a9a0915fb4d 100644 (file)
@@ -49,5 +49,14 @@ are available:
         as robots.  Client may set this mode only to
         itself.
 
+    q <nickname>[@<server>]
+
+        Set/unset user as quiet.  When set the user cannot
+        talk on the channel, and cannot send messages to
+        the channel.  This can be used by channel operator
+        to queit a certain misbehaving user.  The user cannot
+        unset this mode itself.  This mode cannot be set
+        or unset to yourself.
+
 
 See also: CMODE, UMODE
index f823d50e0e1cee90bb40426be7fe8c593f610fcb..108f96e8c84e1a1d14889a012fc3ec149ea124e8 100644 (file)
@@ -47,6 +47,7 @@ FORMAT_REC fecommon_silc_formats[] = {
        { "kicked", "{nick $0} has been kicked off channel {channel $1} by {nick $2} ($3)", 4, { 0, 0, 0, 0 } },
        { "killed_you", "You have been killed from the SILC Network by {nick $0} ($1)", 2, { 0, 0 } },
        { "killed", "{nick $0} has been killed from the SILC Network by {nick $1} ($2)", 3, { 0, 0, 0 } },
+       { "quieted", "You have been queited and cannot talk on {channel $0}", 1, { 0 } },
 
        /* WHOIS, WHOWAS and USERS (alias WHO) messages */
        { NULL, "Who Queries", 0 },
index dec4985d36f0e1303f19ca97bb529db7c06779c0..035a3fdc5625f69f855b55f442f8e4c59bd8b171 100644 (file)
@@ -44,6 +44,7 @@ enum {
   SILCTXT_CHANNEL_KICKED,
   SILCTXT_CHANNEL_KILLED_YOU,
   SILCTXT_CHANNEL_KILLED,
+  SILCTXT_CHANNEL_QUIETED,
 
   SILCTXT_FILL_2,
 
index 4a5e1583cd8f7724ab2b36455de9b85c60840f07..7d53788f836631bc349bdb2ccf5d9dc89b0e946a 100644 (file)
@@ -545,6 +545,11 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
                         SILCTXT_CHANNEL_FOUNDER,
                         channel->channel_name, client_entry2->nickname);
 
+    if (mode & SILC_CHANNEL_UMODE_QUIET && conn->local_entry == client_entry2)
+      printformat_module("fe-common/silc", 
+                        server, channel->channel_name, MSGLEVEL_CRAP,
+                        SILCTXT_CHANNEL_QUIETED, channel->channel_name);
+
     silc_free(tmp);
     break;
 
@@ -870,10 +875,12 @@ void silc_command(SilcClient client, SilcClientConnection conn,
 
   SILC_LOG_DEBUG(("Start"));
 
-  if (!success)
+  if (!success) {
+    silc_say_error("%s", silc_get_status_message(status));
     return;
+  }
 
-  switch(command) {
+  switch (command) {
   case SILC_COMMAND_INVITE:
     printformat_module("fe-common/silc", server, NULL,
                       MSGLEVEL_CRAP, SILCTXT_CHANNEL_INVITING,
index 97c0c8f4d9ab9f67a3975dfb82ebf086202da440..9c66e1f17796e4fbce080bb0d92a4de8f051eb63 100644 (file)
@@ -331,6 +331,7 @@ static void command_away(const char *data, SILC_SERVER_REC *server,
 
     printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP, 
                       SILCTXT_UNSET_AWAY);
+    server->usermode_away = FALSE;
   } else {
     /* Set the away message */
     silc_client_set_away_message(silc_client, server->conn, (char *)data);
@@ -338,6 +339,7 @@ static void command_away(const char *data, SILC_SERVER_REC *server,
 
     printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP, 
                       SILCTXT_SET_AWAY, data);
+    server->usermode_away = TRUE;
   }
 
   signal_emit("away mode changed", 1, server);
index 3fca79d2f0749fa708ead419633dcb3135700f33..28c3d38bf6b021ea767cbb2d6c7b2daec378eb01 100644 (file)
@@ -151,7 +151,7 @@ static bool silc_irssi_debug_print(char *file, char *function, int line,
                                   char *message, void *context)
 {
   printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
-           "DEBUG: %s:%d:%s", function, line, message);
+           "DEBUG: %s:%d: %s", function, line, message);
   return TRUE;
 }
 
@@ -161,7 +161,8 @@ static void sig_debug_setup_changed(void)
   if (debug) {
     const char *debug_string = settings_get_str("debug_string");
     i_debug = silc_debug = TRUE;
-    silc_log_set_debug_string(debug_string);
+    if (strlen(debug_string))
+      silc_log_set_debug_string(debug_string);
     silc_log_set_debug_callbacks(silc_irssi_debug_print, NULL, NULL, NULL);
     return;
   }
@@ -174,7 +175,7 @@ static void sig_debug_setup_changed(void)
 
 static bool silc_log_misc(SilcLogType type, char *message, void *context)
 {
-  fprintf(stderr, "%s\n", message);
+  printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%s", message);
   return TRUE;
 }
 
index 2c092734057fe7e0567fae2f80bb2757ae67ceb1..6efee9d02707634c254677a072275c7db0a653ff 100644 (file)
@@ -201,7 +201,6 @@ void silc_server_command_process(SilcServer server,
                                            packet->buffer->len);
   if (!ctx->payload) {
     SILC_LOG_ERROR(("Bad command payload, packet dropped"));
-    silc_buffer_free(packet->buffer);
     silc_packet_context_free(packet);
     silc_socket_free(ctx->sock);
     silc_free(ctx);
@@ -4413,6 +4412,8 @@ SILC_SERVER_CMD_FUNC(cumode)
       /* The client tries to claim the founder rights. */
       unsigned char *tmp_auth;
       SilcUInt32 tmp_auth_len;
+      SilcChannelClientEntry chl2;
+      SilcHashTableList htl;
 
       if (!(channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) ||
          !channel->founder_key || !idata->public_key ||
@@ -4439,7 +4440,6 @@ SILC_SERVER_CMD_FUNC(cumode)
        goto out;
       }
 
-      sender_mask = chl->mode |= SILC_CHANNEL_UMODE_CHANFO;
       notify = TRUE;
       founder_key = channel->founder_key;
       fkey = silc_pkcs_public_key_encode(founder_key, &fkey_len);
@@ -4448,6 +4448,20 @@ SILC_SERVER_CMD_FUNC(cumode)
                                              SILC_STATUS_ERR_AUTH_FAILED, 0);
        goto out;
       }
+
+      /* There cannot be anyone else as founder on the channel now.  This
+        client is definitely the founder due to this authentication */
+      silc_hash_table_list(channel->user_list, &htl);
+      while (silc_hash_table_get(&htl, NULL, (void *)&chl2))
+       if (chl2->mode & SILC_CHANNEL_UMODE_CHANFO) {
+         chl2->mode &= ~SILC_CHANNEL_UMODE_CHANFO;
+         silc_server_force_cumode_change(server, NULL, channel, chl2,
+                                         chl2->mode);
+         break;
+       }
+      silc_hash_table_list_reset(&htl);
+
+      sender_mask = chl->mode |= SILC_CHANNEL_UMODE_CHANFO;
     }
   } else {
     if (chl->mode & SILC_CHANNEL_UMODE_CHANFO) {
@@ -4466,27 +4480,11 @@ SILC_SERVER_CMD_FUNC(cumode)
   if (target_mask & SILC_CHANNEL_UMODE_CHANOP) {
     /* Promote to operator */
     if (!(chl->mode & SILC_CHANNEL_UMODE_CHANOP)) {
-      if (!(sender_mask & SILC_CHANNEL_UMODE_CHANOP) &&
-         !(sender_mask & SILC_CHANNEL_UMODE_CHANFO)) {
-       silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE,
-                                             SILC_STATUS_ERR_NO_CHANNEL_PRIV,
-                                             0);
-       goto out;
-      }
-
       chl->mode |= SILC_CHANNEL_UMODE_CHANOP;
       notify = TRUE;
     }
   } else {
     if (chl->mode & SILC_CHANNEL_UMODE_CHANOP) {
-      if (!(sender_mask & SILC_CHANNEL_UMODE_CHANOP) &&
-         !(sender_mask & SILC_CHANNEL_UMODE_CHANFO)) {
-       silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE,
-                                             SILC_STATUS_ERR_NO_CHANNEL_PRIV,
-                                             0);
-       goto out;
-      }
-
       /* Demote to normal user */
       chl->mode &= ~SILC_CHANNEL_UMODE_CHANOP;
       notify = TRUE;
@@ -4565,6 +4563,28 @@ SILC_SERVER_CMD_FUNC(cumode)
     }
   }
 
+  if (target_mask & SILC_CHANNEL_UMODE_QUIET) {
+    if (!(chl->mode & SILC_CHANNEL_UMODE_QUIET)) {
+      if (client == target_client) {
+       silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE,
+                                             SILC_STATUS_ERR_PERM_DENIED, 0);
+       goto out;
+      }
+      chl->mode |= SILC_CHANNEL_UMODE_QUIET;
+      notify = TRUE;
+    }
+  } else {
+    if (chl->mode & SILC_CHANNEL_UMODE_QUIET) {
+      if (client == target_client) {
+       silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE,
+                                             SILC_STATUS_ERR_PERM_DENIED, 0);
+       goto out;
+      }
+      chl->mode &= ~SILC_CHANNEL_UMODE_QUIET;
+      notify = TRUE;
+    }
+  }
+
   idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
   tmp_id = silc_argument_get_arg_type(cmd->args, 3, &tmp_len);
 
index bab1f0e09a0c6b1d154bc03e3aedd7523a27fbdf..67454f94e9bd49bf01130f8da8fdf41d6330bc0b 100644 (file)
@@ -1887,6 +1887,10 @@ void silc_server_channel_message(SilcServer server,
       SILC_LOG_DEBUG(("Channel is silenced from operators"));
       goto out;
     }
+    if (chl->mode & SILC_CHANNEL_UMODE_QUIET) {
+      SILC_LOG_DEBUG(("Sender is quieted on the channel"));
+      goto out;
+    }
 
     /* If the packet is coming from router, but the client entry is local 
        entry to us then some router is rerouting this to us and it is not 
index 969682ff5f168ca3809fabb7f6ecf18ea5e1f6b7..bbc25aa115279aedc840ab3f8ce76e185394953a 100644 (file)
@@ -422,6 +422,9 @@ bool silc_server_init(SilcServer server)
                           server, 10, 0, SILC_TASK_TIMEOUT,
                           SILC_TASK_PRI_LOW);
 
+  if (server->server_type == SILC_ROUTER)
+    server->stat.routers++;
+
   SILC_LOG_DEBUG(("Server initialized"));
 
   /* We are done here, return succesfully */
@@ -1628,10 +1631,12 @@ SILC_TASK_CALLBACK(silc_server_accept_new_connection_final)
       }
 
       /* Statistics */
-      if (ctx->conn_type == SILC_SOCKET_TYPE_SERVER)
+      if (ctx->conn_type == SILC_SOCKET_TYPE_SERVER) {
        server->stat.my_servers++;
-      else
+      } else {
        server->stat.my_routers++;
+       server->stat.routers++;
+      }
       server->stat.servers++;
 
       id_entry = (void *)new_server;
@@ -2775,10 +2780,12 @@ void silc_server_free_sock_user_data(SilcServer server,
       silc_idlist_del_data(user_data);
       if (!silc_idlist_del_server(server->local_list, user_data))
        silc_idlist_del_server(server->global_list, user_data);
-      if (sock->type == SILC_SOCKET_TYPE_SERVER)
+      if (sock->type == SILC_SOCKET_TYPE_SERVER) {
        server->stat.my_servers--;
-      else
+      } else {
        server->stat.my_routers--;
+       server->stat.routers--;
+      }
       server->stat.servers--;
       if (server->server_type == SILC_ROUTER)
        server->stat.cell_servers--;
@@ -3716,6 +3723,8 @@ void silc_server_announce_get_channel_users(SilcServer server,
   silc_buffer_pull(*channel_modes, len);
   silc_buffer_free(tmp);
   silc_free(fkey);
+  fkey = NULL;
+  fkey_len = 0;
 
   /* Now find all users on the channel */
   silc_hash_table_list(channel->user_list, &htl);
@@ -3761,6 +3770,8 @@ void silc_server_announce_get_channel_users(SilcServer server,
     silc_buffer_pull(*channel_users_modes, len);
     silc_buffer_free(tmp);
     silc_free(fkey);
+    fkey = NULL;
+    fkey_len = 0;
     silc_buffer_free(clidp);
   }
   silc_hash_table_list_reset(&htl);
index b00fbb0d707a2d778ad65a7e22e0a8d4e0abc260..2f815d25254f0e4cb34c92bb18dbb74eec81f0c0 100644 (file)
@@ -1143,11 +1143,23 @@ void silc_server_send_connect_notifys(SilcServer server,
                          ("Your host is %s, running version %s",
                           server->server_name, server_version));
 
-  if (server->stat.clients && server->stat.servers + 1)
+  if (server->server_type == SILC_ROUTER) {
     SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
-                           ("There are %d clients on %d servers in SILC "
-                            "Network", server->stat.clients,
-                            server->stat.servers + 1));
+                           ("There are %d clients, %d servers and %d "
+                            "routers in SILC Network",
+                            server->stat.clients, server->stat.servers + 1,
+                            server->stat.routers));
+  } else {
+    if (server->stat.clients && server->stat.servers + 1)
+      SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
+                             ("There are %d clients, %d servers and %d "
+                              "routers in SILC Network",
+                              server->stat.clients, server->stat.servers + 1,
+                              (server->standalone ? 0 :
+                               !server->stat.routers ? 1 :
+                               server->stat.routers)));
+  }
+
   if (server->stat.cell_clients && server->stat.cell_servers + 1)
     SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
                            ("There are %d clients on %d server in our cell",
@@ -1391,9 +1403,10 @@ bool silc_server_force_cumode_change(SilcServer server,
 
   SILC_LOG_DEBUG(("Start"));
 
-  silc_server_send_notify_cumode(server, sock, FALSE, channel, forced_mode,
-                                server->id, SILC_ID_SERVER,
-                                chl->client->id, NULL);
+  if (sock)
+    silc_server_send_notify_cumode(server, sock, FALSE, channel, forced_mode,
+                                  server->id, SILC_ID_SERVER,
+                                  chl->client->id, NULL);
 
   idp1 = silc_id_payload_encode(server->id, SILC_ID_SERVER);
   idp2 = silc_id_payload_encode(chl->client->id, SILC_ID_CLIENT);
index 8d781039ae74b1ffe35d9691d3aa9e05eed60ffa..c2ffe6630aaf32332bf6abc8bf6a49b53e4c512e 100644 (file)
@@ -69,6 +69,10 @@ void silc_client_send_channel_message(SilcClient client,
       chu->mode & SILC_CHANNEL_UMODE_CHANOP &&
       !(chu->mode & SILC_CHANNEL_UMODE_CHANFO))
     return;
+#if 0
+  if (chu->mode & SILC_CHANNEL_UMODE_QUIET)
+    return;
+#endif
 
   /* Take the key to be used */
   if (channel->mode & SILC_CHANNEL_MODE_PRIVKEY) {
index 7e60a0c1739b132e2732cc252d2b2f2d9d5ac36b..07fb54ce17dd2468c4e4e86040b4eb79f641dfb2 100644 (file)
@@ -482,8 +482,6 @@ SILC_CLIENT_CMD_FUNC(topic)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -493,16 +491,12 @@ SILC_CLIENT_CMD_FUNC(topic)
   }
 
   if (!conn->current_channel) {
-    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-       "You are not on that channel");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
     goto out;
   }
 
   /* Get the Channel ID of the channel */
   if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
-    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-       "You are not on that channel");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
     goto out;
   }
@@ -564,8 +558,6 @@ SILC_CLIENT_CMD_FUNC(invite)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -576,8 +568,6 @@ SILC_CLIENT_CMD_FUNC(invite)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are on that channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1251,8 +1241,6 @@ SILC_CLIENT_CMD_FUNC(cmode)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1263,8 +1251,6 @@ SILC_CLIENT_CMD_FUNC(cmode)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are on that channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1482,8 +1468,6 @@ SILC_CLIENT_CMD_FUNC(cumode)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1494,8 +1478,6 @@ SILC_CLIENT_CMD_FUNC(cumode)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are on that channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1591,6 +1573,12 @@ SILC_CLIENT_CMD_FUNC(cumode)
       else
        mode &= ~SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS;
       break;
+    case 'q':
+      if (add)
+       mode |= SILC_CHANNEL_UMODE_QUIET;
+      else
+       mode &= ~SILC_CHANNEL_UMODE_QUIET;
+      break;
     default:
       COMMAND_ERROR(SILC_STATUS_ERR_UNKNOWN_MODE);
       goto out;
@@ -1657,8 +1645,6 @@ SILC_CLIENT_CMD_FUNC(kick)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1668,16 +1654,12 @@ SILC_CLIENT_CMD_FUNC(kick)
   }
 
   if (!conn->current_channel) {
-    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-       "You are not on that channel");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
     goto out;
   }
 
   /* Get the Channel ID of the channel */
   if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
-    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-       "You are not on that channel");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
     goto out;
   }
@@ -1893,8 +1875,6 @@ SILC_CLIENT_CMD_FUNC(ban)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -1905,8 +1885,6 @@ SILC_CLIENT_CMD_FUNC(ban)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are noton that channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -2043,8 +2021,6 @@ SILC_CLIENT_CMD_FUNC(leave)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
@@ -2056,8 +2032,6 @@ SILC_CLIENT_CMD_FUNC(leave)
   /* Get the channel entry */
   channel = silc_client_get_channel(cmd->client, conn, name);
   if (!channel) {
-    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-       "You are not on that channel");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
     goto out;
   }
@@ -2116,8 +2090,6 @@ SILC_CLIENT_CMD_FUNC(users)
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-         "You are not on any channel");
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
index d081fffea4bcf3e77b8d777c99c0d448006aad66..9392b3bca1ade1bba9164d525084aa2193129c93 100644 (file)
@@ -73,7 +73,7 @@
                                                               users */
 #define SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS 0x00000010 /* Block messages
                                                               from robots */
-#define SILC_CHANNEL_UMODE_QUIET           0x00000002 /* user is quiet */
+#define SILC_CHANNEL_UMODE_QUIET           0x00000020 /* user is quiet */
 /***/
 
 /****d* silccore/Modes/SilcUserMode
index acdf3a9bd178211bf42e742d3fd2119a8bcf0866..bb10741bec35ca9a2fe3ea8b3885092dee6dcdcd 100644 (file)
@@ -690,6 +690,9 @@ char *silc_client_chumode(SilcUInt32 mode)
   if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS)
     strncat(string, "r", 1);
 
+  if (mode & SILC_CHANNEL_UMODE_QUIET)
+    strncat(string, "q", 1);
+
   return strdup(string);
 }
 
@@ -710,6 +713,9 @@ char *silc_client_chumode_char(SilcUInt32 mode)
   if (mode & SILC_CHANNEL_UMODE_CHANOP)
     strncat(string, "@", 1);
 
+  if (mode & SILC_CHANNEL_UMODE_QUIET)
+    strncat(string, "&", 1);
+
   return strdup(string);
 }