Mercurial > pidgin
diff libpurple/protocols/irc/parse.c @ 32317:d72f2f13b60f
merge of 'c8c73eea7431e6f940916315ace40a41c8da3faa'
and 'fec428131bde0ae8247941bd6a3d996c984c9189'
| author | Ethan Blanton <elb@pidgin.im> |
|---|---|
| date | Fri, 21 Oct 2011 14:36:18 +0000 |
| parents | 44fc11beefab |
| children | 3e7a7e14af62 |
line wrap: on
line diff
--- a/libpurple/protocols/irc/parse.c Fri Oct 21 14:36:06 2011 +0000 +++ b/libpurple/protocols/irc/parse.c Fri Oct 21 14:36:18 2011 +0000 @@ -175,7 +175,7 @@ if (!gc) return PURPLE_CMD_RET_FAILED; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL) return PURPLE_CMD_RET_FAILED; @@ -670,11 +670,11 @@ } else if (!strncmp(input, "ERROR ", 6)) { if (g_utf8_validate(input, -1, NULL)) { char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } else - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Disconnected.")); return; @@ -708,7 +708,14 @@ switch (fmt[i]) { case 'v': if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); - args[i] = g_strndup(cur, end - cur); + /* This is a string of unknown encoding which we do not + * want to transcode, but it may or may not be valid + * UTF-8, so we'll salvage it. If a nick/channel/target + * field has inadvertently been marked verbatim, this + * could cause weirdness. */ + tmp = g_strndup(cur, end - cur); + args[i] = purple_utf8_salvage(tmp); + g_free(tmp); cur += end - cur; break; case 't': @@ -726,7 +733,9 @@ cur = cur + strlen(cur); break; case '*': - args[i] = g_strdup(cur); + /* Ditto 'v' above; we're going to salvage this in case + * it leaks past the IRC prpl */ + args[i] = purple_utf8_salvage(cur); cur = cur + strlen(cur); break; default:
