soc.2010.detachablepurple: 3a83836c: Wrapping of the PurpleAccountUiOps.reque...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Thu Jul 29 02:01:50 EDT 2010
----------------------------------------------------------------------
Revision: 3a83836c05404a948c6ffa363b239fefd84f7fe6
Parent: 521fe0716a490b33dc1297531739c869b18a9cf1
Author: gillux at soc.pidgin.im
Date: 07/28/10 23:01:49
Branch: im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/3a83836c05404a948c6ffa363b239fefd84f7fe6
Changelog:
Wrapping of the PurpleAccountUiOps.request_add callback.
Changes against parent 521fe0716a490b33dc1297531739c869b18a9cf1
patched libpurple/account-dbus.c
patched libpurple/dbus-prototypes/account.xml
patched libpurple/marshallers.list
patched purpled/purpled-account.c
-------------- next part --------------
============================================================
--- libpurple/marshallers.list 86443fec003cf3f07a14b76e9fba8fcd344ec674
+++ libpurple/marshallers.list c8758ea42a367d3e73fc8a62aa1886f446cba2b8
@@ -16,5 +16,5 @@ VOID:UINT64,BOXED
VOID:STRING,BOXED
# Marshaller for the RunCallback dbus signal
VOID:UINT64,BOXED
-# Marshaller for the NotifyAdded dbus signal
+# Marshaller for the NotifyAdded and RequestAdd dbus signal
VOID:STRING,STRING,STRING,STRING
============================================================
--- libpurple/account-dbus.c 8d1bf7ff44269047975f030a7df74210b1dd04cc
+++ libpurple/account-dbus.c b61288b14dcd6c391f6cdb31aee49557fab1b509
@@ -24,6 +24,18 @@ notify_added_cb(DBusGProxy *proxy, const
purple_account_notify_added(account, remote_user, id, alias, message);
}
+/**
+ * Callback, called when we receive a dbus "RequestAdd" signal.
+ */
+static void
+request_add_cb(DBusGProxy *proxy, const char *remote_user, const char *id,
+ const char *alias, const char *message, gpointer data)
+{
+ PurpleAccount* account = PURPLE_ACCOUNT(
+ purple_dbus_get_gobject_by_path(dbus_g_proxy_get_path(proxy)));
+ purple_account_request_add(account, remote_user, id, alias, message);
+}
+
static char*
build_dbus_path(const char *username, const char *protocol_id)
{
@@ -55,11 +67,18 @@ purple_account_class_dbus_init(void)
purple_smarshal_VOID__STRING_STRING_STRING_STRING,
G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING);
+ g_signal_new("request_add",
+ PURPLE_TYPE_ACCOUNT,
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ purple_smarshal_VOID__STRING_STRING_STRING_STRING,
+ G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING);
}
/* In remote mode we need to register the marshallers
* we will use to receive the signals sent by the daemon */
else if (purple_core_is_remote_mode()) {
- /* Marshaller for the NotifyAdded dbus signals */
+ /* Marshaller for the NotifyAdded and RequestAdd dbus signals */
dbus_g_object_register_marshaller(
purple_smarshal_VOID__STRING_STRING_STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
@@ -88,6 +107,12 @@ purple_account_dbus_init(PurpleAccount *
dbus_g_proxy_connect_signal(proxy, "NotifyAdded",
G_CALLBACK(notify_added_cb),
account, NULL);
+ dbus_g_proxy_add_signal(proxy, "RequestAdd", G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(proxy, "RequestAdd",
+ G_CALLBACK(request_add_cb),
+ account, NULL);
}
}
============================================================
--- libpurple/dbus-prototypes/account.xml 6211067ecea56e3249ef0c92eb20c3d362e58e03
+++ libpurple/dbus-prototypes/account.xml 5a9b4dbdcb29375dc1efae35b66e31b51ce07b56
@@ -33,5 +33,11 @@
<arg type="s" name="alias" />
<arg type="s" name="message" />
</signal>
+ <signal name="RequestAdd">
+ <arg type="s" name="remote_user" />
+ <arg type="s" name="id" />
+ <arg type="s" name="alias" />
+ <arg type="s" name="message" />
+ </signal>
</interface>
</node>
============================================================
--- purpled/purpled-account.c 482342ff474e799ccfa2e41eb29fc44129cb0448
+++ purpled/purpled-account.c 3c4eec33cde3fd0622f138a75c92bda5712ae1e4
@@ -36,11 +36,24 @@ purpled_account_notify_added(PurpleAccou
remote_user, id, alias, message);
}
+/**
+ * PurpleAccountUiOps.request_add daemon callback.
+ * This sends the RequestAdd dbus signal.
+ */
+static void
+purpled_account_request_add(PurpleAccount *account, const char *remote_user,
+ const char *id, const char *alias,
+ const char *message)
+{
+ g_signal_emit_by_name(account, "request_add",
+ remote_user, id, alias, message);
+}
+
static PurpleAccountUiOps purpled_account_ui_ops =
{
purpled_account_notify_added, /* notify_added */
NULL, /* status_changed */
- NULL, /* request_add */
+ purpled_account_request_add, /* request_add */
NULL, /* request_authorize */
NULL, /* close_account_request */
NULL, /* _purple_reserved1 */
More information about the Commits
mailing list