pidgin: ff15da6d: Make SILC errors disconnect the account ...

nosnilmot at pidgin.im nosnilmot at pidgin.im
Tue Mar 11 21:50:51 EDT 2008


-----------------------------------------------------------------
Revision: ff15da6d15d666ee2501ad3a2c0a4678edf0d4ec
Ancestor: 4d71374be2e0f5bd11b3ba2e3d5d2564acd90236
Author: nosnilmot at pidgin.im
Date: 2008-03-12T01:37:15
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ff15da6d15d666ee2501ad3a2c0a4678edf0d4ec

Modified files:
        libpurple/protocols/silc/ops.c

ChangeLog: 

Make SILC errors disconnect the account and reduce unwanted notify dialogs.
This might be improvable, but seems to work for me.

-------------- next part --------------
============================================================
--- libpurple/protocols/silc/ops.c	19f5e64698139b4a8b9fa8b2dc43b606b41799ff
+++ libpurple/protocols/silc/ops.c	05743b25b6be1403d174dee4e493261536a12f09
@@ -48,17 +48,32 @@ void silc_say(SilcClient client, SilcCli
 void silc_say(SilcClient client, SilcClientConnection conn,
 	      SilcClientMessageType type, char *msg, ...)
 {
-	if (type == SILC_CLIENT_MESSAGE_ERROR) {
-		char tmp[256];
-		va_list va;
+	char tmp[256];
+	va_list va;
+	PurpleConnection *gc = NULL;
+	PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 
-		va_start(va, msg);
-		silc_vsnprintf(tmp, sizeof(tmp), msg, va);
-		purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp);
+	va_start(va, msg);
+	silc_vsnprintf(tmp, sizeof(tmp), msg, va);
+	va_end(va);
 
-		va_end(va);
+	if (type != SILC_CLIENT_MESSAGE_ERROR) {
+		purple_debug_misc("silc", "silc_say (%d) %s\n", type, tmp);
 		return;
 	}
+
+	purple_debug_error("silc", "silc_say error: %s\n", tmp);
+
+	if (!strcmp(tmp, "Authentication failed"))
+		reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
+
+	if (client != NULL)
+		gc = client->application;
+
+	if (gc != NULL)
+		purple_connection_error_reason (gc, reason, tmp);
+	else
+		purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp);
 }
 
 /* Processes incoming MIME message.  Can be private message or channel


More information about the Commits mailing list