changeset 17568:df5bb342b10e

implemented user mood, still missing the front end interface
author Andreas Monitzer <pidgin@monitzer.com>
date Mon, 11 Jun 2007 23:33:39 +0000
parents cac26c30047a
children a0cd74d7b51e
files libpurple/protocols/jabber/buddy.h libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/pep.h libpurple/xmlnode.h
diffstat 5 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.h	Sun Jun 10 12:22:39 2007 +0000
+++ b/libpurple/protocols/jabber/buddy.h	Mon Jun 11 23:33:39 2007 +0000
@@ -23,6 +23,7 @@
 #define _PURPLE_JABBER_BUDDY_H_
 
 #include "jabber.h"
+#include "usermood.h"
 
 typedef enum {
 	JABBER_BUDDY_STATE_UNKNOWN = -2,
--- a/libpurple/protocols/jabber/jabber.c	Sun Jun 10 12:22:39 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Jun 11 23:33:39 2007 +0000
@@ -1271,6 +1271,8 @@
 			NULL, TRUE, TRUE, FALSE,
 			"priority", _("Priority"), priority_value,
 			"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
+            "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT),
+            "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1281,6 +1283,8 @@
 			_("Chatty"), TRUE, TRUE, FALSE,
 			"priority", _("Priority"), priority_value,
 			"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
+            "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT),
+            "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1291,6 +1295,8 @@
 			NULL, TRUE, TRUE, FALSE,
 			"priority", _("Priority"), priority_value,
 			"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
+            "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT),
+            "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1301,6 +1307,8 @@
 			NULL, TRUE, TRUE, FALSE,
 			"priority", _("Priority"), priority_value,
 			"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
+            "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT),
+            "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1311,6 +1319,8 @@
 			_("Do Not Disturb"), TRUE, TRUE, FALSE,
 			"priority", _("Priority"), priority_value,
 			"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
+            "mood", _("Mood"), purple_value_new(PURPLE_TYPE_INT),
+            "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
--- a/libpurple/protocols/jabber/pep.c	Sun Jun 10 12:22:39 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Mon Jun 11 23:33:39 2007 +0000
@@ -29,7 +29,8 @@
     if(!pep_handlers) {
         pep_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
         
-        /* register PEP handlers here */
+        /* register PEP handlers */
+        jabber_mood_init();
     }
 }
 
@@ -44,15 +45,18 @@
     /* this may be called even when the own server doesn't support pep! */
     JabberPEPHandler *jph;
     GList *itemslist;
+    char *jid = jabber_get_bare_jid(jm->from);
+    
     for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) {
         xmlnode *items = (xmlnode*)itemslist->data;
         const char *xmlns = xmlnode_get_namespace(items);
         
         if((jph = g_hash_table_lookup(pep_handlers, xmlns)))
-            jph(jm->js, items);
+            jph(jm->js, jid, items);
     }
     
     /* discard items we don't have a handler for */
+    g_free(jid);
 }
 
 void jabber_pep_publish(JabberStream *js, xmlnode *publish) {
--- a/libpurple/protocols/jabber/pep.h	Sun Jun 10 12:22:39 2007 +0000
+++ b/libpurple/protocols/jabber/pep.h	Mon Jun 11 23:33:39 2007 +0000
@@ -24,6 +24,7 @@
 
 #include "jabber.h"
 #include "message.h"
+#include "buddy.h"
 
 void jabber_pep_init(void);
 
@@ -33,7 +34,7 @@
  * @parameter js    The JabberStream this item was received on
  * @parameter items The &lt;items/>-tag with the &lt;item/>-children
  */
-typedef void (JabberPEPHandler)(JabberStream *js, xmlnode *items);
+typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items);
 
 /*
  * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info.
--- a/libpurple/xmlnode.h	Sun Jun 10 12:22:39 2007 +0000
+++ b/libpurple/xmlnode.h	Mon Jun 11 23:33:39 2007 +0000
@@ -252,7 +252,7 @@
 xmlnode *xmlnode_copy(const xmlnode *src);
 
 /**
- * Frees a node and all of it's children.
+ * Frees a node and all of its children.
  *
  * @param node The node to free.
  */