diff libpurple/protocols/jabber/jabber.c @ 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 ca7ab06673dd
children cb7d809867ac 02df6998b466 15f61e6b15cd
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;