Re: [dev] [ii] [PATCH] keep nick synchronized with server

From: Truls Becken <truls.becken_AT_gmail.com>
Date: Tue, 27 Jan 2015 08:56:28 +0100

Alternatively, /n could still send NICK, but not prematurely set the variable.

-Truls

On Mon, Jan 26, 2015 at 3:23 AM, Troy Sankey <sankeytms_AT_gmail.com> wrote:
> Hi,
>
> If an error occurs changing nick (with /n) then it will become out of
> sync with the server. Here are some of the consequences:
>
> * ii will log outgoing messages with the new nick, but others will
> receive them from the old nick
> * private messaging breaks
>
> Conceivably, this issue is common on large networks where there is a
> high likelihood of nick collisions. I noticed it on my own server where
> the maximum nick length is 9 characters, and I accidentally exceeded
> that.
>
> This patch removes the /n command, making /NICK the only way to change
> the nick. This could make people angry, what do you think? /me doesn't
> think there are many people using ii, so it won't make many people
> angry :-)
>
> Troy
>
> FAQ | 6 +++---
> ii.c | 12 ++++--------
> 2 files changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/FAQ b/FAQ
> index 4aefa6a..a571dbe 100644
> --- a/FAQ
> +++ b/FAQ
> _AT_@ -16,9 +16,9 @@ like a charm.
>
> Which commands are supported?
> -----------------------------
> -j (join or msg), t (topic), a (away), n (nick), l (leave). The missing are
> -obsolete or can be easily used by typing the IRC commands itself (i.e. /WHO
> -instead of /who).
> +j (join or msg), t (topic), a (away), l (leave). The missing are obsolete or
> +can be easily used by typing the IRC commands itself (i.e. /WHO instead of
> +/who).
>
> How can I recognize queries?
> ----------------------------
> diff --git a/ii.c b/ii.c
> index d93266c..b044b7f 100644
> --- a/ii.c
> +++ b/ii.c
> _AT_@ -259,12 +259,6 @@ static void proc_channels_input(Channel *c, char *buf) {
> else
> snprintf(message, PIPE_BUF, "AWAY :%s\r\n", &buf[3]);
> break;
> - case 'n':
> - if(strlen(buf)>=3){
> - snprintf(nick, sizeof(nick),"%s", &buf[3]);
> - snprintf(message, PIPE_BUF, "NICK %s\r\n", &buf[3]);
> - }
> - break;
> case 'l':
> if(c->name[0] == 0)
> return;
> _AT_@ -357,9 +351,11 @@ static void proc_server_cmd(char *buf) {
> snprintf(message, PIPE_BUF, "-!- %s changed mode/%s -> %s %s", argv[TOK_NICKSRV], argv[TOK_CMD + 1] ? argv[TOK_CMD + 1] : "" , argv[TOK_CMD + 2]? argv[TOK_CMD + 2] : "", argv[TOK_CMD + 3] ? argv[TOK_CMD + 3] : "");
> else if(!strncmp("QUIT", argv[TOK_CMD], 5))
> snprintf(message, PIPE_BUF, "-!- %s(%s) has quit \"%s\"", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_TEXT] ? argv[TOK_TEXT] : "");
> - else if(!strncmp("NICK", argv[TOK_CMD], 5))
> + else if(!strncmp("NICK", argv[TOK_CMD], 5)) {
> snprintf(message, PIPE_BUF, "-!- %s changed nick to %s", argv[TOK_NICKSRV], argv[TOK_TEXT]);
> + if(!strcmp(argv[TOK_NICKSRV], nick))
> + snprintf(nick, sizeof(nick),"%s", argv[TOK_TEXT]);
> - else if(!strncmp("TOPIC", argv[TOK_CMD], 6))
> + } else if(!strncmp("TOPIC", argv[TOK_CMD], 6))
> snprintf(message, PIPE_BUF, "-!- %s changed topic to \"%s\"", argv[TOK_NICKSRV], argv[TOK_TEXT] ? argv[TOK_TEXT] : "");
> else if(!strncmp("KICK", argv[TOK_CMD], 5))
> snprintf(message, PIPE_BUF, "-!- %s kicked %s (\"%s\")", argv[TOK_NICKSRV], argv[TOK_ARG], argv[TOK_TEXT] ? argv[TOK_TEXT] : "");
Received on Tue Jan 27 2015 - 08:56:28 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 27 2015 - 09:00:09 CET