comparison libpurple/protocols/yahoo/libymsg.c @ 28122:b6a9e2079d50

Use PURPLE_CONNECTION_ERROR_NETWORK_ERROR as the connection error reason, which will allow libpurple's auto-reconnect to handle the reconnection instead of forcing it in the prpl
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 01 Aug 2009 15:59:40 +0000
parents c499a1e8ceff
children da33da2e1a1e b55e1786d131
comparison
equal deleted inserted replaced
28121:c499a1e8ceff 28122:b6a9e2079d50
2033 char *msg; 2033 char *msg;
2034 char *url = NULL; 2034 char *url = NULL;
2035 char *fullmsg; 2035 char *fullmsg;
2036 PurpleAccount *account = gc->account; 2036 PurpleAccount *account = gc->account;
2037 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; 2037 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
2038 gboolean reconnect = FALSE;
2039 2038
2040 while (l) { 2039 while (l) {
2041 struct yahoo_pair *pair = l->data; 2040 struct yahoo_pair *pair = l->data;
2042 2041
2043 if (pair->key == 66) 2042 if (pair->key == 66)
2084 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; 2083 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
2085 break; 2084 break;
2086 case 52: 2085 case 52:
2087 /* See #9660. As much as we know, reconnecting shouldn't hurt */ 2086 /* See #9660. As much as we know, reconnecting shouldn't hurt */
2088 purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n"); 2087 purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n");
2089 reconnect = TRUE;
2090 msg = g_strdup_printf(_("Unknown error")); 2088 msg = g_strdup_printf(_("Unknown error"));
2089 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
2091 break; 2090 break;
2092 case 1013: 2091 case 1013:
2093 msg = g_strdup(_("Invalid username")); 2092 msg = g_strdup(_("Invalid username"));
2094 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; 2093 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
2095 break; 2094 break;
2103 fullmsg = g_strdup(msg); 2102 fullmsg = g_strdup(msg);
2104 2103
2105 purple_connection_error_reason(gc, reason, fullmsg); 2104 purple_connection_error_reason(gc, reason, fullmsg);
2106 g_free(msg); 2105 g_free(msg);
2107 g_free(fullmsg); 2106 g_free(fullmsg);
2108
2109 /* In case of error 52, we reconnect */
2110 if(reconnect)
2111 purple_account_connect(account);
2112 } 2107 }
2113 2108
2114 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) 2109 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt)
2115 { 2110 {
2116 int err = 0; 2111 int err = 0;