Mercurial > pidgin.yaz
comparison libpurple/protocols/gg/gg.c @ 21421:be50064a83e0
propagate from branch 'im.pidgin.pidgin' (head 0f99eebc17d3efab8dac3d72feb857ab25b06cb7)
to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 5536c47fe349c077e16ffe50897bd3757b5df106)
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Sun, 11 Nov 2007 17:01:59 +0000 |
parents | 48c6c89a8158 1ce05db42eb3 |
children | 665e04562de0 |
comparison
equal
deleted
inserted
replaced
21327:48c6c89a8158 | 21421:be50064a83e0 |
---|---|
375 | 375 |
376 account = purple_connection_get_account(gc); | 376 account = purple_connection_get_account(gc); |
377 | 377 |
378 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || | 378 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || |
379 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | 379 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { |
380 purple_connection_error(gc, _("Fill in the registration fields.")); | 380 purple_connection_error_reason (gc, |
381 PURPLE_CONNECTION_ERROR_OTHER_ERROR, | |
382 _("Fill in the registration fields.")); | |
381 goto exit_err; | 383 goto exit_err; |
382 } | 384 } |
383 | 385 |
384 if (g_utf8_collate(p1, p2) != 0) { | 386 if (g_utf8_collate(p1, p2) != 0) { |
385 purple_connection_error(gc, _("Passwords do not match.")); | 387 purple_connection_error_reason (gc, |
388 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, | |
389 _("Passwords do not match.")); | |
386 goto exit_err; | 390 goto exit_err; |
387 } | 391 } |
388 | 392 |
389 purple_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", | 393 purple_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", |
390 token->id, t); | 394 token->id, t); |
391 h = gg_register3(email, p1, token->id, t, 0); | 395 h = gg_register3(email, p1, token->id, t, 0); |
392 if (h == NULL || !(s = h->data) || !s->success) { | 396 if (h == NULL || !(s = h->data) || !s->success) { |
393 purple_connection_error(gc, | 397 purple_connection_error_reason (gc, |
398 PURPLE_CONNECTION_ERROR_OTHER_ERROR, | |
394 _("Unable to register new account. Error occurred.\n")); | 399 _("Unable to register new account. Error occurred.\n")); |
395 goto exit_err; | 400 goto exit_err; |
396 } | 401 } |
397 | 402 |
398 uin = s->uin; | 403 uin = s->uin; |
1302 int i; | 1307 int i; |
1303 | 1308 |
1304 if (!(ev = gg_watch_fd(info->session))) { | 1309 if (!(ev = gg_watch_fd(info->session))) { |
1305 purple_debug_error("gg", | 1310 purple_debug_error("gg", |
1306 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); | 1311 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
1307 purple_connection_error(gc, _("Unable to read socket")); | 1312 purple_connection_error_reason (gc, |
1313 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
1314 _("Unable to read socket")); | |
1308 return; | 1315 return; |
1309 } | 1316 } |
1310 | 1317 |
1311 switch (ev->type) { | 1318 switch (ev->type) { |
1312 case GG_EVENT_NONE: | 1319 case GG_EVENT_NONE: |
1455 break; | 1462 break; |
1456 } | 1463 } |
1457 | 1464 |
1458 if (!(ev = gg_watch_fd(info->session))) { | 1465 if (!(ev = gg_watch_fd(info->session))) { |
1459 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); | 1466 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
1460 purple_connection_error(gc, _("Unable to read socket")); | 1467 purple_connection_error_reason (gc, |
1468 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
1469 _("Unable to read socket")); | |
1461 return; | 1470 return; |
1462 } | 1471 } |
1463 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); | 1472 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
1464 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", | 1473 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
1465 info->session->check, info->session->state); | 1474 info->session->check, info->session->state); |
1501 } | 1510 } |
1502 break; | 1511 break; |
1503 case GG_EVENT_CONN_FAILED: | 1512 case GG_EVENT_CONN_FAILED: |
1504 purple_input_remove(gc->inpa); | 1513 purple_input_remove(gc->inpa); |
1505 gc->inpa = 0; | 1514 gc->inpa = 0; |
1506 purple_connection_error(gc, _("Connection failed.")); | 1515 purple_connection_error_reason (gc, |
1516 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
1517 _("Connection failed.")); | |
1507 break; | 1518 break; |
1508 default: | 1519 default: |
1509 purple_debug_error("gg", "strange event: %d\n", ev->type); | 1520 purple_debug_error("gg", "strange event: %d\n", ev->type); |
1510 break; | 1521 break; |
1511 } | 1522 } |
1707 glp->status = GG_STATUS_AVAIL; | 1718 glp->status = GG_STATUS_AVAIL; |
1708 glp->tls = 0; | 1719 glp->tls = 0; |
1709 | 1720 |
1710 info->session = gg_login(glp); | 1721 info->session = gg_login(glp); |
1711 if (info->session == NULL) { | 1722 if (info->session == NULL) { |
1712 purple_connection_error(gc, _("Connection failed.")); | 1723 purple_connection_error_reason (gc, |
1724 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
1725 _("Connection failed.")); | |
1713 g_free(glp); | 1726 g_free(glp); |
1714 return; | 1727 return; |
1715 } | 1728 } |
1716 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, | 1729 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
1717 ggp_async_login_handler, gc); | 1730 ggp_async_login_handler, gc); |
1999 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ | 2012 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ |
2000 | 2013 |
2001 if (gg_ping(info->session) < 0) { | 2014 if (gg_ping(info->session) < 0) { |
2002 purple_debug_info("gg", "Not connected to the server " | 2015 purple_debug_info("gg", "Not connected to the server " |
2003 "or gg_session is not correct\n"); | 2016 "or gg_session is not correct\n"); |
2004 purple_connection_error(gc, _("Not connected to the server.")); | 2017 purple_connection_error_reason (gc, |
2018 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
2019 _("Not connected to the server.")); | |
2005 } | 2020 } |
2006 } | 2021 } |
2007 /* }}} */ | 2022 /* }}} */ |
2008 | 2023 |
2009 /* static void ggp_register_user(PurpleAccount *account) {{{ */ | 2024 /* static void ggp_register_user(PurpleAccount *account) {{{ */ |