comparison libpurple/protocols/gg/gg.c @ 32735:309b2362c7d8

Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
author tomkiewicz@cpw.pidgin.im
date Sat, 08 Oct 2011 22:53:35 +0000
parents b01a41253fb6
children 1aebe64a412b
comparison
equal deleted inserted replaced
32734:b01a41253fb6 32735:309b2362c7d8
1930 } 1930 }
1931 break; 1931 break;
1932 case GG_EVENT_CONN_FAILED: 1932 case GG_EVENT_CONN_FAILED:
1933 purple_input_remove(gc->inpa); 1933 purple_input_remove(gc->inpa);
1934 gc->inpa = 0; 1934 gc->inpa = 0;
1935 purple_connection_error (gc, 1935 purple_debug_info("gg", "Connection failure: %d\n",
1936 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1936 ev->event.failure);
1937 _("Connection failed")); 1937 switch (ev->event.failure) {
1938 case GG_FAILURE_RESOLVING:
1939 purple_connection_error(gc,
1940 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1941 _("Unable to resolve "
1942 "hostname"));
1943 break;
1944 case GG_FAILURE_PASSWORD:
1945 purple_connection_error(gc,
1946 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
1947 _("Incorrect password"));
1948 break;
1949 case GG_FAILURE_TLS:
1950 purple_connection_error(gc,
1951 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
1952 _("SSL Connection Failed"));
1953 break;
1954 case GG_FAILURE_INTRUDER:
1955 purple_connection_error(gc,
1956 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
1957 _("Your account has been "
1958 "disabled because too many "
1959 "incorrect passwords were "
1960 "entered"));
1961 break;
1962 case GG_FAILURE_UNAVAILABLE:
1963 purple_connection_error(gc,
1964 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1965 _("Service temporarily "
1966 "unavailable"));
1967 break;
1968 case GG_FAILURE_PROXY:
1969 purple_connection_error(gc,
1970 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1971 _("Error connecting to proxy "
1972 "server"));
1973 break;
1974 case GG_FAILURE_HUB:
1975 purple_connection_error(gc,
1976 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1977 _("Error connecting to master "
1978 "server"));
1979 break;
1980 default:
1981 purple_connection_error(gc,
1982 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1983 _("Connection failed"));
1984 }
1938 break; 1985 break;
1939 case GG_EVENT_MSG: 1986 case GG_EVENT_MSG:
1940 if (ev->event.msg.sender == 0) 1987 if (ev->event.msg.sender == 0)
1941 /* system messages are mostly ads */ 1988 /* system messages are mostly ads */
1942 purple_debug_info("gg", "System message:\n%s\n", 1989 purple_debug_info("gg", "System message:\n%s\n",
2135 2182
2136 purple_connection_set_protocol_data(gc, info); 2183 purple_connection_set_protocol_data(gc, info);
2137 2184
2138 glp->uin = ggp_get_uin(account); 2185 glp->uin = ggp_get_uin(account);
2139 glp->password = (char *)purple_account_get_password(account); 2186 glp->password = (char *)purple_account_get_password(account);
2187
2188 if (glp->uin == 0) {
2189 purple_connection_error(gc,
2190 PURPLE_CONNECTION_ERROR_INVALID_USERNAME,
2191 _("The username specified is invalid."));
2192 g_free(glp);
2193 return;
2194 }
2195
2140 glp->image_size = 255; 2196 glp->image_size = 255;
2141 2197
2142 presence = purple_account_get_presence(account); 2198 presence = purple_account_get_presence(account);
2143 status = purple_presence_get_active_status(presence); 2199 status = purple_presence_get_active_status(presence);
2144 2200
2153 "opportunistic_tls"); 2209 "opportunistic_tls");
2154 purple_debug_info("gg", "Requested encryption type: %s\n", 2210 purple_debug_info("gg", "Requested encryption type: %s\n",
2155 encryption_type); 2211 encryption_type);
2156 if (strcmp(encryption_type, "opportunistic_tls") == 0) 2212 if (strcmp(encryption_type, "opportunistic_tls") == 0)
2157 glp->tls = GG_SSL_ENABLED; 2213 glp->tls = GG_SSL_ENABLED;
2158 else if (strcmp(encryption_type, "require_tls") == 0) 2214 else if (strcmp(encryption_type, "require_tls") == 0) {
2159 {
2160 if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL)) 2215 if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL))
2161 glp->tls = GG_SSL_REQUIRED; 2216 glp->tls = GG_SSL_REQUIRED;
2162 else 2217 else {
2163 {
2164 purple_connection_error(gc, 2218 purple_connection_error(gc,
2165 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, 2219 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
2166 _("SSL support unavailable")); 2220 _("SSL support unavailable"));
2167 g_free(glp); 2221 g_free(glp);
2168 return; 2222 return;