comparison libpurple/protocols/gg/gg.c @ 21358:ba41f2a60253

Rename: * PurpleDisconnectReason to PurpleConnectionError; * elements of that enum from PURPLE_REASON_* to PURPLE_CONNECTION_ERROR_*; * purple_connection_reason_is_fatal to purple_connection_error_is_fatal.
author Will Thompson <will.thompson@collabora.co.uk>
date Sun, 14 Oct 2007 21:08:42 +0000
parents 94062344397c
children e747ac0c42d6
comparison
equal deleted inserted replaced
21357:5a3242b676ad 21358:ba41f2a60253
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_reason (gc, PURPLE_REASON_OTHER_ERROR, 384 purple_connection_error_reason (gc,
385 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
385 _("Fill in the registration fields.")); 386 _("Fill in the registration fields."));
386 goto exit_err; 387 goto exit_err;
387 } 388 }
388 389
389 if (g_utf8_collate(p1, p2) != 0) { 390 if (g_utf8_collate(p1, p2) != 0) {
390 purple_connection_error_reason (gc, 391 purple_connection_error_reason (gc,
391 PURPLE_REASON_AUTHENTICATION_FAILED, 392 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
392 _("Passwords do not match.")); 393 _("Passwords do not match."));
393 goto exit_err; 394 goto exit_err;
394 } 395 }
395 396
396 purple_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", 397 purple_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n",
397 token->id, t); 398 token->id, t);
398 h = gg_register3(email, p1, token->id, t, 0); 399 h = gg_register3(email, p1, token->id, t, 0);
399 if (h == NULL || !(s = h->data) || !s->success) { 400 if (h == NULL || !(s = h->data) || !s->success) {
400 purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, 401 purple_connection_error_reason (gc,
402 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
401 _("Unable to register new account. Error occurred.\n")); 403 _("Unable to register new account. Error occurred.\n"));
402 goto exit_err; 404 goto exit_err;
403 } 405 }
404 406
405 uin = s->uin; 407 uin = s->uin;
1308 int i; 1310 int i;
1309 1311
1310 if (!(ev = gg_watch_fd(info->session))) { 1312 if (!(ev = gg_watch_fd(info->session))) {
1311 purple_debug_error("gg", 1313 purple_debug_error("gg",
1312 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); 1314 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n");
1313 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, 1315 purple_connection_error_reason (gc,
1316 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1314 _("Unable to read socket")); 1317 _("Unable to read socket"));
1315 return; 1318 return;
1316 } 1319 }
1317 1320
1318 switch (ev->type) { 1321 switch (ev->type) {
1462 break; 1465 break;
1463 } 1466 }
1464 1467
1465 if (!(ev = gg_watch_fd(info->session))) { 1468 if (!(ev = gg_watch_fd(info->session))) {
1466 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); 1469 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n");
1467 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, 1470 purple_connection_error_reason (gc,
1471 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1468 _("Unable to read socket")); 1472 _("Unable to read socket"));
1469 return; 1473 return;
1470 } 1474 }
1471 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); 1475 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd);
1472 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", 1476 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n",
1510 break; 1514 break;
1511 case GG_EVENT_CONN_FAILED: 1515 case GG_EVENT_CONN_FAILED:
1512 purple_input_remove(gc->inpa); 1516 purple_input_remove(gc->inpa);
1513 gc->inpa = 0; 1517 gc->inpa = 0;
1514 purple_connection_error_reason (gc, 1518 purple_connection_error_reason (gc,
1515 PURPLE_REASON_NETWORK_ERROR, 1519 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1516 _("Connection failed.")); 1520 _("Connection failed."));
1517 break; 1521 break;
1518 default: 1522 default:
1519 purple_debug_error("gg", "strange event: %d\n", ev->type); 1523 purple_debug_error("gg", "strange event: %d\n", ev->type);
1520 break; 1524 break;
1717 glp->status = GG_STATUS_AVAIL; 1721 glp->status = GG_STATUS_AVAIL;
1718 glp->tls = 0; 1722 glp->tls = 0;
1719 1723
1720 info->session = gg_login(glp); 1724 info->session = gg_login(glp);
1721 if (info->session == NULL) { 1725 if (info->session == NULL) {
1722 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, 1726 purple_connection_error_reason (gc,
1727 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1723 _("Connection failed.")); 1728 _("Connection failed."));
1724 g_free(glp); 1729 g_free(glp);
1725 return; 1730 return;
1726 } 1731 }
1727 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, 1732 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ,
2001 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ 2006 /* purple_debug_info("gg", "Keeping connection alive....\n"); */
2002 2007
2003 if (gg_ping(info->session) < 0) { 2008 if (gg_ping(info->session) < 0) {
2004 purple_debug_info("gg", "Not connected to the server " 2009 purple_debug_info("gg", "Not connected to the server "
2005 "or gg_session is not correct\n"); 2010 "or gg_session is not correct\n");
2006 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, 2011 purple_connection_error_reason (gc,
2012 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2007 _("Not connected to the server.")); 2013 _("Not connected to the server."));
2008 } 2014 }
2009 } 2015 }
2010 /* }}} */ 2016 /* }}} */
2011 2017