changeset 17838:2f67cb504a51

Implemented publishing events
author Andreas Monitzer <pidgin@monitzer.com>
date Wed, 06 Jun 2007 01:37:28 +0000
parents ac1ee71efd89
children 0370da969e8a
files libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/pep.h
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/pep.c	Wed Jun 06 01:23:18 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Wed Jun 06 01:37:28 2007 +0000
@@ -20,6 +20,7 @@
  */
 
 #include "pep.h"
+#include "iq.h"
 
 void jabber_pep_init(JabberStream *js) {
     
@@ -29,3 +30,16 @@
     /* this may be called even when the own server doesn't support pep! */
     
 }
+
+void jabber_pep_publish(JabberStream *js, xmlnode *publish) {
+    JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
+    
+    xmlnode *pubsub = xmlnode_new("pubsub");
+    xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub");
+    
+    xmlnode_insert_child(pubsub, publish);
+    
+    xmlnode_insert_child(iq->node, pubsub);
+    
+    jabber_iq_send(iq);
+}
--- a/libpurple/protocols/jabber/pep.h	Wed Jun 06 01:23:18 2007 +0000
+++ b/libpurple/protocols/jabber/pep.h	Wed Jun 06 01:37:28 2007 +0000
@@ -25,8 +25,17 @@
 #include "jabber.h"
 #include "message.h"
 
+/* called when the own server supports pep */
 void jabber_pep_init(JabberStream *js);
 
 void jabber_handle_event(JabberMessage *jm);
 
+/*
+ * Publishes PEP item(s)
+ *
+ * @parameter js      The JabberStream associated with the connection this event should be published
+ * @parameter publish The publish node. This could be for example &lt;publish node='http://jabber.org/protocol/tune'/> with an &lt;item/> as subnode
+ */
+void jabber_pep_publish(JabberStream *js, xmlnode *publish);
+
 #endif /* _PURPLE_JABBER_PEP_H_ */