Mercurial > pidgin
diff src/protocols/irc/parse.c @ 8529:2f505651ac03
[gaim-migrate @ 9268]
This strips mIRC color and formatting codes from topics and provides
a generic function for stripping mirc color codes and returning plain
text (irc_mirc2txt()). This should fix Bug #923672.
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 30 Mar 2004 17:44:40 +0000 |
parents | 3f384e95c5c0 |
children | 478b6184152d |
line wrap: on
line diff
--- a/src/protocols/irc/parse.c Tue Mar 30 15:45:52 2004 +0000 +++ b/src/protocols/irc/parse.c Tue Mar 30 17:44:40 2004 +0000 @@ -35,8 +35,6 @@ static char *irc_send_convert(struct irc_conn *irc, const char *string); static char *irc_recv_convert(struct irc_conn *irc, const char *string); -char *irc_mirc2html(const char *string); - static void irc_parse_error_cb(struct irc_conn *irc, char *input); static char *irc_mirc_colors[16] = { @@ -269,6 +267,28 @@ return g_string_free(decoded, FALSE); } +char *irc_mirc2txt (const char *string) +{ + char *result = g_strdup (string); + int i, j; + + for (i = 0, j = 0; result[i]; i++) { + switch (result[i]) { + case '\002': + case '\003': + case '\007': + case '\017': + case '\026': + case '\037': + continue; + default: + result[j++] = result[i]; + } + } + result[i] = '\0'; + return result; +} + char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice) { GaimConnection *gc;