diff mcabber/src/jab_iq.c @ 1008:bbf53cd43fbb

Functions to update room bookmarks
author Mikael Berthe <mikael@lilotux.net>
date Sun, 12 Nov 2006 10:45:13 +0100
parents f61131cd86a0
children 99c5278bf6b8
line wrap: on
line diff
--- a/mcabber/src/jab_iq.c	Sat Nov 11 12:14:10 2006 +0100
+++ b/mcabber/src/jab_iq.c	Sun Nov 12 10:45:13 2006 +0100
@@ -34,6 +34,9 @@
 #include "hbuf.h"
 
 
+// Bookmarks for IQ:private storage
+xmlnode bookmarks;
+
 static GSList *iqs_list;
 
 // Enum for vCard attributes
@@ -608,6 +611,8 @@
     if (p && !strcmp(p, "conference"))
       storage_bookmarks_parse_conference(x);
   }
+  xmlnode_free(bookmarks);
+  bookmarks = xmlnode_dup(ansqry);
 }
 
 static void request_storage_bookmarks(void)
@@ -895,4 +900,20 @@
   }
 }
 
+//  send_storage_bookmarks()
+// Send the current bookmarks node to update the server.
+// Note: the sender should check we're online.
+void send_storage_bookmarks(void)
+{
+  eviqs *iqn;
+
+  if (!bookmarks) return;
+
+  iqn = iqs_new(JPACKET__SET, NS_PRIVATE, "storage", IQS_DEFAULT_TIMEOUT);
+  xmlnode_insert_node(xmlnode_get_tag(iqn->xmldata, "query"), bookmarks);
+
+  jab_send(jc, iqn->xmldata);
+  iqs_del(iqn->id); // XXX
+}
+
 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */