Mercurial > pidgin
comparison libpurple/protocols/oscar/oscar.c @ 20124:05726ea2dd89
Add disconnection reasons to oscar.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Mon, 01 Oct 2007 16:07:14 +0000 |
parents | b199a9be3e95 |
children | f3cfcbbac3d8 |
comparison
equal
deleted
inserted
replaced
20123:b2c46103a5b4 | 20124:05726ea2dd89 |
---|---|
991 if (conn->type == SNAC_FAMILY_AUTH) | 991 if (conn->type == SNAC_FAMILY_AUTH) |
992 { | 992 { |
993 gchar *msg; | 993 gchar *msg; |
994 msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"), | 994 msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"), |
995 error_message); | 995 error_message); |
996 purple_connection_error(gc, msg); | 996 purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg); |
997 g_free(msg); | 997 g_free(msg); |
998 } | 998 } |
999 else if (conn->type == SNAC_FAMILY_LOCATE) | 999 else if (conn->type == SNAC_FAMILY_LOCATE) |
1000 { | 1000 { |
1001 gchar *msg; | 1001 gchar *msg; |
1002 msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"), | 1002 msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"), |
1003 error_message); | 1003 error_message); |
1004 purple_connection_error(gc, msg); | 1004 purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg); |
1005 g_free(msg); | 1005 g_free(msg); |
1006 } | 1006 } |
1007 else | 1007 else |
1008 { | 1008 { |
1009 /* Maybe we should call this for BOS connections, too? */ | 1009 /* Maybe we should call this for BOS connections, too? */ |
1255 | 1255 |
1256 if (!aim_snvalid(purple_account_get_username(account))) { | 1256 if (!aim_snvalid(purple_account_get_username(account))) { |
1257 gchar *buf; | 1257 gchar *buf; |
1258 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); | 1258 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); |
1259 gc->wants_to_die = TRUE; | 1259 gc->wants_to_die = TRUE; |
1260 purple_connection_error(gc, buf); | 1260 purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, buf); |
1261 g_free(buf); | 1261 g_free(buf); |
1262 } | 1262 } |
1263 | 1263 |
1264 if (aim_snvalid_icq((purple_account_get_username(account)))) { | 1264 if (aim_snvalid_icq((purple_account_get_username(account)))) { |
1265 od->icq = TRUE; | 1265 od->icq = TRUE; |
1276 purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER), | 1276 purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER), |
1277 purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), | 1277 purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), |
1278 connection_established_cb, newconn); | 1278 connection_established_cb, newconn); |
1279 if (newconn->connect_data == NULL) | 1279 if (newconn->connect_data == NULL) |
1280 { | 1280 { |
1281 purple_connection_error(gc, _("Couldn't connect to host")); | 1281 purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, |
1282 _("Couldn't connect to host")); | |
1282 return; | 1283 return; |
1283 } | 1284 } |
1284 | 1285 |
1285 purple_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); | 1286 purple_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
1286 ck[0] = 0x5a; | 1287 ck[0] = 0x5a; |
1338 char buf[256]; | 1339 char buf[256]; |
1339 switch (info->errorcode) { | 1340 switch (info->errorcode) { |
1340 case 0x01: | 1341 case 0x01: |
1341 /* Unregistered screen name */ | 1342 /* Unregistered screen name */ |
1342 gc->wants_to_die = TRUE; | 1343 gc->wants_to_die = TRUE; |
1343 purple_connection_error(gc, _("Invalid screen name.")); | 1344 purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Invalid screen name.")); |
1344 break; | 1345 break; |
1345 case 0x05: | 1346 case 0x05: |
1346 /* Incorrect password */ | 1347 /* Incorrect password */ |
1347 gc->wants_to_die = TRUE; | 1348 gc->wants_to_die = TRUE; |
1348 if (!purple_account_get_remember_password(account)) | 1349 if (!purple_account_get_remember_password(account)) |
1349 purple_account_set_password(account, NULL); | 1350 purple_account_set_password(account, NULL); |
1350 purple_connection_error(gc, _("Incorrect password.")); | 1351 purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Incorrect password.")); |
1351 break; | 1352 break; |
1352 case 0x11: | 1353 case 0x11: |
1353 /* Suspended account */ | 1354 /* Suspended account */ |
1354 gc->wants_to_die = TRUE; | 1355 gc->wants_to_die = TRUE; |
1355 purple_connection_error(gc, _("Your account is currently suspended.")); | 1356 purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Your account is currently suspended.")); |
1356 break; | 1357 break; |
1357 case 0x14: | 1358 case 0x14: |
1358 /* service temporarily unavailable */ | 1359 /* service temporarily unavailable */ |
1359 purple_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); | 1360 purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); |
1360 break; | 1361 break; |
1361 case 0x18: | 1362 case 0x18: |
1362 /* screen name connecting too frequently */ | 1363 /* screen name connecting too frequently */ |
1363 gc->wants_to_die = TRUE; | 1364 gc->wants_to_die = TRUE; |
1364 purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); | 1365 purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); |
1365 break; | 1366 break; |
1366 case 0x1c: | 1367 case 0x1c: |
1367 /* client too old */ | 1368 /* client too old */ |
1368 gc->wants_to_die = TRUE; | 1369 gc->wants_to_die = TRUE; |
1369 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE); | 1370 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE); |
1370 purple_connection_error(gc, buf); | 1371 purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, buf); |
1371 break; | 1372 break; |
1372 case 0x1d: | 1373 case 0x1d: |
1373 /* IP address connecting too frequently */ | 1374 /* IP address connecting too frequently */ |
1374 gc->wants_to_die = TRUE; | 1375 gc->wants_to_die = TRUE; |
1375 purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); | 1376 purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); |
1376 break; | 1377 break; |
1377 default: | 1378 default: |
1378 purple_connection_error(gc, _("Authentication failed")); | 1379 purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Authentication failed")); |
1379 break; | 1380 break; |
1380 } | 1381 } |
1381 purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); | 1382 purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); |
1382 purple_debug_info("oscar", "Error URL: %s\n", info->errorurl); | 1383 purple_debug_info("oscar", "Error URL: %s\n", info->errorurl); |
1383 return 1; | 1384 return 1; |
1403 newconn->connect_data = purple_proxy_connect(NULL, account, host, port, | 1404 newconn->connect_data = purple_proxy_connect(NULL, account, host, port, |
1404 connection_established_cb, newconn); | 1405 connection_established_cb, newconn); |
1405 g_free(host); | 1406 g_free(host); |
1406 if (newconn->connect_data == NULL) | 1407 if (newconn->connect_data == NULL) |
1407 { | 1408 { |
1408 purple_connection_error(gc, _("Could Not Connect")); | 1409 purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Could Not Connect")); |
1409 return 0; | 1410 return 0; |
1410 } | 1411 } |
1411 | 1412 |
1412 purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); | 1413 purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
1413 ck[3] = 0x64; | 1414 ck[3] = 0x64; |
1429 { | 1430 { |
1430 PurpleConnection *gc = user_data; | 1431 PurpleConnection *gc = user_data; |
1431 | 1432 |
1432 /* Disconnect */ | 1433 /* Disconnect */ |
1433 gc->wants_to_die = TRUE; | 1434 gc->wants_to_die = TRUE; |
1434 purple_connection_error(gc, _("The SecurID key entered is invalid.")); | 1435 purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, |
1436 _("The SecurID key entered is invalid.")); | |
1435 } | 1437 } |
1436 | 1438 |
1437 static int | 1439 static int |
1438 purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) | 1440 purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) |
1439 { | 1441 { |