Mercurial > pidgin
diff libpurple/protocols/yahoo/ycht.c @ 27590:a08e84032814
merge of '2348ff22f0ff3453774b8b25b36238465580c609'
and 'e76f11543c2a4aa05bdf584f087cbe3439029661'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 12 Jul 2009 05:43:38 +0000 |
parents | 09772222714a |
children | 908be3822215 |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/ycht.c Sun Jul 12 05:42:40 2009 +0000 +++ b/libpurple/protocols/yahoo/ycht.c Sun Jul 12 05:43:38 2009 +0000 @@ -36,7 +36,7 @@ #include "conversation.h" #include "util.h" -#include "yahoo.h" +#include "libymsg.h" #include "yahoo_packet.h" #include "ycht.h" #include "yahoochat.h" @@ -196,36 +196,36 @@ #ifdef YAHOO_YCHT_DEBUG int i; - purple_debug(PURPLE_DEBUG_MISC, "yahoo", ""); + purple_debug_misc("yahoo", ""); for (i = 0; i + 1 < len; i += 2) { if ((i % 16 == 0) && i) { - purple_debug(PURPLE_DEBUG_MISC, NULL, "\n"); - purple_debug(PURPLE_DEBUG_MISC, "yahoo", ""); + purple_debug_misc(NULL, "\n"); + purple_debug_misc("yahoo", ""); } - purple_debug(PURPLE_DEBUG_MISC, NULL, "%02hhx%02hhx ", data[i], data[i + 1]); + purple_debug_misc(NULL, "%02hhx%02hhx ", data[i], data[i + 1]); } if (i < len) - purple_debug(PURPLE_DEBUG_MISC, NULL, "%02hhx", data[i]); + purple_debug_misc(NULL, "%02hhx", data[i]); - purple_debug(PURPLE_DEBUG_MISC, NULL, "\n"); - purple_debug(PURPLE_DEBUG_MISC, "yahoo", ""); + purple_debug_misc(NULL, "\n"); + purple_debug_misc("yahoo", ""); for (i = 0; i < len; i++) { if ((i % 16 == 0) && i) { - purple_debug(PURPLE_DEBUG_MISC, NULL, "\n"); - purple_debug(PURPLE_DEBUG_MISC, "yahoo", ""); + purple_debug_misc(NULL, "\n"); + purple_debug_misc("yahoo", ""); } if (g_ascii_isprint(data[i])) - purple_debug(PURPLE_DEBUG_MISC, NULL, "%c ", data[i]); + purple_debug_misc(NULL, "%c ", data[i]); else - purple_debug(PURPLE_DEBUG_MISC, NULL, ". "); + purple_debug_misc(NULL, ". "); } - purple_debug(PURPLE_DEBUG_MISC, NULL, "\n"); -#endif + purple_debug_misc(NULL, "\n"); +#endif /* YAHOO_YCHT_DEBUG */ } static YchtPkt *ycht_packet_new(guint version, guint service, int status) @@ -285,9 +285,11 @@ else if (ret <= 0) { /* TODO: error handling */ /* + gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), + g_strerror(errno)); purple_connection_error_reason(purple_account_get_connection(irc->account), - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server has disconnected")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + g_free(tmp); */ return; } @@ -454,7 +456,7 @@ static void ycht_connection_error(YchtConn *ycht, const gchar *error) { - purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server."), error); + purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server"), error); ycht_connection_close(ycht); } @@ -473,13 +475,13 @@ /* No worries */ return; - tmp = g_strdup_printf(_("Lost connection with server\n%s"), + tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); ycht_connection_error(ycht, tmp); g_free(tmp); return; } else if (len == 0) { - ycht_connection_error(ycht, _("Server closed the connection.")); + ycht_connection_error(ycht, _("Server closed the connection")); return; } @@ -507,16 +509,15 @@ service = yahoo_get32(ycht->rxqueue + pos); pos += 4; status = yahoo_get16(ycht->rxqueue + pos); pos += 2; pktlen = yahoo_get16(ycht->rxqueue + pos); pos += 2; - purple_debug(PURPLE_DEBUG_MISC, "yahoo", - "ycht: %d bytes to read, rxlen is %d\n", pktlen, ycht->rxlen); + purple_debug_misc("yahoo", "ycht: %d bytes to read, rxlen is %d\n", + pktlen, ycht->rxlen); if (ycht->rxlen < (YCHT_HEADER_LEN + pktlen)) return; purple_debug_misc("yahoo", "--==Incoming YCHT packet==--\n"); - purple_debug(PURPLE_DEBUG_MISC, "yahoo", - "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n", - service, version, status); + purple_debug_misc("yahoo", "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n", + service, version, status); ycht_packet_dump(ycht->rxqueue, YCHT_HEADER_LEN + pktlen); pkt = ycht_packet_new(version, service, status); @@ -547,7 +548,7 @@ char *buf; if (source < 0) { - ycht_connection_error(ycht, _("Unable to connect.")); + ycht_connection_error(ycht, _("Unable to connect")); return; } @@ -578,12 +579,12 @@ yd->ycht = ycht; - if (purple_proxy_connect(NULL, account, + if (purple_proxy_connect(gc, account, purple_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST), purple_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT), ycht_got_connected, ycht) == NULL) { - ycht_connection_error(ycht, _("Connection problem")); + ycht_connection_error(ycht, _("Unable to connect")); return; } }