changeset 11568:e36f0f9debb5

[gaim-migrate @ 13835] real live jabber presence support (at least in the prpl) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 26 Sep 2005 00:08:08 +0000
parents 603a0e626332
children ea98c27f1a34
files src/protocols/jabber/jabber.c src/protocols/jabber/presence.c
diffstat 2 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Sun Sep 25 16:45:29 2005 +0000
+++ b/src/protocols/jabber/jabber.c	Mon Sep 26 00:08:08 2005 +0000
@@ -999,39 +999,50 @@
 {
 	GaimStatusType *type;
 	GList *types = NULL;
+	GaimValue *priority_value;
 
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_OFFLINE, "offline",
 			_("Offline"), FALSE, TRUE, FALSE, "message", _("Message"),
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
+	priority_value = gaim_value_new(GAIM_TYPE_INT);
+	gaim_value_set_int(priority_value, 0);
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, "available",
 			_("Available"), TRUE, TRUE, FALSE, "priority", _("Priority"),
-			gaim_value_new(GAIM_TYPE_INT), "message", _("Message"),
+			priority_value, "message", _("Message"),
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
+	priority_value = gaim_value_new(GAIM_TYPE_INT);
+	gaim_value_set_int(priority_value, 0);
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, "chat",
 			_("Chatty"), TRUE, TRUE, FALSE, "priority", _("Priority"),
-			gaim_value_new(GAIM_TYPE_INT), "message", _("Message"),
+			priority_value, "message", _("Message"),
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
+	priority_value = gaim_value_new(GAIM_TYPE_INT);
+	gaim_value_set_int(priority_value, 5);
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, "away",
 			_("Away"), TRUE, TRUE, FALSE, "priority", _("Priority"),
-			gaim_value_new(GAIM_TYPE_INT), "message", _("Message"),
+			priority_value, "message", _("Message"),
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
+	priority_value = gaim_value_new(GAIM_TYPE_INT);
+	gaim_value_set_int(priority_value, 10);
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, "xa",
 			_("Extended Away"), TRUE, TRUE, FALSE, "priority", _("Priority"),
-			gaim_value_new(GAIM_TYPE_INT), "message", _("Message"),
+			priority_value, "message", _("Message"),
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
+	priority_value = gaim_value_new(GAIM_TYPE_INT);
+	gaim_value_set_int(priority_value, 20);
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE, "dnd",
 			_("Do Not Disturb"), TRUE, TRUE, FALSE, "priority", _("Priority"),
-			gaim_value_new(GAIM_TYPE_INT), "message", _("Message"),
+			priority_value, "message", _("Message"),
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
--- a/src/protocols/jabber/presence.c	Sun Sep 25 16:45:29 2005 +0000
+++ b/src/protocols/jabber/presence.c	Mon Sep 26 00:08:08 2005 +0000
@@ -144,7 +144,7 @@
 
 xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority)
 {
-	xmlnode *show, *status, *presence;
+	xmlnode *show, *status, *presence, *pri;
 	const char *show_string = NULL;
 
 
@@ -168,6 +168,13 @@
 		xmlnode_insert_data(status, msg, -1);
 	}
 
+	if(priority) {
+		char *pstr = g_strdup_printf("%d", priority);
+		pri = xmlnode_new_child(presence, "priority");
+		xmlnode_insert_data(pri, pstr, -1);
+		g_free(pstr);
+	}
+
 	return presence;
 }