summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-06-27 15:07:31 +0200
committerSebastien Helleu <flashcode@flashtux.org>2009-06-27 15:07:31 +0200
commit23f111329e621a39c54b11f9a6dfb5e15160d103 (patch)
treea3a323795969e8eaa9d636cbc1726aa6454192f2
parente06609c7cdc0afd3ea52a1770c4cab5df6e6b376 (diff)
downloadweechat-23f111329e621a39c54b11f9a6dfb5e15160d103.zip
Strip hostnames in IRC message 353 when uhnames protocol is enabled
-rw-r--r--src/plugins/irc/irc-protocol.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index b6d8e2737..3ce69fc34 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -3753,7 +3753,7 @@ int
irc_protocol_cmd_353 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
- char *pos_channel, *pos_nick;
+ char *pos_channel, *pos_nick, *pos_host, *nick;
const char *color;
int args, i, prefix_found;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop;
@@ -3841,19 +3841,28 @@ irc_protocol_cmd_353 (struct t_irc_server *server, const char *command,
}
if (ptr_channel && ptr_channel->nicks)
{
- if (!irc_nick_new (server, ptr_channel, pos_nick,
- is_chanowner, is_chanadmin, is_chanadmin2,
- is_op, is_halfop, has_voice, is_chanuser, 0))
+ pos_host = strchr (pos_nick, '!');
+ if (pos_host)
+ nick = weechat_strndup (pos_nick, pos_host - pos_nick);
+ else
+ nick = strdup (pos_nick);
+ if (nick)
{
- weechat_printf (server->buffer,
- _("%s%s: cannot create nick \"%s\" "
- "for channel \"%s\""),
- weechat_prefix ("error"),
- IRC_PLUGIN_NAME, pos_nick, ptr_channel->name);
+ if (!irc_nick_new (server, ptr_channel, nick,
+ is_chanowner, is_chanadmin, is_chanadmin2,
+ is_op, is_halfop, has_voice, is_chanuser, 0))
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot create nick \"%s\" "
+ "for channel \"%s\""),
+ weechat_prefix ("error"),
+ IRC_PLUGIN_NAME, nick, ptr_channel->name);
+ }
+ free (nick);
}
}
}
-
+
if (!ptr_channel)
{
weechat_printf_tags (server->buffer,