Mercurial > pidgin.yaz
comparison libpurple/protocols/gg/gg.c @ 27454:7fd1b4c73310
Connection error message changes for gg, and a few other strings changes.
* Short connection error messages (phrases and short sentences) should not
end in a period. This is kind of arbitrary, but I did comparisons both
ways and I thought short messages looked a lot better without the period.
Less cluttered, more approachable.
* Connection error messages should not have trailing newlines--the UI
should add a newline if it wants.
* Change "token" to "captcha" in the input box prompts when creating a
new account. Captcha is an increasingly common term for this. Not
all users will know what it means, but "token" is not a whole lot better.
And users should be able to figure out what to do using context clues,
regardless of the term used. I believe we use the same term in QQ.
* Put the output of g_strerror(errno) in the message when possible
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Jul 2009 05:27:08 +0000 |
parents | 959e86c022f7 |
children | ac299d029823 |
comparison
equal
deleted
inserted
replaced
27453:96cafa3d271c | 27454:7fd1b4c73310 |
---|---|
350 | 350 |
351 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || | 351 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || |
352 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | 352 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { |
353 purple_connection_error_reason (gc, | 353 purple_connection_error_reason (gc, |
354 PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 354 PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
355 _("Fill in the registration fields.")); | 355 _("You must fill in all registration fields")); |
356 goto exit_err; | 356 goto exit_err; |
357 } | 357 } |
358 | 358 |
359 if (g_utf8_collate(p1, p2) != 0) { | 359 if (g_utf8_collate(p1, p2) != 0) { |
360 purple_connection_error_reason (gc, | 360 purple_connection_error_reason (gc, |
361 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, | 361 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, |
362 _("Passwords do not match.")); | 362 _("Passwords do not match")); |
363 goto exit_err; | 363 goto exit_err; |
364 } | 364 } |
365 | 365 |
366 purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n", | 366 purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n", |
367 token->id, t); | 367 token->id, t); |
368 h = gg_register3(email, p1, token->id, t, 0); | 368 h = gg_register3(email, p1, token->id, t, 0); |
369 if (h == NULL || !(s = h->data) || !s->success) { | 369 if (h == NULL || !(s = h->data) || !s->success) { |
370 purple_connection_error_reason (gc, | 370 purple_connection_error_reason (gc, |
371 PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 371 PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
372 _("Unable to register new account. Error occurred.\n")); | 372 _("Unable to register new account. An unknown error occurred.")); |
373 goto exit_err; | 373 goto exit_err; |
374 } | 374 } |
375 | 375 |
376 uin = s->uin; | 376 uin = s->uin; |
377 purple_debug_info("gg", "registered uin: %d\n", uin); | 377 purple_debug_info("gg", "registered uin: %d\n", uin); |
448 _("Password"), "", FALSE); | 448 _("Password"), "", FALSE); |
449 purple_request_field_string_set_masked(field, TRUE); | 449 purple_request_field_string_set_masked(field, TRUE); |
450 purple_request_field_group_add_field(group, field); | 450 purple_request_field_group_add_field(group, field); |
451 | 451 |
452 field = purple_request_field_string_new("password2", | 452 field = purple_request_field_string_new("password2", |
453 _("Password (retype)"), "", FALSE); | 453 _("Password (again)"), "", FALSE); |
454 purple_request_field_string_set_masked(field, TRUE); | 454 purple_request_field_string_set_masked(field, TRUE); |
455 purple_request_field_group_add_field(group, field); | 455 purple_request_field_group_add_field(group, field); |
456 | 456 |
457 field = purple_request_field_string_new("token", | 457 field = purple_request_field_string_new("token", |
458 _("Enter current token"), "", FALSE); | 458 _("Enter captcha text"), "", FALSE); |
459 purple_request_field_string_set_masked(field, FALSE); | 459 purple_request_field_string_set_masked(field, FALSE); |
460 purple_request_field_group_add_field(group, field); | 460 purple_request_field_group_add_field(group, field); |
461 | 461 |
462 /* original size: 60x24 */ | 462 /* original size: 60x24 */ |
463 field = purple_request_field_image_new("token_img", | 463 field = purple_request_field_image_new("token_img", |
464 _("Current token"), token->data, token->size); | 464 _("Captcha"), token->data, token->size); |
465 purple_request_field_group_add_field(group, field); | 465 purple_request_field_group_add_field(group, field); |
466 | 466 |
467 purple_request_fields(account, | 467 purple_request_fields(account, |
468 _("Register New Gadu-Gadu Account"), | 468 _("Register New Gadu-Gadu Account"), |
469 _("Register New Gadu-Gadu Account"), | 469 _("Register New Gadu-Gadu Account"), |
1528 if (!(ev = gg_watch_fd(info->session))) { | 1528 if (!(ev = gg_watch_fd(info->session))) { |
1529 purple_debug_error("gg", | 1529 purple_debug_error("gg", |
1530 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); | 1530 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
1531 purple_connection_error_reason (gc, | 1531 purple_connection_error_reason (gc, |
1532 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1532 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1533 _("Unable to read socket")); | 1533 _("Unable to read from socket")); |
1534 return; | 1534 return; |
1535 } | 1535 } |
1536 gc->last_received = time(NULL); | 1536 gc->last_received = time(NULL); |
1537 switch (ev->type) { | 1537 switch (ev->type) { |
1538 case GG_EVENT_NONE: | 1538 case GG_EVENT_NONE: |
1686 | 1686 |
1687 if (!(ev = gg_watch_fd(info->session))) { | 1687 if (!(ev = gg_watch_fd(info->session))) { |
1688 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); | 1688 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
1689 purple_connection_error_reason (gc, | 1689 purple_connection_error_reason (gc, |
1690 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1690 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1691 _("Unable to read socket")); | 1691 _("Unable to read from socket")); |
1692 return; | 1692 return; |
1693 } | 1693 } |
1694 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); | 1694 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
1695 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", | 1695 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
1696 info->session->check, info->session->state); | 1696 info->session->check, info->session->state); |
1723 case GG_EVENT_CONN_FAILED: | 1723 case GG_EVENT_CONN_FAILED: |
1724 purple_input_remove(gc->inpa); | 1724 purple_input_remove(gc->inpa); |
1725 gc->inpa = 0; | 1725 gc->inpa = 0; |
1726 purple_connection_error_reason (gc, | 1726 purple_connection_error_reason (gc, |
1727 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1727 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1728 _("Connection failed.")); | 1728 _("Connection failed")); |
1729 break; | 1729 break; |
1730 default: | 1730 default: |
1731 purple_debug_error("gg", "strange event: %d\n", ev->type); | 1731 purple_debug_error("gg", "strange event: %d\n", ev->type); |
1732 break; | 1732 break; |
1733 } | 1733 } |
1933 glp->status = ggp_to_gg_status(status, &glp->status_descr); | 1933 glp->status = ggp_to_gg_status(status, &glp->status_descr); |
1934 glp->tls = 0; | 1934 glp->tls = 0; |
1935 | 1935 |
1936 address = purple_account_get_string(account, "gg_server", ""); | 1936 address = purple_account_get_string(account, "gg_server", ""); |
1937 if (address && *address) { | 1937 if (address && *address) { |
1938 /* TODO: Make this non-blocking */ | |
1938 struct in_addr *addr = gg_gethostbyname(address); | 1939 struct in_addr *addr = gg_gethostbyname(address); |
1939 | 1940 |
1940 purple_debug_info("gg", "Using gg server given by user (%s)\n", address); | 1941 purple_debug_info("gg", "Using gg server given by user (%s)\n", address); |
1941 | 1942 |
1942 if (addr == NULL) { | 1943 if (addr == NULL) { |
1943 purple_debug_error("gg", "gg_gethostbyname returned error (%d): %s\n", | 1944 gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"), |
1944 errno, g_strerror(errno)); | 1945 address, g_strerror(errno)); |
1945 purple_connection_error_reason(gc, | 1946 purple_connection_error_reason(gc, |
1946 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */ | 1947 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */ |
1947 _("Unable to resolve server")); | 1948 tmp); |
1949 g_free(tmp); | |
1948 return; | 1950 return; |
1949 } | 1951 } |
1950 | 1952 |
1951 glp->server_addr = inet_addr(inet_ntoa(*addr)); | 1953 glp->server_addr = inet_addr(inet_ntoa(*addr)); |
1952 glp->server_port = 8074; | 1954 glp->server_port = 8074; |
1955 | 1957 |
1956 info->session = gg_login(glp); | 1958 info->session = gg_login(glp); |
1957 if (info->session == NULL) { | 1959 if (info->session == NULL) { |
1958 purple_connection_error_reason (gc, | 1960 purple_connection_error_reason (gc, |
1959 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 1961 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1960 _("Connection failed.")); | 1962 _("Connection failed")); |
1961 g_free(glp); | 1963 g_free(glp); |
1962 return; | 1964 return; |
1963 } | 1965 } |
1964 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, | 1966 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
1965 ggp_async_login_handler, gc); | 1967 ggp_async_login_handler, gc); |
2330 if (gg_ping(info->session) < 0) { | 2332 if (gg_ping(info->session) < 0) { |
2331 purple_debug_info("gg", "Not connected to the server " | 2333 purple_debug_info("gg", "Not connected to the server " |
2332 "or gg_session is not correct\n"); | 2334 "or gg_session is not correct\n"); |
2333 purple_connection_error_reason (gc, | 2335 purple_connection_error_reason (gc, |
2334 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 2336 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
2335 _("Not connected to the server.")); | 2337 _("Not connected to the server")); |
2336 } | 2338 } |
2337 } | 2339 } |
2338 | 2340 |
2339 static void ggp_register_user(PurpleAccount *account) | 2341 static void ggp_register_user(PurpleAccount *account) |
2340 { | 2342 { |