comparison libpurple/protocols/oscar/clientlogin.c @ 28521:546dcce6f780

oscar: According to the online docs, statusCode 607 is rate limit (confirmed by my "tests" and Adium#13368c5. 401 is supposedly "Authorization required", but I've left in that anyway. http://dev.aol.com/aim/web/serverapi_reference#startOSCARSession
author Paul Aurich <paul@darkrain42.org>
date Fri, 06 Nov 2009 18:12:01 +0000
parents 7963477c2019
children 41656cf6af7a
comparison
equal deleted inserted replaced
28520:682b441d4944 28521:546dcce6f780
107 { 107 {
108 xmlnode *response_node, *tmp_node, *data_node; 108 xmlnode *response_node, *tmp_node, *data_node;
109 xmlnode *host_node = NULL, *port_node = NULL, *cookie_node = NULL, *tls_node = NULL; 109 xmlnode *host_node = NULL, *port_node = NULL, *cookie_node = NULL, *tls_node = NULL;
110 gboolean use_tls; 110 gboolean use_tls;
111 char *tmp; 111 char *tmp;
112 guint code;
112 113
113 use_tls = purple_account_get_bool(purple_connection_get_account(gc), "use_ssl", OSCAR_DEFAULT_USE_SSL); 114 use_tls = purple_account_get_bool(purple_connection_get_account(gc), "use_ssl", OSCAR_DEFAULT_USE_SSL);
114 115
115 /* Parse the response as XML */ 116 /* Parse the response as XML */
116 response_node = xmlnode_from_str(response, response_len); 117 response_node = xmlnode_from_str(response, response_len);
151 xmlnode_free(response_node); 152 xmlnode_free(response_node);
152 return FALSE; 153 return FALSE;
153 } 154 }
154 155
155 /* Make sure the status code was 200 */ 156 /* Make sure the status code was 200 */
156 if (strcmp(tmp, "200") != 0) 157 code = atoi(tmp);
158 if (code != 200)
157 { 159 {
158 purple_debug_error("oscar", "startOSCARSession response statusCode " 160 purple_debug_error("oscar", "startOSCARSession response statusCode "
159 "was %s: %s\n", tmp, response); 161 "was %s: %s\n", tmp, response);
160 162
161 if (strcmp(tmp, "401") == 0) 163 if (code == 401 || code == 607)
162 purple_connection_error_reason(gc, 164 purple_connection_error_reason(gc,
163 PURPLE_CONNECTION_ERROR_OTHER_ERROR, 165 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
164 _("You have been connecting and disconnecting too " 166 _("You have been connecting and disconnecting too "
165 "frequently. Wait ten minutes and try again. If " 167 "frequently. Wait ten minutes and try again. If "
166 "you continue to try, you will need to wait even " 168 "you continue to try, you will need to wait even "