comparison libpurple/protocols/gg/gg.c @ 32330:a5b556ac1de5

Rename purple_connection_error_reason to purple_connection_error
author Mark Doliner <mark@kingant.net>
date Sun, 21 Aug 2011 08:00:53 +0000
parents 7df08e88d9bb
children 3322201b446f
comparison
equal deleted inserted replaced
32329:5105d0306b2a 32330:a5b556ac1de5
352 352
353 account = purple_connection_get_account(gc); 353 account = purple_connection_get_account(gc);
354 354
355 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || 355 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL ||
356 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { 356 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') {
357 purple_connection_error_reason (gc, 357 purple_connection_error (gc,
358 PURPLE_CONNECTION_ERROR_OTHER_ERROR, 358 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
359 _("You must fill in all registration fields")); 359 _("You must fill in all registration fields"));
360 goto exit_err; 360 goto exit_err;
361 } 361 }
362 362
363 if (g_utf8_collate(p1, p2) != 0) { 363 if (g_utf8_collate(p1, p2) != 0) {
364 purple_connection_error_reason (gc, 364 purple_connection_error (gc,
365 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, 365 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
366 _("Passwords do not match")); 366 _("Passwords do not match"));
367 goto exit_err; 367 goto exit_err;
368 } 368 }
369 369
370 purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n", 370 purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n",
371 token->id, t); 371 token->id, t);
372 h = gg_register3(email, p1, token->id, t, 0); 372 h = gg_register3(email, p1, token->id, t, 0);
373 if (h == NULL || !(s = h->data) || !s->success) { 373 if (h == NULL || !(s = h->data) || !s->success) {
374 purple_connection_error_reason (gc, 374 purple_connection_error (gc,
375 PURPLE_CONNECTION_ERROR_OTHER_ERROR, 375 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
376 _("Unable to register new account. An unknown error occurred.")); 376 _("Unable to register new account. An unknown error occurred."));
377 goto exit_err; 377 goto exit_err;
378 } 378 }
379 379
1712 int i; 1712 int i;
1713 1713
1714 if (!(ev = gg_watch_fd(info->session))) { 1714 if (!(ev = gg_watch_fd(info->session))) {
1715 purple_debug_error("gg", 1715 purple_debug_error("gg",
1716 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); 1716 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n");
1717 purple_connection_error_reason (gc, 1717 purple_connection_error (gc,
1718 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1718 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1719 _("Unable to read from socket")); 1719 _("Unable to read from socket"));
1720 return; 1720 return;
1721 } 1721 }
1722 1722
1878 break; 1878 break;
1879 } 1879 }
1880 1880
1881 if (!(ev = gg_watch_fd(info->session))) { 1881 if (!(ev = gg_watch_fd(info->session))) {
1882 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); 1882 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n");
1883 purple_connection_error_reason (gc, 1883 purple_connection_error (gc,
1884 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1884 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1885 _("Unable to read from socket")); 1885 _("Unable to read from socket"));
1886 return; 1886 return;
1887 } 1887 }
1888 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); 1888 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd);
1917 } 1917 }
1918 break; 1918 break;
1919 case GG_EVENT_CONN_FAILED: 1919 case GG_EVENT_CONN_FAILED:
1920 purple_input_remove(gc->inpa); 1920 purple_input_remove(gc->inpa);
1921 gc->inpa = 0; 1921 gc->inpa = 0;
1922 purple_connection_error_reason (gc, 1922 purple_connection_error (gc,
1923 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1923 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1924 _("Connection failed")); 1924 _("Connection failed"));
1925 break; 1925 break;
1926 case GG_EVENT_MSG: 1926 case GG_EVENT_MSG:
1927 if (ev->event.msg.sender == 0) 1927 if (ev->event.msg.sender == 0)
2155 purple_debug_info("gg", "Using gg server given by user (%s)\n", address); 2155 purple_debug_info("gg", "Using gg server given by user (%s)\n", address);
2156 2156
2157 if (addr == NULL) { 2157 if (addr == NULL) {
2158 gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"), 2158 gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"),
2159 address, g_strerror(errno)); 2159 address, g_strerror(errno));
2160 purple_connection_error_reason(gc, 2160 purple_connection_error(gc,
2161 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */ 2161 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */
2162 tmp); 2162 tmp);
2163 g_free(tmp); 2163 g_free(tmp);
2164 return; 2164 return;
2165 } 2165 }
2170 purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n"); 2170 purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n");
2171 2171
2172 info->session = gg_login(glp); 2172 info->session = gg_login(glp);
2173 purple_connection_update_progress(gc, _("Connecting"), 0, 2); 2173 purple_connection_update_progress(gc, _("Connecting"), 0, 2);
2174 if (info->session == NULL) { 2174 if (info->session == NULL) {
2175 purple_connection_error_reason (gc, 2175 purple_connection_error (gc,
2176 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2176 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2177 _("Connection failed")); 2177 _("Connection failed"));
2178 g_free(glp); 2178 g_free(glp);
2179 return; 2179 return;
2180 } 2180 }
2580 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ 2580 /* purple_debug_info("gg", "Keeping connection alive....\n"); */
2581 2581
2582 if (gg_ping(info->session) < 0) { 2582 if (gg_ping(info->session) < 0) {
2583 purple_debug_info("gg", "Not connected to the server " 2583 purple_debug_info("gg", "Not connected to the server "
2584 "or gg_session is not correct\n"); 2584 "or gg_session is not correct\n");
2585 purple_connection_error_reason (gc, 2585 purple_connection_error (gc,
2586 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2586 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2587 _("Not connected to the server")); 2587 _("Not connected to the server"));
2588 } 2588 }
2589 } 2589 }
2590 2590