comparison libpurple/protocols/jabber/disco.c @ 19489:b0733d5d7621

Fixed code indenting, some spaces were still left and now replaced by tabs.
author Andreas Monitzer <pidgin@monitzer.com>
date Tue, 28 Aug 2007 19:03:07 +0000
parents c03e3fe11ea9
children 301f1597d41f
comparison
equal deleted inserted replaced
19488:ebe2d2e71223 19489:b0733d5d7621
100 SUPPORT_FEATURE("http://jabber.org/protocol/si") 100 SUPPORT_FEATURE("http://jabber.org/protocol/si")
101 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") 101 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
102 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") 102 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
103 SUPPORT_FEATURE("urn:xmpp:ping") 103 SUPPORT_FEATURE("urn:xmpp:ping")
104 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns") 104 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns")
105 105
106 if(!node) { /* non-caps disco#info, add all enabled extensions */ 106 if(!node) { /* non-caps disco#info, add all enabled extensions */
107 GList *features; 107 GList *features;
108 for(features = jabber_features; features; features = features->next) { 108 for(features = jabber_features; features; features = features->next) {
109 JabberFeature *feat = (JabberFeature*)features->data; 109 JabberFeature *feat = (JabberFeature*)features->data;
110 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE) 110 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
111 SUPPORT_FEATURE(feat->namespace); 111 SUPPORT_FEATURE(feat->namespace);
112 } 112 }
113 } 113 }
114 } else { 114 } else {
115 const char *ext = NULL; 115 const char *ext = NULL;
116 unsigned pos; 116 unsigned pos;
117 unsigned nodelen = strlen(node); 117 unsigned nodelen = strlen(node);
118 unsigned capslen = strlen(CAPS0115_NODE); 118 unsigned capslen = strlen(CAPS0115_NODE);
119 /* do a basic plausability check */ 119 /* do a basic plausability check */
120 if(nodelen > capslen+1) { 120 if(nodelen > capslen+1) {
121 /* verify that the string is CAPS0115#<ext> and get the pointer to the ext part */ 121 /* verify that the string is CAPS0115#<ext> and get the pointer to the ext part */
122 for(pos = 0; pos < capslen+1; ++pos) { 122 for(pos = 0; pos < capslen+1; ++pos) {
123 if(pos == capslen) { 123 if(pos == capslen) {
124 if(node[pos] == '#') 124 if(node[pos] == '#')
125 ext = &node[pos+1]; 125 ext = &node[pos+1];
126 else 126 else
127 break; 127 break;
128 } else if(node[pos] != CAPS0115_NODE[pos]) 128 } else if(node[pos] != CAPS0115_NODE[pos])
129 break; 129 break;
130 } 130 }
131 131
132 if(ext != NULL) { 132 if(ext != NULL) {
133 /* look for that ext */ 133 /* look for that ext */
134 GList *features; 134 GList *features;
135 for(features = jabber_features; features; features = features->next) { 135 for(features = jabber_features; features; features = features->next) {
136 JabberFeature *feat = (JabberFeature*)features->data; 136 JabberFeature *feat = (JabberFeature*)features->data;
137 if(!strcmp(feat->shortname, ext)) { 137 if(!strcmp(feat->shortname, ext)) {
138 SUPPORT_FEATURE(feat->namespace); 138 SUPPORT_FEATURE(feat->namespace);
139 break; 139 break;
140 } 140 }
141 } 141 }
142 if(features == NULL) 142 if(features == NULL)
143 ext = NULL; 143 ext = NULL;
144 } 144 }
145 } 145 }
146 146
147 if(ext == NULL) { 147 if(ext == NULL) {
148 xmlnode *error, *inf; 148 xmlnode *error, *inf;
149 149
150 /* XXX: gross hack, implement jabber_iq_set_type or something */ 150 /* XXX: gross hack, implement jabber_iq_set_type or something */
151 xmlnode_set_attrib(iq->node, "type", "error"); 151 xmlnode_set_attrib(iq->node, "type", "error");
152 iq->type = JABBER_IQ_ERROR; 152 iq->type = JABBER_IQ_ERROR;
153 153
154 error = xmlnode_new_child(query, "error"); 154 error = xmlnode_new_child(query, "error");
155 xmlnode_set_attrib(error, "code", "404"); 155 xmlnode_set_attrib(error, "code", "404");
156 xmlnode_set_attrib(error, "type", "cancel"); 156 xmlnode_set_attrib(error, "type", "cancel");
157 inf = xmlnode_new_child(error, "item-not-found"); 157 inf = xmlnode_new_child(error, "item-not-found");
158 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); 158 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
159 } 159 }
160 } 160 }
161 161
162 jabber_iq_send(iq); 162 jabber_iq_send(iq);
163 } else if(!strcmp(type, "result")) { 163 } else if(!strcmp(type, "result")) {
164 xmlnode *query = xmlnode_get_child(packet, "query"); 164 xmlnode *query = xmlnode_get_child(packet, "query");
328 for (child = xmlnode_get_child(query, "identity"); child; 328 for (child = xmlnode_get_child(query, "identity"); child;
329 child = xmlnode_get_next_twin(child)) { 329 child = xmlnode_get_next_twin(child)) {
330 const char *category, *type, *name; 330 const char *category, *type, *name;
331 category = xmlnode_get_attrib(child, "category"); 331 category = xmlnode_get_attrib(child, "category");
332 type = xmlnode_get_attrib(child, "type"); 332 type = xmlnode_get_attrib(child, "type");
333 if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) 333 if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep"))
334 js->pep = TRUE; 334 js->pep = TRUE;
335 if (!category || strcmp(category, "server")) 335 if (!category || strcmp(category, "server"))
336 continue; 336 continue;
337 if (!type || strcmp(type, "im")) 337 if (!type || strcmp(type, "im"))
338 continue; 338 continue;
339 339