Mercurial > pidgin
comparison libpurple/protocols/irc/parse.c @ 20812:88aa557b997f
propagate from branch 'im.pidgin.pidgin' (head 017296ee954fb91349806c809983c916842603da)
to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 8648cc67b0f11cdb0c5d48a703bca11b56606a16)
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Sun, 07 Oct 2007 10:28:32 +0000 |
parents | c6232f341ea5 8174f6999308 |
children | ba41f2a60253 |
comparison
equal
deleted
inserted
replaced
20811:368d79355aba | 20812:88aa557b997f |
---|---|
610 void irc_parse_msg(struct irc_conn *irc, char *input) | 610 void irc_parse_msg(struct irc_conn *irc, char *input) |
611 { | 611 { |
612 struct _irc_msg *msgent; | 612 struct _irc_msg *msgent; |
613 char *cur, *end, *tmp, *from, *msgname, *fmt, **args, *msg; | 613 char *cur, *end, *tmp, *from, *msgname, *fmt, **args, *msg; |
614 guint i; | 614 guint i; |
615 PurpleConnection *gc = purple_account_get_connection(irc->account); | |
615 | 616 |
616 irc->recv_time = time(NULL); | 617 irc->recv_time = time(NULL); |
617 | 618 |
618 /* | 619 /* |
619 * The data passed to irc-receiving-text is the raw protocol data. | 620 * The data passed to irc-receiving-text is the raw protocol data. |
620 * TODO: It should be passed as an array of bytes and a length | 621 * TODO: It should be passed as an array of bytes and a length |
621 * instead of a null terminated string. | 622 * instead of a null terminated string. |
622 */ | 623 */ |
623 purple_signal_emit(_irc_plugin, "irc-receiving-text", purple_account_get_connection(irc->account), &input); | 624 purple_signal_emit(_irc_plugin, "irc-receiving-text", gc, &input); |
624 | 625 |
625 if (!strncmp(input, "PING ", 5)) { | 626 if (!strncmp(input, "PING ", 5)) { |
626 msg = irc_format(irc, "vv", "PONG", input + 5); | 627 msg = irc_format(irc, "vv", "PONG", input + 5); |
627 irc_send(irc, msg); | 628 irc_send(irc, msg); |
628 g_free(msg); | 629 g_free(msg); |
629 return; | 630 return; |
630 } else if (!strncmp(input, "ERROR ", 6)) { | 631 } else if (!strncmp(input, "ERROR ", 6)) { |
631 if (g_utf8_validate(input, -1, NULL)) { | 632 if (g_utf8_validate(input, -1, NULL)) { |
632 char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); | 633 char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); |
633 purple_connection_error(purple_account_get_connection(irc->account), tmp); | 634 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, tmp); |
634 g_free(tmp); | 635 g_free(tmp); |
635 } else | 636 } else |
636 purple_connection_error(purple_account_get_connection(irc->account), _("Disconnected.")); | 637 purple_connection_error_reason (gc, |
638 PURPLE_REASON_NETWORK_ERROR, _("Disconnected.")); | |
637 return; | 639 return; |
638 } | 640 } |
639 | 641 |
640 if (input[0] != ':' || (cur = strchr(input, ' ')) == NULL) { | 642 if (input[0] != ':' || (cur = strchr(input, ' ')) == NULL) { |
641 irc_parse_error_cb(irc, input); | 643 irc_parse_error_cb(irc, input); |