libpurple/protocols/irc/parse.c

changeset 40765
a5381c20e802
parent 40618
4726bf0ff977
child 41159
2b4446ccebc9
equal deleted inserted replaced
40763:502c78a7f11f 40765:a5381c20e802
258 return NULL; 258 return NULL;
259 } 259 }
260 260
261 utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err); 261 utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err);
262 if (err) { 262 if (err) {
263 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message); 263 purple_debug_error("irc", "Send conversion error: %s", err->message);
264 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]); 264 purple_debug_error("irc", "Sending as UTF-8 instead of %s", encodings[0]);
265 utf8 = g_strdup(string); 265 utf8 = g_strdup(string);
266 g_error_free(err); 266 g_error_free(err);
267 } 267 }
268 g_strfreev(encodings); 268 g_strfreev(encodings);
269 269
478 if (font) 478 if (font)
479 decoded = g_string_append(decoded, "</FONT>"); 479 decoded = g_string_append(decoded, "</FONT>");
480 bold = italic = underline = font = FALSE; 480 bold = italic = underline = font = FALSE;
481 break; 481 break;
482 default: 482 default:
483 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur); 483 purple_debug_error("irc", "Unexpected mIRC formatting character %d", *cur);
484 } 484 }
485 } while (*cur); 485 } while (*cur);
486 486
487 return g_string_free(decoded, FALSE); 487 return g_string_free(decoded, FALSE);
488 } 488 }
578 (gdouble)G_USEC_PER_SEC); 578 (gdouble)G_USEC_PER_SEC);
579 purple_notify_info(gc, _("PONG"), 579 purple_notify_info(gc, _("PONG"),
580 _("CTCP PING reply"), buf, 580 _("CTCP PING reply"), buf,
581 purple_request_cpar_from_connection(gc)); 581 purple_request_cpar_from_connection(gc));
582 g_free(buf); 582 g_free(buf);
583 } else 583 } else {
584 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unable to parse PING timestamp"); 584 purple_debug_error("irc", "Unable to parse PING timestamp");
585 }
585 return NULL; 586 return NULL;
586 } else { 587 } else {
587 buf = irc_format(irc, "vt:", "NOTICE", from, msg); 588 buf = irc_format(irc, "vt:", "NOTICE", from, msg);
588 irc_send(irc, buf); 589 irc_send(irc, buf);
589 g_free(buf); 590 g_free(buf);
607 void irc_msg_table_build(struct irc_conn *irc) 608 void irc_msg_table_build(struct irc_conn *irc)
608 { 609 {
609 int i; 610 int i;
610 611
611 if (!irc || !irc->msgs) { 612 if (!irc || !irc->msgs) {
612 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a message table on a bogus structure\n"); 613 purple_debug_error("irc", "Attempt to build a message table on a bogus structure");
613 return; 614 return;
614 } 615 }
615 616
616 for (i = 0; _irc_msgs[i].name; i++) { 617 for (i = 0; _irc_msgs[i].name; i++) {
617 g_hash_table_insert(irc->msgs, (gpointer)_irc_msgs[i].name, (gpointer)&_irc_msgs[i]); 618 g_hash_table_insert(irc->msgs, (gpointer)_irc_msgs[i].name, (gpointer)&_irc_msgs[i]);
621 void irc_cmd_table_build(struct irc_conn *irc) 622 void irc_cmd_table_build(struct irc_conn *irc)
622 { 623 {
623 int i; 624 int i;
624 625
625 if (!irc || !irc->cmds) { 626 if (!irc || !irc->cmds) {
626 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a command table on a bogus structure\n"); 627 purple_debug_error("irc", "Attempt to build a command table on a bogus structure");
627 return; 628 return;
628 } 629 }
629 630
630 for (i = 0; _irc_cmds[i].name ; i++) { 631 for (i = 0; _irc_cmds[i].name ; i++) {
631 g_hash_table_insert(irc->cmds, (gpointer)_irc_cmds[i].name, (gpointer)&_irc_cmds[i]); 632 g_hash_table_insert(irc->cmds, (gpointer)_irc_cmds[i].name, (gpointer)&_irc_cmds[i]);
658 tmp = irc_send_convert(irc, tok); 659 tmp = irc_send_convert(irc, tok);
659 g_string_append(string, tmp ? tmp : tok); 660 g_string_append(string, tmp ? tmp : tok);
660 g_free(tmp); 661 g_free(tmp);
661 break; 662 break;
662 default: 663 default:
663 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Invalid format character '%c'\n", *cur); 664 purple_debug_error("irc", "Invalid format character '%c'", *cur);
664 break; 665 break;
665 } 666 }
666 } 667 }
667 va_end(ap); 668 va_end(ap);
668 g_string_append(string, "\r\n"); 669 g_string_append(string, "\r\n");
780 * it leaks past the IRC protocol */ 781 * it leaks past the IRC protocol */
781 args[i] = g_utf8_make_valid(cur, -1); 782 args[i] = g_utf8_make_valid(cur, -1);
782 cur = cur + strlen(cur); 783 cur = cur + strlen(cur);
783 break; 784 break;
784 default: 785 default:
785 purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid message format character '%c'\n", fmt[i]); 786 purple_debug_error("irc", "invalid message format character '%c'", fmt[i]);
786 fmt_valid = FALSE; 787 fmt_valid = FALSE;
787 break; 788 break;
788 } 789 }
789 if (fmt_valid) 790 if (fmt_valid)
790 args_cnt = i + 1; 791 args_cnt = i + 1;
811 { 812 {
812 char *clean; 813 char *clean;
813 /* This really should be escaped somehow that you can tell what 814 /* This really should be escaped somehow that you can tell what
814 * the junk was -- but as it is, it can crash glib. */ 815 * the junk was -- but as it is, it can crash glib. */
815 clean = g_utf8_make_valid(input, -1); 816 clean = g_utf8_make_valid(input, -1);
816 purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", clean); 817 purple_debug_warning("irc", "Unrecognized string: %s", clean);
817 g_free(clean); 818 g_free(clean);
818 } 819 }

mercurial