soc.2009.telepathy: 55a5efb6: Implemented self presence and status set...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Fri Jun 12 18:30:42 EDT 2009


-----------------------------------------------------------------
Revision: 55a5efb6c79a36db4baaeb10f71f913f82dadaee
Ancestor: 099ee5ce78534d63fc2eb2cdeef152ec28e64473
Author: sttwister at soc.pidgin.im
Date: 2009-06-12T22:23:47
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/55a5efb6c79a36db4baaeb10f71f913f82dadaee

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Implemented self presence and status setting

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	b88abf56d451b055bac1a324f37730ae27455572
+++ libpurple/protocols/telepathy/telepathy.c	82ef33e54c0c9d608e3e174156053dbb35e129dd
@@ -230,6 +230,7 @@ telepathy_status_text(PurpleBuddy* buddy
 	}
 }
 
+/* TODO: Do a proper query of the "status" property */
 static GList *
 telepathy_status_types(PurpleAccount *acct)
 {
@@ -1377,6 +1378,36 @@ static void
 }
 
 static void
+set_presence_cb (TpConnection *proxy,
+                 const GError *error,
+                 gpointer user_data,
+                 GObject *weak_object)
+{
+	if (error != NULL)
+	{
+		purple_debug_error("telepathy", "SetStatus error: %s\n", error->message);
+	}
+}
+
+static void
+telepathy_set_status (PurpleAccount *account, PurpleStatus *status)
+{
+	PurpleConnection *gc = purple_account_get_connection(account);
+	telepathy_connection *data = purple_connection_get_protocol_data(gc);
+
+	const gchar *presence_id = purple_status_get_id(status);
+	const gchar *presence_message = purple_status_get_attr_string(status, "message");
+
+	purple_debug_info("telepathy", "Setting status %s (%s) for %s\n", 
+			presence_id, presence_message, purple_account_get_username(account));
+
+	tp_cli_connection_interface_simple_presence_call_set_presence(data->connection, -1,
+			presence_id, presence_message, 
+			set_presence_cb, data,
+			NULL, NULL);
+}
+
+static void
 telepathy_destroy(PurplePlugin *plugin)
 {
 	purple_debug_info("telepathy", "Shutting down\n");
@@ -1412,7 +1443,7 @@ static PurplePluginProtocolInfo telepath
 	NULL,                   /* set_info */
 	NULL,                /* send_typing */
 	NULL,                   /* get_info */
-	NULL,                 /* set_status */
+	telepathy_set_status,                 /* set_status */
 	NULL,                   /* set_idle */
 	NULL,              /* change_passwd */
 	NULL,                  /* add_buddy */


More information about the Commits mailing list