comparison 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
comparison
equal deleted inserted replaced
1007:35b83557ffe1 1008:bbf53cd43fbb
31 #include "utils.h" 31 #include "utils.h"
32 #include "screen.h" 32 #include "screen.h"
33 #include "settings.h" 33 #include "settings.h"
34 #include "hbuf.h" 34 #include "hbuf.h"
35 35
36
37 // Bookmarks for IQ:private storage
38 xmlnode bookmarks;
36 39
37 static GSList *iqs_list; 40 static GSList *iqs_list;
38 41
39 // Enum for vCard attributes 42 // Enum for vCard attributes
40 enum vcard_attr { 43 enum vcard_attr {
606 p = xmlnode_get_name(x); 609 p = xmlnode_get_name(x);
607 // If the current node is a conference item, parse it and update the roster 610 // If the current node is a conference item, parse it and update the roster
608 if (p && !strcmp(p, "conference")) 611 if (p && !strcmp(p, "conference"))
609 storage_bookmarks_parse_conference(x); 612 storage_bookmarks_parse_conference(x);
610 } 613 }
614 xmlnode_free(bookmarks);
615 bookmarks = xmlnode_dup(ansqry);
611 } 616 }
612 617
613 static void request_storage_bookmarks(void) 618 static void request_storage_bookmarks(void)
614 { 619 {
615 eviqs *iqn; 620 eviqs *iqn;
893 display_server_error(x); 898 display_server_error(x);
894 iqs_callback(xmlnode_get_attrib(xmldata, "id"), NULL, IQS_CONTEXT_ERROR); 899 iqs_callback(xmlnode_get_attrib(xmldata, "id"), NULL, IQS_CONTEXT_ERROR);
895 } 900 }
896 } 901 }
897 902
903 // send_storage_bookmarks()
904 // Send the current bookmarks node to update the server.
905 // Note: the sender should check we're online.
906 void send_storage_bookmarks(void)
907 {
908 eviqs *iqn;
909
910 if (!bookmarks) return;
911
912 iqn = iqs_new(JPACKET__SET, NS_PRIVATE, "storage", IQS_DEFAULT_TIMEOUT);
913 xmlnode_insert_node(xmlnode_get_tag(iqn->xmldata, "query"), bookmarks);
914
915 jab_send(jc, iqn->xmldata);
916 iqs_del(iqn->id); // XXX
917 }
918
898 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ 919 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */