Mercurial > pidgin.yaz
comparison libpurple/protocols/irc/irc.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 | 125cac3e24ee 32ad012ef6ac bcad7dc4b453 6ecfc6b9667c |
comparison
equal
deleted
inserted
replaced
24295:8d040d580a44 | 24296:c204239bef48 |
---|---|
60 static gboolean irc_nick_equal(const char *nick1, const char *nick2); | 60 static gboolean irc_nick_equal(const char *nick1, const char *nick2); |
61 static void irc_buddy_free(struct irc_buddy *ib); | 61 static void irc_buddy_free(struct irc_buddy *ib); |
62 | 62 |
63 PurplePlugin *_irc_plugin = NULL; | 63 PurplePlugin *_irc_plugin = NULL; |
64 | 64 |
65 static const char *status_chars = "@+%&"; | |
66 | |
67 static void irc_view_motd(PurplePluginAction *action) | 65 static void irc_view_motd(PurplePluginAction *action) |
68 { | 66 { |
69 PurpleConnection *gc = (PurpleConnection *) action->context; | 67 PurpleConnection *gc = (PurpleConnection *) action->context; |
70 struct irc_conn *irc; | 68 struct irc_conn *irc; |
71 char *title; | 69 char *title; |
516 { | 514 { |
517 struct irc_conn *irc = gc->proto_data; | 515 struct irc_conn *irc = gc->proto_data; |
518 char *plain; | 516 char *plain; |
519 const char *args[2]; | 517 const char *args[2]; |
520 | 518 |
521 if (strchr(status_chars, *who) != NULL) | 519 args[0] = irc_nick_skip_mode(irc, who); |
522 args[0] = who + 1; | |
523 else | |
524 args[0] = who; | |
525 | 520 |
526 purple_markup_html_to_xhtml(what, NULL, &plain); | 521 purple_markup_html_to_xhtml(what, NULL, &plain); |
527 args[1] = plain; | 522 args[1] = plain; |
528 | 523 |
529 irc_cmd_privmsg(irc, "msg", NULL, args); | 524 irc_cmd_privmsg(irc, "msg", NULL, args); |