[dev] [ii] fix for user joining channel notifications

From: Ivan Kanakarakis <ivan.kanak_AT_gmail.com>
Date: Thu, 21 Jun 2012 23:02:52 +0300

when a random user joins a channel in
which you are already connected, the
server sends a message:

    :someuser JOIN #meow

some servers (ie oftc) send non-RFC compliant messages like:

    :someuser JOIN :#woof

this isn't restricted to JOIN messages.
ii handles this in the 'tokenize(..)' function

however on the case of JOIN ii returns, for the compliant case:

    user(~user_AT_host) has joined (null)

and redirects that to /ircbasedir/network/out
while on the non-compliant case:

    user(~user_AT_host) has joined (#channel)

and redirects that to /ircbasedir/network/#channel/out
as it should be.

this patch fixes this issue, so that join messages are
sent to the correct "out" file, including the channel name
instead of "null".

the issue is on line 355

    argv[TOK_CHAN] = argv[TOK_TEXT];

if argv[TOK_TEXT] is NULL (which is checked in a conditional
before) then argv[TOK_CHAN] becomes NULL which results
on line 365 the conditional to branch to the wrong 'print_out(..)'
function.

on the non-compliant case, argv[TOK_TEXT] is not NULL,
but argv[TOK_CHAN] is NULL.
on the compliant case, argv[TOK_TEXT] is NULL,
but arg[TOK_CHAN] is not NULL.

the attached patch, just checks if argv[TOK_TEXT] is NULL
and if it's not it gives that value to arg[TOK_CHAN], else
arg[TOK_CHAN] is used.


one sidenote:
I'm not sure why one needs to check for strchr(argv[TOK_TEXT], ' ');
on the case of a JOIN message. afaict the only text after the JOIN
command should be the channel.

PS: the diff was generated by 'git diff', but it should work just like 'hg
diff'
    $ patch -p1 < joinfix.diff # should just work


-- 
*Ivan c00kiemon5ter V Kanakarakis*  >:3

Received on Thu Jun 21 2012 - 22:02:52 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 21 2012 - 22:12:04 CEST