but check whether the channel by that name already exists.
Affected file irssi/silc/core/silc-channels.c.
+ * Do not send the SERVER_SIGNOFF to router if the disconnected
+ entity was the router. Affected file silcd/server.c.
+
+ * Added the handling of the SERVER_SIGNOFF notify to the Irssi
+ SILC client as it was missing from there.
+
+ Added the handling of the KICK notify to the Irssi SILC client
+ as it was missing. Added "you have been kicked" message to
+ Irssi SILC client's message modules formats.
+
+ Added the handing of the KILL notify to the Irssi SILC client
+ as it was missing. Added the kill message module formats
+ as well.
+
+ The affected file is irssi/src/silc/core/silc-channels.c.
+
Sun Jun 17 15:26:05 EEST 2001 Pekka Riikonen <priikone@poseidon.pspt.fi>
* Fixed the GETKEY command in the server to check also the
TODO/bugs In SILC Server
========================
- o Normal server seemed not to distribute the SERVER_SIGNOFF properly
- when its router disconnected.
-
- o Router seemed not to force the channel mode change if the normal
- server announced different modes than what the router had. For example
- if router crashed and then reconnected the server had different
- modes on the channel.
-
o When server quits and all clients of that server are removed from all
channels the channel keys are re-generated for all clients. This is
a bug and should be done only once per channel after all clients of
{ "ban_list", "channel {channel $0} ban list: $1", 2, { 0, 0 } },
{ "no_ban_list", "channel {channel $0} ban list not set", 1, { 0 } },
{ "inviting", "Inviting {nick $0} to channel {channel $1}", 2, { 0, 0 } },
+ { "kicked_you", "You have been kicked off channel {channel $0} ($1}", 2, { 0, 0 } },
+ { "kicked", "{nick $0} has been kicked off channel {channel $1} ($2)", 3, { 0, 0, 0 } },
+ { "killed_you", "You have been killed from the SILC Network", 0 },
+ { "killed", "{nick $0} has been killed from the SILC Network ($1)", 2, { 0, 0 } },
/* WHOIS, WHOWAS and USERS (alias WHO) messages */
{ NULL, "Who Queries", 0 },
SILCTXT_CHANNEL_BAN_LIST,
SILCTXT_CHANNEL_NO_BAN_LIST,
SILCTXT_CHANNEL_INVITING,
+ SILCTXT_CHANNEL_KICKED_YOU,
+ SILCTXT_CHANNEL_KICKED,
+ SILCTXT_CHANNEL_KILLED_YOU,
+ SILCTXT_CHANNEL_KILLED,
SILCTXT_FILL_2,
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.
{
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);
static void event_channel_change(SILC_SERVER_REC *server, va_list va)
{
-
+ /* Nothing interesting to do */
}
/*
static void event_server_signoff(SILC_SERVER_REC *server, va_list va)
{
-
+ SilcClientEntry *clients;
+ uint32 clients_count;
+ int i;
+
+ (void)va_arg(va, void *);
+ clients = va_arg(va, SilcClientEntry *);
+ clients_count = va_arg(va, uint32);
+
+ for (i = 0; i < clients_count; i++)
+ signal_emit("message quit", 4, server, clients[i]->nickname,
+ clients[i]->username ? clients[i]->username : "",
+ "server signoff");
}
/*
static void event_kick(SILC_SERVER_REC *server, va_list va)
{
+ SilcClientConnection conn = server->conn;
+ SilcClientEntry client_entry;
+ SilcChannelEntry channel_entry;
+ char *tmp;
+ client_entry = va_arg(va, SilcClientEntry);
+ tmp = va_arg(va, char *);
+ channel_entry = va_arg(va, SilcChannelEntry);
+
+ if (client_entry == conn->local_entry) {
+ printformat_module("fe-common/silc", server, channel_entry->channel_name,
+ MSGLEVEL_ACTIONS, SILCTXT_CHANNEL_KICKED_YOU,
+ channel_entry->channel_name, tmp ? tmp : "");
+ } else {
+ printformat_module("fe-common/silc", server, channel_entry->channel_name,
+ MSGLEVEL_ACTIONS, SILCTXT_CHANNEL_KICKED,
+ client_entry->nickname,
+ channel_entry->channel_name, tmp ? tmp : "");
+ }
}
/*
static void event_kill(SILC_SERVER_REC *server, va_list va)
{
+ SilcClientConnection conn = server->conn;
+ SilcClientEntry client_entry;
+ SilcChannelEntry channel_entry;
+ char *tmp;
-}
-
-/*
- * "event ban". Someone was banned or ban list was modified.
- */
-
-static void event_ban(SILC_SERVER_REC *server, va_list va)
-{
-
+ client_entry = va_arg(va, SilcClientEntry);
+ tmp = va_arg(va, char *);
+ channel_entry = va_arg(va, SilcChannelEntry);
+
+ if (client_entry == conn->local_entry) {
+ printformat_module("fe-common/silc", server, channel_entry->channel_name,
+ MSGLEVEL_ACTIONS, SILCTXT_CHANNEL_KILLED_YOU,
+ channel_entry->channel_name, tmp ? tmp : "");
+ } else {
+ printformat_module("fe-common/silc", server, channel_entry->channel_name,
+ MSGLEVEL_ACTIONS, SILCTXT_CHANNEL_KILLED,
+ client_entry->nickname,
+ channel_entry->channel_name, tmp ? tmp : "");
+ }
}
/* PART (LEAVE) command. */
signal_add("silc event server_signoff", (SIGNAL_FUNC) event_server_signoff);
signal_add("silc event kick", (SIGNAL_FUNC) event_kick);
signal_add("silc event kill", (SIGNAL_FUNC) event_kill);
- signal_add("silc event ban", (SIGNAL_FUNC) event_ban);
command_bind("part", MODULE_NAME, (SIGNAL_FUNC) command_part);
command_bind("me", MODULE_NAME, (SIGNAL_FUNC) command_me);
(SIGNAL_FUNC) event_server_signoff);
signal_remove("silc event kick", (SIGNAL_FUNC) event_kick);
signal_remove("silc event kill", (SIGNAL_FUNC) event_kill);
- signal_remove("silc event ban", (SIGNAL_FUNC) event_ban);
command_unbind("part", (SIGNAL_FUNC) command_part);
command_unbind("me", (SIGNAL_FUNC) command_me);
server_name = entry->server_name;
/* Send the reply */
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INFO,
- SILC_STATUS_OK, ident, 3,
- 2, idp->data, idp->len,
- 3, server_name,
- strlen(server_name),
- 4, server_info,
- strlen(server_info));
+ if (server_info)
+ packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INFO,
+ SILC_STATUS_OK, ident, 3,
+ 2, idp->data, idp->len,
+ 3, server_name,
+ strlen(server_name),
+ 4, server_info,
+ strlen(server_info));
+ else
+ packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INFO,
+ SILC_STATUS_OK, ident, 2,
+ 2, idp->data, idp->len,
+ 3, server_name,
+ strlen(server_name));
silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
packet->data, packet->len, FALSE);
return;
}
+ /* Get the mode and set it to the channel */
+ channel->mode = silc_channel_get_mode(payload);
+
/* Send the new channel key to the server */
chk = silc_channel_key_payload_encode(id_len, id,
strlen(channel->channel_key->
SilcBuffer args;
/* Send SERVER_SIGNOFF notify to our primary router */
- if (!server->standalone && server->router) {
+ if (!server->standalone && server->router &&
+ server->router != entry) {
args = silc_argument_payload_encode(1, argv, argv_lens,
argv_types);
silc_server_send_notify_args(server,
(3) [<invite list>]
This command replies with the invite list of the channel if it
- exists.
+ exists. The <invite list> may be omitted if the list was not
+ altered.
Status messages:
SilcIDCacheEntry id_cache;
SilcClientID *remote_id = NULL;
SilcClientEntry remote_client;
+ SilcMessageFlags flags;
if (packet->src_id_type != SILC_ID_CLIENT)
goto out;
return;
}
+ flags = silc_private_message_get_flags(payload);
+
/* Pass the private message to application */
- client->ops->private_message(client, conn, remote_client,
- silc_private_message_get_flags(payload),
+ client->ops->private_message(client, conn, remote_client, flags,
silc_private_message_get_message(payload,
NULL));
/* See if we are away (gone). If we are away we will reply to the
sender with the set away message. */
- if (conn->away && conn->away->away) {
+ if (conn->away && conn->away->away && !(flags & SILC_MESSAGE_FLAG_NOREPLY)) {
/* If it's me, ignore */
if (SILC_ID_CLIENT_COMPARE(remote_id, conn->local_id))
goto out;
/* Send the away message */
silc_client_send_private_message(client, conn, remote_client,
- SILC_MESSAGE_FLAG_AUTOREPLY,
+ SILC_MESSAGE_FLAG_AUTOREPLY |
+ SILC_MESSAGE_FLAG_NOREPLY,
conn->away->away,
strlen(conn->away->away), TRUE);
}
goto out;
}
+ if (cmd->argc < 2) {
+ cmd->client->ops->say(cmd->client, conn, "Usage: /NICK <nickname>");
+ COMMAND_ERROR;
+ goto out;
+ }
+
if (!strcmp(conn->nickname, cmd->argv[1]))
goto out;
cmd->pending = 1;
return;
}
-
- cmd->client->ops->say(cmd->client, conn,
- "Inviting %s to channel %s", cmd->argv[2],
- channel->channel_name);
} else {
invite = cmd->argv[2];
invite++;
int ll;
mode |= SILC_CHANNEL_MODE_ULIMIT;
type = 3;
+ if (cmd->argc < 4) {
+ cmd->client->ops->say(cmd->client, conn,
+ "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+ COMMAND_ERROR;
+ goto out;
+ }
ll = atoi(cmd->argv[3]);
SILC_PUT32_MSB(ll, tmp);
arg = tmp;
if (add) {
mode |= SILC_CHANNEL_MODE_PASSPHRASE;
type = 4;
+ if (cmd->argc < 4) {
+ cmd->client->ops->say(cmd->client, conn,
+ "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+ COMMAND_ERROR;
+ goto out;
+ }
arg = cmd->argv[3];
arg_len = cmd->argv_lens[3];
} else {
if (add) {
mode |= SILC_CHANNEL_MODE_CIPHER;
type = 5;
+ if (cmd->argc < 4) {
+ cmd->client->ops->say(cmd->client, conn,
+ "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+ COMMAND_ERROR;
+ goto out;
+ }
arg = cmd->argv[3];
arg_len = cmd->argv_lens[3];
} else {
if (add) {
mode |= SILC_CHANNEL_MODE_HMAC;
type = 6;
+ if (cmd->argc < 4) {
+ cmd->client->ops->say(cmd->client, conn,
+ "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+ COMMAND_ERROR;
+ goto out;
+ }
arg = cmd->argv[3];
arg_len = cmd->argv_lens[3];
} else {
mode |= SILC_CHANNEL_MODE_FOUNDER_AUTH;
type = 7;
+ if (cmd->argc < 4) {
+ cmd->client->ops->say(cmd->client, conn,
+ "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+ COMMAND_ERROR;
+ goto out;
+ }
+
if (!strcasecmp(cmd->argv[3], "-pubkey")) {
auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
cmd->client->private_key,
}
}
- if (type && cmd->argc < 3) {
- COMMAND_ERROR;
- goto out;
- }
-
chidp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL);
SILC_PUT32_MSB(mode, modebuf);
{ STAT(NO_SERVER_ID), "No Server ID given" },
{ STAT(BAD_CLIENT_ID), "Bad Client ID" },
{ STAT(BAD_CHANNEL_ID), "Bad Channel ID" },
- { STAT(NO_SUCH_CLIENT_ID), "No such Client ID" },
- { STAT(NO_SUCH_CHANNEL_ID),"No such Channel ID" },
+ { STAT(NO_SUCH_CLIENT_ID), "There was no such client" },
+ { STAT(NO_SUCH_CHANNEL_ID),"There was no such channel" },
{ STAT(NICKNAME_IN_USE), "Nickname already exists" },
{ STAT(NOT_ON_CHANNEL), "You are not on that channel" },
{ STAT(USER_NOT_ON_CHANNEL),"They are not on the channel" },