comparison libpurple/protocols/myspace/myspace.c @ 31872: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 79ae7200a11a
children 750ab90748a5 3828a61c44da
comparison
equal deleted inserted replaced
31871:5105d0306b2a 31872:a5b556ac1de5
696 " bytes, decoded\n", nc_len); 696 " bytes, decoded\n", nc_len);
697 697
698 if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) { 698 if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) {
699 purple_debug_info("msim", "bad nc length: %" G_GSIZE_MODIFIER 699 purple_debug_info("msim", "bad nc length: %" G_GSIZE_MODIFIER
700 "x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH); 700 "x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH);
701 purple_connection_error_reason (session->gc, 701 purple_connection_error (session->gc,
702 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 702 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
703 _("Unexpected challenge length from server")); 703 _("Unexpected challenge length from server"));
704 return FALSE; 704 return FALSE;
705 } 705 }
706 706
833 /* purple_debug_info("msim", "msim_check_alive: delta=%d\n", delta); */ 833 /* purple_debug_info("msim", "msim_check_alive: delta=%d\n", delta); */
834 if (delta >= MSIM_KEEPALIVE_INTERVAL) { 834 if (delta >= MSIM_KEEPALIVE_INTERVAL) {
835 purple_debug_info("msim", 835 purple_debug_info("msim",
836 "msim_check_alive: %zu > interval of %d, presumed dead\n", 836 "msim_check_alive: %zu > interval of %d, presumed dead\n",
837 delta, MSIM_KEEPALIVE_INTERVAL); 837 delta, MSIM_KEEPALIVE_INTERVAL);
838 purple_connection_error_reason(session->gc, 838 purple_connection_error(session->gc,
839 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 839 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
840 _("Lost connection with server")); 840 _("Lost connection with server"));
841 841
842 return FALSE; 842 return FALSE;
843 } 843 }
1864 reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; 1864 reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE;
1865 if (!purple_account_get_remember_password(session->account)) 1865 if (!purple_account_get_remember_password(session->account))
1866 purple_account_set_password(session->account, NULL); 1866 purple_account_set_password(session->account, NULL);
1867 break; 1867 break;
1868 } 1868 }
1869 purple_connection_error_reason(session->gc, reason, full_errmsg); 1869 purple_connection_error(session->gc, reason, full_errmsg);
1870 } else { 1870 } else {
1871 purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL); 1871 purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL);
1872 } 1872 }
1873 1873
1874 g_free(full_errmsg); 1874 g_free(full_errmsg);
2025 session = gc->proto_data; 2025 session = gc->proto_data;
2026 2026
2027 /* libpurple/eventloop.h only defines these two */ 2027 /* libpurple/eventloop.h only defines these two */
2028 if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { 2028 if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) {
2029 purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond); 2029 purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond);
2030 purple_connection_error_reason (gc, 2030 purple_connection_error (gc,
2031 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2031 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2032 _("Invalid input condition")); 2032 _("Invalid input condition"));
2033 return; 2033 return;
2034 } 2034 }
2035 2035
2067 /* No worries */ 2067 /* No worries */
2068 return; 2068 return;
2069 2069
2070 tmp = g_strdup_printf(_("Lost connection with server: %s"), 2070 tmp = g_strdup_printf(_("Lost connection with server: %s"),
2071 g_strerror(errno)); 2071 g_strerror(errno));
2072 purple_connection_error_reason(gc, 2072 purple_connection_error(gc,
2073 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); 2073 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
2074 g_free(tmp); 2074 g_free(tmp);
2075 return; 2075 return;
2076 } else if (n == 0) { 2076 } else if (n == 0) {
2077 purple_connection_error_reason(gc, 2077 purple_connection_error(gc,
2078 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2078 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2079 _("Server closed the connection")); 2079 _("Server closed the connection"));
2080 return; 2080 return;
2081 } 2081 }
2082 2082
2090 if (strlen(session->rxbuf + session->rxoff) != n) { 2090 if (strlen(session->rxbuf + session->rxoff) != n) {
2091 /* Occurs after login, but it is not a null byte. */ 2091 /* Occurs after login, but it is not a null byte. */
2092 purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" 2092 purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes"
2093 "--null byte encountered?\n", 2093 "--null byte encountered?\n",
2094 strlen(session->rxbuf + session->rxoff), n); 2094 strlen(session->rxbuf + session->rxoff), n);
2095 /*purple_connection_error_reason (gc, 2095 /*purple_connection_error (gc,
2096 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2096 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2097 "Invalid message - null byte on input"); */ 2097 "Invalid message - null byte on input"); */
2098 return; 2098 return;
2099 } 2099 }
2100 #endif 2100 #endif
2115 #endif 2115 #endif
2116 *end = 0; 2116 *end = 0;
2117 msg = msim_parse(session->rxbuf); 2117 msg = msim_parse(session->rxbuf);
2118 if (!msg) { 2118 if (!msg) {
2119 purple_debug_info("msim", "msim_input_cb: couldn't parse rxbuf\n"); 2119 purple_debug_info("msim", "msim_input_cb: couldn't parse rxbuf\n");
2120 purple_connection_error_reason (gc, 2120 purple_connection_error (gc,
2121 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2121 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2122 _("Unable to parse message")); 2122 _("Unable to parse message"));
2123 break; 2123 break;
2124 } else { 2124 } else {
2125 /* Process message and then free it (processing function should 2125 /* Process message and then free it (processing function should
2160 session = (MsimSession *)gc->proto_data; 2160 session = (MsimSession *)gc->proto_data;
2161 2161
2162 if (source < 0) { 2162 if (source < 0) {
2163 gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), 2163 gchar *tmp = g_strdup_printf(_("Unable to connect: %s"),
2164 error_message); 2164 error_message);
2165 purple_connection_error_reason (gc, 2165 purple_connection_error (gc,
2166 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); 2166 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
2167 g_free(tmp); 2167 g_free(tmp);
2168 return; 2168 return;
2169 } 2169 }
2170 2170
2217 2217
2218 /* Calls msim_connect_cb when connected. */ 2218 /* Calls msim_connect_cb when connected. */
2219 if (!purple_proxy_connect(gc, acct, host, port, msim_connect_cb, gc)) { 2219 if (!purple_proxy_connect(gc, acct, host, port, msim_connect_cb, gc)) {
2220 /* TODO: try other ports if in auto mode, then save 2220 /* TODO: try other ports if in auto mode, then save
2221 * working port and try that first next time. */ 2221 * working port and try that first next time. */
2222 purple_connection_error_reason (gc, 2222 purple_connection_error (gc,
2223 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 2223 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2224 _("Unable to connect")); 2224 _("Unable to connect"));
2225 return; 2225 return;
2226 } 2226 }
2227 } 2227 }