comparison libpurple/protocols/jabber/disco.c @ 17576:e49b259fc7dd

PEP publishing features are now only announced in disco#info when PEP is supported by the server.
author Andreas Monitzer <pidgin@monitzer.com>
date Fri, 15 Jun 2007 07:13:41 +0000
parents 0370da969e8a
children f88b3a093cba
comparison
equal deleted inserted replaced
17575:5fc8a8a25008 17576:e49b259fc7dd
35 struct _jabber_disco_info_cb_data { 35 struct _jabber_disco_info_cb_data {
36 gpointer data; 36 gpointer data;
37 JabberDiscoInfoCallback *callback; 37 JabberDiscoInfoCallback *callback;
38 }; 38 };
39 39
40 #define SUPPORT_FEATURE(x) \ 40 #define SUPPORT_FEATURE(x) { \
41 feature = xmlnode_new_child(query, "feature"); \ 41 feature = xmlnode_new_child(query, "feature"); \
42 xmlnode_set_attrib(feature, "var", x); 42 xmlnode_set_attrib(feature, "var", x); \
43 }
43 44
44 45
45 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) { 46 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) {
46 const char *from = xmlnode_get_attrib(packet, "from"); 47 const char *from = xmlnode_get_attrib(packet, "from");
47 const char *type = xmlnode_get_attrib(packet, "type"); 48 const char *type = xmlnode_get_attrib(packet, "type");
96 SUPPORT_FEATURE("http://jabber.org/protocol/si") 97 SUPPORT_FEATURE("http://jabber.org/protocol/si")
97 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") 98 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
98 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") 99 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
99 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns") 100 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns")
100 101
101 if(!node) { /* non-caps disco#info, add all extensions */ 102 if(!node) { /* non-caps disco#info, add all enabled extensions */
102 GList *features; 103 GList *features;
103 for(features = jabber_features; features; features = features->next) { 104 for(features = jabber_features; features; features = features->next) {
104 JabberFeature *feat = (JabberFeature*)features->data; 105 JabberFeature *feat = (JabberFeature*)features->data;
105 SUPPORT_FEATURE(feat->namespace); 106 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
107 SUPPORT_FEATURE(feat->namespace);
106 } 108 }
107 } 109 }
108 } else { 110 } else {
109 const char *ext = NULL; 111 const char *ext = NULL;
110 unsigned pos; 112 unsigned pos;
127 /* look for that ext */ 129 /* look for that ext */
128 GList *features; 130 GList *features;
129 for(features = jabber_features; features; features = features->next) { 131 for(features = jabber_features; features; features = features->next) {
130 JabberFeature *feat = (JabberFeature*)features->data; 132 JabberFeature *feat = (JabberFeature*)features->data;
131 if(!strcmp(feat->shortname, ext)) { 133 if(!strcmp(feat->shortname, ext)) {
132 SUPPORT_FEATURE(feat->namespace); 134 SUPPORT_FEATURE(feat->namespace);
133 break; 135 break;
134 } 136 }
135 } 137 }
136 if(features == NULL) 138 if(features == NULL)
137 ext = NULL; 139 ext = NULL;
138 } 140 }