im.pidgin.cpw.resiak.disconnectreason: e3b204f1edc5f14a4085b971931650a66a0c58b1
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Wed Oct 3 13:58:22 EDT 2007
revision: e3b204f1edc5f14a4085b971931650a66a0c58b1
date: 2007-10-02T15:57:32
author: resiak at soc.pidgin.im
branch: im.pidgin.cpw.resiak.disconnectreason
changelog:
Add disconnection reasons to sametime.
manifest:
format_version "1"
new_manifest [dea269ca0e8e2763fda3e1ef060862db88d5b7d4]
old_revision [81b21e5230be75e9359bd28bfb194866f25b1ca9]
patch "libpurple/protocols/sametime/sametime.c"
from [4463e0fae00f673df1a3b8a9345978861540b6a1]
to [42519594ab0617a01943ec43ec89bb78fabf43d7]
-------------- next part --------------
#
#
# patch "libpurple/protocols/sametime/sametime.c"
# from [4463e0fae00f673df1a3b8a9345978861540b6a1]
# to [42519594ab0617a01943ec43ec89bb78fabf43d7]
#
============================================================
--- libpurple/protocols/sametime/sametime.c 4463e0fae00f673df1a3b8a9345978861540b6a1
+++ libpurple/protocols/sametime/sametime.c 42519594ab0617a01943ec43ec89bb78fabf43d7
@@ -414,7 +414,8 @@ static int mw_session_io_write(struct mw
} else if(len > 0) {
DEBUG_ERROR("write returned %i, %i bytes left unwritten\n", ret, len);
- purple_connection_error(pd->gc, _("Connection closed (writing)"));
+ purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Connection closed (writing)"));
#if 0
close(pd->socket);
@@ -1552,7 +1553,38 @@ static void mw_session_stateChange(struc
if(GPOINTER_TO_UINT(info) & ERR_FAILURE) {
char *err = mwError(GPOINTER_TO_UINT(info));
- purple_connection_error(gc, err);
+ PurpleDisconnectReason reason;
+ switch (GPOINTER_TO_UINT(info)) {
+ case VERSION_MISMATCH:
+ reason = PURPLE_REASON_OTHER_ERROR;
+ break;
+
+ case USER_RESTRICTED:
+ case INCORRECT_LOGIN:
+ case USER_UNREGISTERED:
+ case GUEST_IN_USE:
+ reason = PURPLE_REASON_AUTHENTICATION_FAILED;
+ break;
+
+ case ENCRYPT_MISMATCH:
+ case ERR_ENCRYPT_NO_SUPPORT:
+ case ERR_NO_COMMON_ENCRYPT:
+ reason = PURPLE_REASON_ENCRYPTION_ERROR;
+ break;
+
+ case VERIFICATION_DOWN:
+ reason = PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE;
+ break;
+
+ case MULTI_SERVER_LOGIN:
+ case MULTI_SERVER_LOGIN2:
+ reason = PURPLE_REASON_NAME_IN_USE;
+ break;
+
+ default:
+ reason = PURPLE_REASON_NETWORK_ERROR;
+ }
+ purple_connection_error_reason(gc, reason, err);
g_free(err);
}
break;
@@ -1698,8 +1730,9 @@ static void read_cb(gpointer data, gint
}
if(! ret) {
+ const char *msg = _("Connection reset");
DEBUG_INFO("connection reset\n");
- purple_connection_error(pd->gc, _("Connection reset"));
+ purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg);
} else if(ret < 0) {
char *msg = strerror(err);
@@ -1707,7 +1740,7 @@ static void read_cb(gpointer data, gint
DEBUG_INFO("error in read callback: %s\n", msg);
msg = g_strdup_printf(_("Error reading from socket: %s"), msg);
- purple_connection_error(pd->gc, msg);
+ purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg);
g_free(msg);
}
}
@@ -1729,7 +1762,8 @@ static void connect_cb(gpointer data, gi
} else {
/* this is a regular connect, error out */
- purple_connection_error(pd->gc, _("Unable to connect to host"));
+ const char *msg = _("Unable to connect to host");
+ purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg);
}
return;
@@ -3611,7 +3645,8 @@ static void prompt_host_cancel_cb(Purple
static void prompt_host_cancel_cb(PurpleConnection *gc) {
- purple_connection_error(gc, _("No Sametime Community Server specified"));
+ const char *msg = _("No Sametime Community Server specified");
+ purple_connection_error_reason(gc, PURPLE_REASON_INVALID_USERNAME, msg);
}
@@ -3723,7 +3758,8 @@ static void mw_prpl_login(PurpleAccount
purple_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS);
if (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL) {
- purple_connection_error(gc, _("Unable to connect to host"));
+ purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Unable to connect to host"));
}
}
More information about the Commits
mailing list