From 57706f9277ac228886672b64638db755ba1384d7 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 15 Jun 2002 13:31:41 +0000 Subject: [PATCH] Implemented CHANNEL_UMODE_QUEIT mode. Fixed fatal bugs in server. See CHANGES for more :) --- CHANGES | 31 ++++++++++ TODO | 6 -- apps/irssi/docs/help/in/cumode.in | 9 +++ .../irssi/src/fe-common/silc/module-formats.c | 1 + .../irssi/src/fe-common/silc/module-formats.h | 1 + apps/irssi/src/silc/core/client_ops.c | 11 +++- apps/irssi/src/silc/core/silc-channels.c | 2 + apps/irssi/src/silc/core/silc-core.c | 7 ++- apps/silcd/command.c | 56 +++++++++++++------ apps/silcd/packet_receive.c | 4 ++ apps/silcd/server.c | 19 +++++-- apps/silcd/server_util.c | 27 ++++++--- lib/silcclient/client_channel.c | 4 ++ lib/silcclient/command.c | 40 ++----------- lib/silccore/silcmode.h | 2 +- lib/silcutil/silcutil.c | 6 ++ 16 files changed, 151 insertions(+), 75 deletions(-) diff --git a/CHANGES b/CHANGES index bb94fa24..78742aa6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,34 @@ +Sat Jun 15 12:09:14 EEST 2002 Pekka Riikonen + + * 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 * Added new status types KEY_AGREEMENT_ALREADY_STARTED and diff --git a/TODO b/TODO index 044d2ae3..3ab775e2 100644 --- 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 and the Attribute Payload to the core library, client and server. Maybe implementations of RFC 2425 and RFC 2426 to make it complete. diff --git a/apps/irssi/docs/help/in/cumode.in b/apps/irssi/docs/help/in/cumode.in index 5da46eb4..2bb44bca 100644 --- a/apps/irssi/docs/help/in/cumode.in +++ b/apps/irssi/docs/help/in/cumode.in @@ -49,5 +49,14 @@ are available: as robots. Client may set this mode only to itself. + q [@] + + 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 diff --git a/apps/irssi/src/fe-common/silc/module-formats.c b/apps/irssi/src/fe-common/silc/module-formats.c index f823d50e..108f96e8 100644 --- a/apps/irssi/src/fe-common/silc/module-formats.c +++ b/apps/irssi/src/fe-common/silc/module-formats.c @@ -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 }, diff --git a/apps/irssi/src/fe-common/silc/module-formats.h b/apps/irssi/src/fe-common/silc/module-formats.h index dec4985d..035a3fdc 100644 --- a/apps/irssi/src/fe-common/silc/module-formats.h +++ b/apps/irssi/src/fe-common/silc/module-formats.h @@ -44,6 +44,7 @@ enum { SILCTXT_CHANNEL_KICKED, SILCTXT_CHANNEL_KILLED_YOU, SILCTXT_CHANNEL_KILLED, + SILCTXT_CHANNEL_QUIETED, SILCTXT_FILL_2, diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index 4a5e1583..7d53788f 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -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, diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index 97c0c8f4..9c66e1f1 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -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); diff --git a/apps/irssi/src/silc/core/silc-core.c b/apps/irssi/src/silc/core/silc-core.c index 3fca79d2..28c3d38b 100644 --- a/apps/irssi/src/silc/core/silc-core.c +++ b/apps/irssi/src/silc/core/silc-core.c @@ -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; } diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 2c092734..6efee9d0 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -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); diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index bab1f0e0..67454f94 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -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 diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 969682ff..bbc25aa1 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -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); diff --git a/apps/silcd/server_util.c b/apps/silcd/server_util.c index b00fbb0d..2f815d25 100644 --- a/apps/silcd/server_util.c +++ b/apps/silcd/server_util.c @@ -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); diff --git a/lib/silcclient/client_channel.c b/lib/silcclient/client_channel.c index 8d781039..c2ffe663 100644 --- a/lib/silcclient/client_channel.c +++ b/lib/silcclient/client_channel.c @@ -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) { diff --git a/lib/silcclient/command.c b/lib/silcclient/command.c index 7e60a0c1..07fb54ce 100644 --- a/lib/silcclient/command.c +++ b/lib/silcclient/command.c @@ -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; } diff --git a/lib/silccore/silcmode.h b/lib/silccore/silcmode.h index d081fffe..9392b3bc 100644 --- a/lib/silccore/silcmode.h +++ b/lib/silccore/silcmode.h @@ -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 diff --git a/lib/silcutil/silcutil.c b/lib/silcutil/silcutil.c index acdf3a9b..bb10741b 100644 --- a/lib/silcutil/silcutil.c +++ b/lib/silcutil/silcutil.c @@ -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); } -- 2.24.0