Mercurial > pidgin.yaz
comparison libpurple/protocols/novell/novell.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 | efa448405f3d |
children | e747ac0c42d6 |
comparison
equal
deleted
inserted
replaced
21357:5a3242b676ad | 21358:ba41f2a60253 |
---|---|
118 rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, | 118 rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, |
119 NULL); | 119 NULL); |
120 _check_for_disconnect(user, rc); | 120 _check_for_disconnect(user, rc); |
121 | 121 |
122 } else { | 122 } else { |
123 PurpleDisconnectReason reason; | 123 PurpleConnectionError reason; |
124 char *err = g_strdup_printf(_("Login failed (%s)."), | 124 char *err = g_strdup_printf(_("Login failed (%s)."), |
125 nm_error_to_string (ret_code)); | 125 nm_error_to_string (ret_code)); |
126 | 126 |
127 switch (ret_code) { | 127 switch (ret_code) { |
128 case NMERR_AUTHENTICATION_FAILED: | 128 case NMERR_AUTHENTICATION_FAILED: |
131 /* Don't attempt to auto-reconnect if our | 131 /* Don't attempt to auto-reconnect if our |
132 * password was invalid. | 132 * password was invalid. |
133 */ | 133 */ |
134 if (!purple_account_get_remember_password(gc->account)) | 134 if (!purple_account_get_remember_password(gc->account)) |
135 purple_account_set_password(gc->account, NULL); | 135 purple_account_set_password(gc->account, NULL); |
136 reason = PURPLE_REASON_AUTHENTICATION_FAILED; | 136 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
137 break; | 137 break; |
138 default: | 138 default: |
139 /* FIXME: There are other reasons login could fail */ | 139 /* FIXME: There are other reasons login could fail */ |
140 reason = PURPLE_REASON_NETWORK_ERROR; | 140 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
141 } | 141 } |
142 | 142 |
143 purple_connection_error_reason (gc, reason, err); | 143 purple_connection_error_reason (gc, reason, err); |
144 g_free(err); | 144 g_free(err); |
145 } | 145 } |
1124 { | 1124 { |
1125 PurpleConnection *gc = purple_account_get_connection(user->client_data); | 1125 PurpleConnection *gc = purple_account_get_connection(user->client_data); |
1126 | 1126 |
1127 if (_is_disconnect_error(err)) { | 1127 if (_is_disconnect_error(err)) { |
1128 | 1128 |
1129 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, | 1129 purple_connection_error_reason (gc, |
1130 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
1130 _("Error communicating with server. Closing connection.")); | 1131 _("Error communicating with server. Closing connection.")); |
1131 return TRUE; | 1132 return TRUE; |
1132 | 1133 |
1133 } | 1134 } |
1134 | 1135 |
1695 if (rc != NM_OK) { | 1696 if (rc != NM_OK) { |
1696 | 1697 |
1697 if (_is_disconnect_error(rc)) { | 1698 if (_is_disconnect_error(rc)) { |
1698 | 1699 |
1699 purple_connection_error_reason (gc, | 1700 purple_connection_error_reason (gc, |
1700 PURPLE_REASON_NETWORK_ERROR, | 1701 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
1701 _("Error communicating with server. Closing connection.")); | 1702 _("Error communicating with server. Closing connection.")); |
1702 } else { | 1703 } else { |
1703 purple_debug(PURPLE_DEBUG_INFO, "novell", | 1704 purple_debug(PURPLE_DEBUG_INFO, "novell", |
1704 "Error processing event or response (%d).\n", rc); | 1705 "Error processing event or response (%d).\n", rc); |
1705 } | 1706 } |
1735 rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); | 1736 rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); |
1736 if (rc == NM_OK) { | 1737 if (rc == NM_OK) { |
1737 conn->connected = TRUE; | 1738 conn->connected = TRUE; |
1738 purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); | 1739 purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); |
1739 } else { | 1740 } else { |
1740 purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, | 1741 purple_connection_error_reason (gc, |
1742 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
1741 _("Unable to connect to server.")); | 1743 _("Unable to connect to server.")); |
1742 } | 1744 } |
1743 | 1745 |
1744 purple_connection_update_progress(gc, _("Waiting for response..."), | 1746 purple_connection_update_progress(gc, _("Waiting for response..."), |
1745 3, NOVELL_CONNECT_STEPS); | 1747 3, NOVELL_CONNECT_STEPS); |
2018 gc = purple_account_get_connection(account); | 2020 gc = purple_account_get_connection(account); |
2019 if (gc) | 2021 if (gc) |
2020 { | 2022 { |
2021 if (!purple_account_get_remember_password(account)) | 2023 if (!purple_account_get_remember_password(account)) |
2022 purple_account_set_password(account, NULL); | 2024 purple_account_set_password(account, NULL); |
2023 purple_connection_error_reason (gc, PURPLE_REASON_NAME_IN_USE, | 2025 purple_connection_error_reason (gc, |
2024 _("You have been logged out because you" | 2026 PURPLE_CONNECTION_ERROR_NAME_IN_USE, |
2025 " logged in at another workstation.")); | 2027 _("You have been logged out because you" |
2028 " logged in at another workstation.")); | |
2026 } | 2029 } |
2027 } | 2030 } |
2028 | 2031 |
2029 static void | 2032 static void |
2030 _evt_user_typing(NMUser * user, NMEvent * event) | 2033 _evt_user_typing(NMUser * user, NMEvent * event) |
2174 /* TODO: Would be nice to prompt if not set! | 2177 /* TODO: Would be nice to prompt if not set! |
2175 * purple_request_fields(gc, _("Server Address"),...); | 2178 * purple_request_fields(gc, _("Server Address"),...); |
2176 */ | 2179 */ |
2177 | 2180 |
2178 /* ...but for now just error out with a nice message. */ | 2181 /* ...but for now just error out with a nice message. */ |
2179 purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, | 2182 purple_connection_error_reason (gc, |
2183 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | |
2180 _("Unable to connect to server. Please enter the " | 2184 _("Unable to connect to server. Please enter the " |
2181 "address of the server you wish to connect to.")); | 2185 "address of the server you wish to connect to.")); |
2182 return; | 2186 return; |
2183 } | 2187 } |
2184 | 2188 |
2203 user->conn->ssl_conn->data = purple_ssl_connect(user->client_data, | 2207 user->conn->ssl_conn->data = purple_ssl_connect(user->client_data, |
2204 user->conn->addr, user->conn->port, | 2208 user->conn->addr, user->conn->port, |
2205 novell_ssl_connected_cb, novell_ssl_connect_error, gc); | 2209 novell_ssl_connected_cb, novell_ssl_connect_error, gc); |
2206 if (user->conn->ssl_conn->data == NULL) { | 2210 if (user->conn->ssl_conn->data == NULL) { |
2207 purple_connection_error_reason (gc, | 2211 purple_connection_error_reason (gc, |
2208 PURPLE_REASON_NO_SSL_SUPPORT, | 2212 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
2209 _("Error. SSL support is not installed.")); | 2213 _("Error. SSL support is not installed.")); |
2210 } | 2214 } |
2211 } | 2215 } |
2212 } | 2216 } |
2213 | 2217 |