im.pidgin.cpw.resiak.disconnectreason: 6e53ff14d305acc945bcc295b492070cbdb7288e
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Sat Oct 27 13:51:11 EDT 2007
-----------------------------------------------------------------
Revision: 6e53ff14d305acc945bcc295b492070cbdb7288e
Ancestor: 41f03fff0ed32c5ff61956bb612f3e23412ac305
Author: resiak at soc.pidgin.im
Date: 2007-10-24T17:33:12
Branch: im.pidgin.cpw.resiak.disconnectreason
Modified files:
ChangeLog.API libpurple/connection.c
libpurple/plugins/signals-test.c libpurple/signals.c
libpurple/signals.h
ChangeLog:
I figured a signal firing on a connection error would be useful.
-------------- next part --------------
============================================================
--- ChangeLog.API abe89dcb0473a3a31ed3b257886c0146291714ab
+++ ChangeLog.API 552df4c2c5240971fc14adafa334acc88b697bf0
@@ -26,6 +26,8 @@ version 2.3.0 (??/??/????):
implemented by UIs (rather than .report_disconnect) if
they want to use the reported PurpleDisconnectReason
to give a more specific error.
+ * A connection-error signal, fired just after the UiOp is
+ called.
* purple_connection_reason_is_fatal(), acting as a hint
to whether automatic reconnection should be attempted
after a connection error (rather than checking
============================================================
--- libpurple/connection.c f3c05448c078c6629aa27b5240c6863c55947b59
+++ libpurple/connection.c 813f5ad3208d309aab69fbd4fdd7a904b9805fb6
@@ -541,6 +541,9 @@ purple_connection_error_reason (PurpleCo
ops->report_disconnect (gc, description);
}
+ purple_signal_emit(purple_connections_get_handle(), "connection-error",
+ gc, reason, description);
+
gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb,
purple_connection_get_account(gc));
}
@@ -658,6 +661,14 @@ purple_connections_init(void)
purple_marshal_VOID__POINTER, NULL, 1,
purple_value_new(PURPLE_TYPE_SUBTYPE,
PURPLE_SUBTYPE_CONNECTION));
+
+ purple_signal_register(handle, "connection-error",
+ purple_marshal_VOID__POINTER_INT_POINTER, NULL, 1,
+ purple_value_new(PURPLE_TYPE_SUBTYPE,
+ PURPLE_SUBTYPE_CONNECTION),
+ purple_value_new(PURPLE_TYPE_ENUM),
+ purple_value_new(PURPLE_TYPE_STRING));
+
}
void
============================================================
--- libpurple/plugins/signals-test.c 77bbe5d90cc945cd280d2eba80559f880f38bb8d
+++ libpurple/plugins/signals-test.c daed96e7acb0c4c54e92197dff0b2799a5111b35
@@ -226,6 +226,18 @@ signed_off_cb(PurpleConnection *gc, void
purple_account_get_username(purple_connection_get_account(gc)));
}
+static void
+connection_error_cb(PurpleConnection *gc,
+ PurpleConnectionError err,
+ const gchar *desc,
+ void *data)
+{
+ const gchar *username =
+ purple_account_get_username(purple_connection_get_account(gc));
+ purple_debug_misc("signals test", "connection-error (%s, %u, %s)\n",
+ username, err, desc);
+}
+
/**************************************************************************
* Conversation subsystem signal callbacks
**************************************************************************/
@@ -626,6 +638,8 @@ plugin_load(PurplePlugin *plugin)
plugin, PURPLE_CALLBACK(signing_off_cb), NULL);
purple_signal_connect(conn_handle, "signed-off",
plugin, PURPLE_CALLBACK(signed_off_cb), NULL);
+ purple_signal_connect(conn_handle, "connection-error",
+ plugin, PURPLE_CALLBACK(connection_error_cb), NULL);
/* Conversations subsystem signals */
purple_signal_connect(conv_handle, "writing-im-msg",
============================================================
--- libpurple/signals.c 3fb3c0e9614a270f4ba21050515c9fde98ba93b9
+++ libpurple/signals.c 819bf502d09507a5b94ae299b96067e570593276
@@ -649,6 +649,16 @@ void purple_marshal_VOID__POINTER_INT_IN
((void (*)(void *, gint, gint, void *))cb)(arg1, arg2, arg3, data);
}
+void purple_marshal_VOID__POINTER_INT_POINTER(PurpleCallback cb, va_list args,
+ void *data, void **return_val)
+{
+ void *arg1 = va_arg(args, void *);
+ gint arg2 = va_arg(args, gint);
+ void *arg3 = va_arg(args, void *);
+
+ ((void (*)(void *, gint, void *, void *))cb)(arg1, arg2, arg3, data);
+}
+
void
purple_marshal_VOID__POINTER_POINTER(PurpleCallback cb, va_list args,
void *data, void **return_val)
============================================================
--- libpurple/signals.h b4065a68cde47d4beabda2b21d25d130605bcad0
+++ libpurple/signals.h a84be6fd28da83d6b327b99a3fa772194514be8e
@@ -284,6 +284,8 @@ void purple_marshal_VOID__POINTER_INT_IN
PurpleCallback cb, va_list args, void *data, void **return_val);
void purple_marshal_VOID__POINTER_INT_INT(
PurpleCallback cb, va_list args, void *data, void **return_val);
+void purple_marshal_VOID__POINTER_INT_POINTER(
+ PurpleCallback cb, va_list args, void *data, void **return_val);
void purple_marshal_VOID__POINTER_POINTER(
PurpleCallback cb, va_list args, void *data, void **return_val);
void purple_marshal_VOID__POINTER_POINTER_UINT(
More information about the Commits
mailing list