src/protocols/irc/msgs.c

changeset 10634
36376a661022
parent 10633
ac455de21138
child 10637
aad1c50f2682
equal deleted inserted replaced
10633:ac455de21138 10634:36376a661022
165 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args) 165 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args)
166 { 166 {
167 GaimConnection *gc; 167 GaimConnection *gc;
168 GString *info; 168 GString *info;
169 char buffer[256]; 169 char buffer[256];
170 char *str; 170 char *str, *tmp;
171 171
172 if (!irc->whois.nick) { 172 if (!irc->whois.nick) {
173 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected End of WHOIS for %s\n", args[1]); 173 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected End of WHOIS for %s\n", args[1]);
174 return; 174 return;
175 } 175 }
177 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Received end of WHOIS for %s, expecting %s\n", args[1], irc->whois.nick); 177 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Received end of WHOIS for %s, expecting %s\n", args[1], irc->whois.nick);
178 return; 178 return;
179 } 179 }
180 180
181 info = g_string_new(""); 181 info = g_string_new("");
182 g_string_append_printf(info, _("<b>%s:</b> %s"), _("Nick"), args[1]); 182 tmp = g_markup_escape_text(args[1], -1);
183 g_string_append_printf(info, _("<b>%s:</b> %s"), _("Nick"), tmp);
184 g_free(tmp);
183 g_string_append_printf(info, "%s%s<br>", 185 g_string_append_printf(info, "%s%s<br>",
184 irc->whois.ircop ? _(" <i>(ircop)</i>") : "", 186 irc->whois.ircop ? _(" <i>(ircop)</i>") : "",
185 irc->whois.identified ? _(" <i>(identified)</i>") : ""); 187 irc->whois.identified ? _(" <i>(identified)</i>") : "");
186 if (irc->whois.away) { 188 if (irc->whois.away) {
187 char *tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away)); 189 tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away));
188 g_free(irc->whois.away); 190 g_free(irc->whois.away);
189 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Away"), tmp); 191 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Away"), tmp);
190 g_free(tmp); 192 g_free(tmp);
191 } 193 }
192 if (irc->whois.userhost) { 194 if (irc->whois.userhost) {
193 char *tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name)); 195 tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name));
194 g_free(irc->whois.name); 196 g_free(irc->whois.name);
195 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Username"), irc->whois.userhost); 197 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Username"), irc->whois.userhost);
196 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Realname"), tmp); 198 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Realname"), tmp);
197 g_free(irc->whois.userhost); 199 g_free(irc->whois.userhost);
198 g_free(tmp); 200 g_free(tmp);
442 444
443 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) 445 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args)
444 { 446 {
445 GaimConnection *gc; 447 GaimConnection *gc;
446 GaimConversation *convo; 448 GaimConversation *convo;
449 char *nick;
447 450
448 convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, args[1], irc->account); 451 convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, args[1], irc->account);
449 if (convo) { 452 if (convo) {
450 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */ 453 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */
451 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"), 454 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"),
454 gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"), 457 gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"),
455 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); 458 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
456 } else { 459 } else {
457 if ((gc = gaim_account_get_connection(irc->account)) == NULL) 460 if ((gc = gaim_account_get_connection(irc->account)) == NULL)
458 return; 461 return;
459 gaim_notify_error(gc, NULL, _("No such nick or channel"), args[1]); 462 nick = gaim_markup_escape_text(args[1], -1);
463 gaim_notify_error(gc, NULL, _("No such nick or channel"), nick);
464 g_free(nick);
460 } 465 }
461 466
462 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { 467 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
463 g_free(irc->whois.nick); 468 g_free(irc->whois.nick);
464 irc->whois.nick = NULL; 469 irc->whois.nick = NULL;

mercurial