Mercurial > pidgin.yaz
comparison libpurple/protocols/irc/parse.c @ 24296:c204239bef48
Strip multiple leading mode characters from incoming nicknames.
This patch adds the function irc_nick_skip_mode, which takes an IRC
connection and nickname, and returns a pointer internal to the
nickname representing the first non-mode-character of the nick.
Apparently some IRC servers prepend more than one mode character to
nicknames under some circumstances; the standard is pretty vague on
the matter, and I can't see as how it hurts anything, so here goes.
This patch was originally from Marcos Garc«ża Ochoa.
Fixes #7416
committer: Ethan Blanton <elb@pidgin.im>
author | Marcos García Ochoa <magao@bigfoot.com> |
---|---|
date | Fri, 31 Oct 2008 14:51:11 +0000 |
parents | aac5753e2528 |
children | 4f46eb13b540 6ecfc6b9667c |
comparison
equal
deleted
inserted
replaced
24295:8d040d580a44 | 24296:c204239bef48 |
---|---|
495 } | 495 } |
496 result[j] = '\0'; | 496 result[j] = '\0'; |
497 return result; | 497 return result; |
498 } | 498 } |
499 | 499 |
500 const char *irc_nick_skip_mode(struct irc_conn *irc, const char *nick) | |
501 { | |
502 static const char *default_modes = "@+%&"; | |
503 const char *mode_chars; | |
504 | |
505 mode_chars = irc->mode_chars ? irc->mode_chars : default_modes; | |
506 | |
507 while (strchr(mode_chars, *nick) != NULL) | |
508 nick++; | |
509 | |
510 return nick; | |
511 } | |
512 | |
500 gboolean irc_ischannel(const char *string) | 513 gboolean irc_ischannel(const char *string) |
501 { | 514 { |
502 return (string[0] == '#' || string[0] == '&'); | 515 return (string[0] == '#' || string[0] == '&'); |
503 } | 516 } |
504 | 517 |