| 379 |
379 |
| 380 account = purple_connection_get_account(gc); |
380 account = purple_connection_get_account(gc); |
| 381 |
381 |
| 382 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || |
382 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || |
| 383 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { |
383 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { |
| 384 purple_connection_error(gc, _("Fill in the registration fields.")); |
384 purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, |
| |
385 _("Fill in the registration fields.")); |
| 385 goto exit_err; |
386 goto exit_err; |
| 386 } |
387 } |
| 387 |
388 |
| 388 if (g_utf8_collate(p1, p2) != 0) { |
389 if (g_utf8_collate(p1, p2) != 0) { |
| 389 purple_connection_error(gc, _("Passwords do not match.")); |
390 purple_connection_error_reason (gc, |
| |
391 PURPLE_REASON_AUTHENTICATION_FAILED, |
| |
392 _("Passwords do not match.")); |
| 390 goto exit_err; |
393 goto exit_err; |
| 391 } |
394 } |
| 392 |
395 |
| 393 purple_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", |
396 purple_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", |
| 394 token->id, t); |
397 token->id, t); |
| 395 h = gg_register3(email, p1, token->id, t, 0); |
398 h = gg_register3(email, p1, token->id, t, 0); |
| 396 if (h == NULL || !(s = h->data) || !s->success) { |
399 if (h == NULL || !(s = h->data) || !s->success) { |
| 397 purple_connection_error(gc, |
400 purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, |
| 398 _("Unable to register new account. Error occurred.\n")); |
401 _("Unable to register new account. Error occurred.\n")); |
| 399 goto exit_err; |
402 goto exit_err; |
| 400 } |
403 } |
| 401 |
404 |
| 402 uin = s->uin; |
405 uin = s->uin; |
| 1305 int i; |
1308 int i; |
| 1306 |
1309 |
| 1307 if (!(ev = gg_watch_fd(info->session))) { |
1310 if (!(ev = gg_watch_fd(info->session))) { |
| 1308 purple_debug_error("gg", |
1311 purple_debug_error("gg", |
| 1309 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
1312 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
| 1310 purple_connection_error(gc, _("Unable to read socket")); |
1313 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, |
| |
1314 _("Unable to read socket")); |
| 1311 return; |
1315 return; |
| 1312 } |
1316 } |
| 1313 |
1317 |
| 1314 switch (ev->type) { |
1318 switch (ev->type) { |
| 1315 case GG_EVENT_NONE: |
1319 case GG_EVENT_NONE: |
| 1458 break; |
1462 break; |
| 1459 } |
1463 } |
| 1460 |
1464 |
| 1461 if (!(ev = gg_watch_fd(info->session))) { |
1465 if (!(ev = gg_watch_fd(info->session))) { |
| 1462 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
1466 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
| 1463 purple_connection_error(gc, _("Unable to read socket")); |
1467 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, |
| |
1468 _("Unable to read socket")); |
| 1464 return; |
1469 return; |
| 1465 } |
1470 } |
| 1466 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
1471 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
| 1467 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
1472 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
| 1468 info->session->check, info->session->state); |
1473 info->session->check, info->session->state); |
| 1504 } |
1509 } |
| 1505 break; |
1510 break; |
| 1506 case GG_EVENT_CONN_FAILED: |
1511 case GG_EVENT_CONN_FAILED: |
| 1507 purple_input_remove(gc->inpa); |
1512 purple_input_remove(gc->inpa); |
| 1508 gc->inpa = 0; |
1513 gc->inpa = 0; |
| 1509 purple_connection_error(gc, _("Connection failed.")); |
1514 purple_connection_error_reason (gc, |
| |
1515 PURPLE_REASON_NETWORK_ERROR, |
| |
1516 _("Connection failed.")); |
| 1510 break; |
1517 break; |
| 1511 default: |
1518 default: |
| 1512 purple_debug_error("gg", "strange event: %d\n", ev->type); |
1519 purple_debug_error("gg", "strange event: %d\n", ev->type); |
| 1513 break; |
1520 break; |
| 1514 } |
1521 } |
| 1710 glp->status = GG_STATUS_AVAIL; |
1717 glp->status = GG_STATUS_AVAIL; |
| 1711 glp->tls = 0; |
1718 glp->tls = 0; |
| 1712 |
1719 |
| 1713 info->session = gg_login(glp); |
1720 info->session = gg_login(glp); |
| 1714 if (info->session == NULL) { |
1721 if (info->session == NULL) { |
| 1715 purple_connection_error(gc, _("Connection failed.")); |
1722 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, |
| |
1723 _("Connection failed.")); |
| 1716 g_free(glp); |
1724 g_free(glp); |
| 1717 return; |
1725 return; |
| 1718 } |
1726 } |
| 1719 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
1727 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
| 1720 ggp_async_login_handler, gc); |
1728 ggp_async_login_handler, gc); |
| 1993 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ |
2001 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ |
| 1994 |
2002 |
| 1995 if (gg_ping(info->session) < 0) { |
2003 if (gg_ping(info->session) < 0) { |
| 1996 purple_debug_info("gg", "Not connected to the server " |
2004 purple_debug_info("gg", "Not connected to the server " |
| 1997 "or gg_session is not correct\n"); |
2005 "or gg_session is not correct\n"); |
| 1998 purple_connection_error(gc, _("Not connected to the server.")); |
2006 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, |
| |
2007 _("Not connected to the server.")); |
| 1999 } |
2008 } |
| 2000 } |
2009 } |
| 2001 /* }}} */ |
2010 /* }}} */ |
| 2002 |
2011 |
| 2003 /* static void ggp_register_user(PurpleAccount *account) {{{ */ |
2012 /* static void ggp_register_user(PurpleAccount *account) {{{ */ |