+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
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
================================
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.
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
{ "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 },
SILCTXT_CHANNEL_KICKED,
SILCTXT_CHANNEL_KILLED_YOU,
SILCTXT_CHANNEL_KILLED,
+ SILCTXT_CHANNEL_QUIETED,
SILCTXT_FILL_2,
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;
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,
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);
printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
SILCTXT_SET_AWAY, data);
+ server->usermode_away = TRUE;
}
signal_emit("away mode changed", 1, server);
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;
}
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;
}
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;
}
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);
/* 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 ||
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);
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) {
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;
}
}
+ 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);
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
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 */
}
/* 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;
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--;
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);
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);
("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",
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);
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) {
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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
}
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;
}
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;
}
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;
}
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;
}
/* 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;
}
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;
}
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
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);
}
if (mode & SILC_CHANNEL_UMODE_CHANOP)
strncat(string, "@", 1);
+ if (mode & SILC_CHANNEL_UMODE_QUIET)
+ strncat(string, "&", 1);
+
return strdup(string);
}