changeset 20149:be2538a92099

Comment a partial implementation of the libpurple attention API for XMPP. The implemented functions in the prpl_info struct are not yet used, and requires further testing.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sun, 23 Sep 2007 20:30:57 +0000
parents e86f136e880e
children 52dce2882c03
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/libxmpp.c
diffstat 3 files changed, 45 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Sep 18 01:08:46 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Sep 23 20:30:57 2007 +0000
@@ -2240,6 +2240,44 @@
 	return PURPLE_CMD_RET_FAILED;
 }
 
+GList *jabber_attention_types(PurpleAccount *account)
+{
+	static GList *types = NULL;
+	PurpleAttentionType *attn;
+
+	if (!types) {
+		attn = g_new0(PurpleAttentionType, 1);
+		attn->name = _("Buzz");
+		attn->incoming_description = _("%s has buzzed you!");
+		attn->outgoing_description = _("Buzzing %s...");
+		types = g_list_append(types, attn);
+	}
+
+	return types;
+}
+
+gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code)
+{
+	PurpleConversation *conv;
+	char *error;
+	char *args[1];
+	PurpleCmdRet ret;
+
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, username, gc->account);
+
+	args[0] = (char *)username;
+
+	ret = jabber_cmd_buzz(conv, "buzz", args, &error, NULL);
+
+	if (ret == PURPLE_CMD_RET_FAILED) {
+		purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)");
+		return FALSE;
+	} else {
+		return TRUE;
+	}
+}
+
+
 gboolean jabber_offline_message(const PurpleBuddy *buddy)
 {
 	return TRUE;
--- a/libpurple/protocols/jabber/jabber.h	Tue Sep 18 01:08:46 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Sun Sep 23 20:30:57 2007 +0000
@@ -66,6 +66,9 @@
 
 #define CAPS0115_NODE "http://pidgin.im/caps"
 
+/* Index into attention_types list */
+#define JABBER_BUZZ 0
+
 typedef enum {
 	JABBER_STREAM_OFFLINE,
 	JABBER_STREAM_CONNECTING,
@@ -231,6 +234,8 @@
 void jabber_register_gateway(JabberStream *js, const char *gateway);
 void jabber_register_account(PurpleAccount *account);
 void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data);
+gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code);
+GList *jabber_attention_types(PurpleAccount *account);
 void jabber_convo_closed(PurpleConnection *gc, const char *who);
 PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name);
 gboolean jabber_offline_message(const PurpleBuddy *buddy);
--- a/libpurple/protocols/jabber/libxmpp.c	Tue Sep 18 01:08:46 2007 +0000
+++ b/libpurple/protocols/jabber/libxmpp.c	Sun Sep 23 20:30:57 2007 +0000
@@ -113,10 +113,10 @@
 	jabber_prpl_send_raw,			/* send_raw */
 	jabber_roomlist_room_serialize, /* roomlist_room_serialize */
 	jabber_unregister_account,		/* unregister_user */
+	jabber_attention_types,                 /* attention_types */
+	jabber_send_attention,                  /* send_attention */
 
 	/* padding */
-	NULL,
-	NULL,
 	NULL
 };