Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/caps.c @ 25443:5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
xmpp branches.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 02 Mar 2009 06:37:05 +0000 |
parents | d79c30d1582a |
children | c4fd9222dda1 ff4212a5268f ae41d8e827e3 |
comparison
equal
deleted
inserted
replaced
25442:13574de83636 | 25443:5f9a24d1c25e |
---|---|
49 | 49 |
50 static guint jabber_caps_hash(gconstpointer key) { | 50 static guint jabber_caps_hash(gconstpointer key) { |
51 const JabberCapsKey *name = key; | 51 const JabberCapsKey *name = key; |
52 guint nodehash = g_str_hash(name->node); | 52 guint nodehash = g_str_hash(name->node); |
53 guint verhash = g_str_hash(name->ver); | 53 guint verhash = g_str_hash(name->ver); |
54 | 54 |
55 return nodehash ^ verhash; | 55 return nodehash ^ verhash; |
56 } | 56 } |
57 | 57 |
58 static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { | 58 static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { |
59 const JabberCapsKey *name1 = v1; | 59 const JabberCapsKey *name1 = v1; |
75 JabberCapsIdentity *id = valuestruct->identities->data; | 75 JabberCapsIdentity *id = valuestruct->identities->data; |
76 g_free(id->category); | 76 g_free(id->category); |
77 g_free(id->type); | 77 g_free(id->type); |
78 g_free(id->name); | 78 g_free(id->name); |
79 g_free(id); | 79 g_free(id); |
80 | 80 |
81 valuestruct->identities = g_list_delete_link(valuestruct->identities,valuestruct->identities); | 81 valuestruct->identities = g_list_delete_link(valuestruct->identities,valuestruct->identities); |
82 } | 82 } |
83 while(valuestruct->features) { | 83 while(valuestruct->features) { |
84 g_free(valuestruct->features->data); | 84 g_free(valuestruct->features->data); |
85 valuestruct->features = g_list_delete_link(valuestruct->features,valuestruct->features); | 85 valuestruct->features = g_list_delete_link(valuestruct->features,valuestruct->features); |
94 JabberCapsIdentity *id = valuestruct->identities->data; | 94 JabberCapsIdentity *id = valuestruct->identities->data; |
95 g_free(id->category); | 95 g_free(id->category); |
96 g_free(id->type); | 96 g_free(id->type); |
97 g_free(id->name); | 97 g_free(id->name); |
98 g_free(id); | 98 g_free(id); |
99 | 99 |
100 valuestruct->identities = g_list_delete_link(valuestruct->identities,valuestruct->identities); | 100 valuestruct->identities = g_list_delete_link(valuestruct->identities,valuestruct->identities); |
101 } | 101 } |
102 while(valuestruct->features) { | 102 while(valuestruct->features) { |
103 g_free(valuestruct->features->data); | 103 g_free(valuestruct->features->data); |
104 valuestruct->features = g_list_delete_link(valuestruct->features,valuestruct->features); | 104 valuestruct->features = g_list_delete_link(valuestruct->features,valuestruct->features); |
122 | 122 |
123 if (strcmp(capsdata->name, "capabilities") != 0) { | 123 if (strcmp(capsdata->name, "capabilities") != 0) { |
124 xmlnode_free(capsdata); | 124 xmlnode_free(capsdata); |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 for(client = capsdata->child; client; client = client->next) { | 128 for(client = capsdata->child; client; client = client->next) { |
129 if(client->type != XMLNODE_TYPE_TAG) | 129 if(client->type != XMLNODE_TYPE_TAG) |
130 continue; | 130 continue; |
131 if(!strcmp(client->name, "client")) { | 131 if(!strcmp(client->name, "client")) { |
132 JabberCapsKey *key = g_new0(JabberCapsKey, 1); | 132 JabberCapsKey *key = g_new0(JabberCapsKey, 1); |
145 value->features = g_list_append(value->features,g_strdup(var)); | 145 value->features = g_list_append(value->features,g_strdup(var)); |
146 } else if(!strcmp(child->name,"identity")) { | 146 } else if(!strcmp(child->name,"identity")) { |
147 const char *category = xmlnode_get_attrib(child, "category"); | 147 const char *category = xmlnode_get_attrib(child, "category"); |
148 const char *type = xmlnode_get_attrib(child, "type"); | 148 const char *type = xmlnode_get_attrib(child, "type"); |
149 const char *name = xmlnode_get_attrib(child, "name"); | 149 const char *name = xmlnode_get_attrib(child, "name"); |
150 | 150 |
151 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1); | 151 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1); |
152 id->category = g_strdup(category); | 152 id->category = g_strdup(category); |
153 id->type = g_strdup(type); | 153 id->type = g_strdup(type); |
154 id->name = g_strdup(name); | 154 id->name = g_strdup(name); |
155 | 155 |
156 value->identities = g_list_append(value->identities,id); | 156 value->identities = g_list_append(value->identities,id); |
157 } else if(!strcmp(child->name,"ext")) { | 157 } else if(!strcmp(child->name,"ext")) { |
158 const char *identifier = xmlnode_get_attrib(child, "identifier"); | 158 const char *identifier = xmlnode_get_attrib(child, "identifier"); |
159 if(identifier) { | 159 if(identifier) { |
160 xmlnode *extchild; | 160 xmlnode *extchild; |
161 | 161 |
162 JabberCapsValueExt *extvalue = g_new0(JabberCapsValueExt, 1); | 162 JabberCapsValueExt *extvalue = g_new0(JabberCapsValueExt, 1); |
163 | 163 |
164 for(extchild = child->child; extchild; extchild = extchild->next) { | 164 for(extchild = child->child; extchild; extchild = extchild->next) { |
165 if(extchild->type != XMLNODE_TYPE_TAG) | 165 if(extchild->type != XMLNODE_TYPE_TAG) |
166 continue; | 166 continue; |
167 if(!strcmp(extchild->name,"feature")) { | 167 if(!strcmp(extchild->name,"feature")) { |
168 const char *var = xmlnode_get_attrib(extchild, "var"); | 168 const char *var = xmlnode_get_attrib(extchild, "var"); |
171 extvalue->features = g_list_append(extvalue->features,g_strdup(var)); | 171 extvalue->features = g_list_append(extvalue->features,g_strdup(var)); |
172 } else if(!strcmp(extchild->name,"identity")) { | 172 } else if(!strcmp(extchild->name,"identity")) { |
173 const char *category = xmlnode_get_attrib(extchild, "category"); | 173 const char *category = xmlnode_get_attrib(extchild, "category"); |
174 const char *type = xmlnode_get_attrib(extchild, "type"); | 174 const char *type = xmlnode_get_attrib(extchild, "type"); |
175 const char *name = xmlnode_get_attrib(extchild, "name"); | 175 const char *name = xmlnode_get_attrib(extchild, "name"); |
176 | 176 |
177 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1); | 177 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1); |
178 id->category = g_strdup(category); | 178 id->category = g_strdup(category); |
179 id->type = g_strdup(type); | 179 id->type = g_strdup(type); |
180 id->name = g_strdup(name); | 180 id->name = g_strdup(name); |
181 | 181 |
182 extvalue->identities = g_list_append(extvalue->identities,id); | 182 extvalue->identities = g_list_append(extvalue->identities,id); |
183 } | 183 } |
184 } | 184 } |
185 g_hash_table_replace(value->ext, g_strdup(identifier), extvalue); | 185 g_hash_table_replace(value->ext, g_strdup(identifier), extvalue); |
186 } | 186 } |
224 xmlnode *client = xmlnode_new_child(root,"client"); | 224 xmlnode *client = xmlnode_new_child(root,"client"); |
225 GList *iter; | 225 GList *iter; |
226 | 226 |
227 xmlnode_set_attrib(client,"node",clientinfo->node); | 227 xmlnode_set_attrib(client,"node",clientinfo->node); |
228 xmlnode_set_attrib(client,"ver",clientinfo->ver); | 228 xmlnode_set_attrib(client,"ver",clientinfo->ver); |
229 | 229 |
230 for(iter = props->identities; iter; iter = g_list_next(iter)) { | 230 for(iter = props->identities; iter; iter = g_list_next(iter)) { |
231 JabberCapsIdentity *id = iter->data; | 231 JabberCapsIdentity *id = iter->data; |
232 xmlnode *identity = xmlnode_new_child(client, "identity"); | 232 xmlnode *identity = xmlnode_new_child(client, "identity"); |
233 xmlnode_set_attrib(identity, "category", id->category); | 233 xmlnode_set_attrib(identity, "category", id->category); |
234 xmlnode_set_attrib(identity, "type", id->type); | 234 xmlnode_set_attrib(identity, "type", id->type); |
239 for(iter = props->features; iter; iter = g_list_next(iter)) { | 239 for(iter = props->features; iter; iter = g_list_next(iter)) { |
240 const char *feat = iter->data; | 240 const char *feat = iter->data; |
241 xmlnode *feature = xmlnode_new_child(client, "feature"); | 241 xmlnode *feature = xmlnode_new_child(client, "feature"); |
242 xmlnode_set_attrib(feature, "var", feat); | 242 xmlnode_set_attrib(feature, "var", feat); |
243 } | 243 } |
244 | 244 |
245 g_hash_table_foreach(props->ext,jabber_caps_store_ext,client); | 245 g_hash_table_foreach(props->ext,jabber_caps_store_ext,client); |
246 } | 246 } |
247 | 247 |
248 static void jabber_caps_store(void) { | 248 static void jabber_caps_store(void) { |
249 char *str; | 249 char *str; |
279 JabberCapsIdentity *id = iter->data; | 279 JabberCapsIdentity *id = iter->data; |
280 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1); | 280 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1); |
281 newid->category = g_strdup(id->category); | 281 newid->category = g_strdup(id->category); |
282 newid->type = g_strdup(id->type); | 282 newid->type = g_strdup(id->type); |
283 newid->name = g_strdup(id->name); | 283 newid->name = g_strdup(id->name); |
284 | 284 |
285 result->identities = g_list_append(result->identities,newid); | 285 result->identities = g_list_append(result->identities,newid); |
286 } | 286 } |
287 for(iter = caps->features; iter; iter = g_list_next(iter)) { | 287 for(iter = caps->features; iter; iter = g_list_next(iter)) { |
288 const char *feat = iter->data; | 288 const char *feat = iter->data; |
289 char *newfeat = g_strdup(feat); | 289 char *newfeat = g_strdup(feat); |
290 | 290 |
291 result->features = g_list_append(result->features,newfeat); | 291 result->features = g_list_append(result->features,newfeat); |
292 } | 292 } |
293 | 293 |
294 for(iter = ext; iter; iter = g_list_next(iter)) { | 294 for(iter = ext; iter; iter = g_list_next(iter)) { |
295 const char *extname = iter->data; | 295 const char *extname = iter->data; |
296 JabberCapsValueExt *extinfo = g_hash_table_lookup(caps->ext,extname); | 296 JabberCapsValueExt *extinfo = g_hash_table_lookup(caps->ext,extname); |
297 | 297 |
298 if(extinfo) { | 298 if(extinfo) { |
299 GList *iter2; | 299 GList *iter2; |
300 for(iter2 = extinfo->identities; iter2; iter2 = g_list_next(iter2)) { | 300 for(iter2 = extinfo->identities; iter2; iter2 = g_list_next(iter2)) { |
301 JabberCapsIdentity *id = iter2->data; | 301 JabberCapsIdentity *id = iter2->data; |
302 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1); | 302 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1); |
303 newid->category = g_strdup(id->category); | 303 newid->category = g_strdup(id->category); |
304 newid->type = g_strdup(id->type); | 304 newid->type = g_strdup(id->type); |
305 newid->name = g_strdup(id->name); | 305 newid->name = g_strdup(id->name); |
306 | 306 |
307 result->identities = g_list_append(result->identities,newid); | 307 result->identities = g_list_append(result->identities,newid); |
308 } | 308 } |
309 for(iter2 = extinfo->features; iter2; iter2 = g_list_next(iter2)) { | 309 for(iter2 = extinfo->features; iter2; iter2 = g_list_next(iter2)) { |
310 const char *feat = iter2->data; | 310 const char *feat = iter2->data; |
311 char *newfeat = g_strdup(feat); | 311 char *newfeat = g_strdup(feat); |
312 | 312 |
313 result->features = g_list_append(result->features,newfeat); | 313 result->features = g_list_append(result->features,newfeat); |
314 } | 314 } |
315 } | 315 } |
316 } | 316 } |
317 return result; | 317 return result; |
324 JabberCapsIdentity *id = clientinfo->identities->data; | 324 JabberCapsIdentity *id = clientinfo->identities->data; |
325 g_free(id->category); | 325 g_free(id->category); |
326 g_free(id->type); | 326 g_free(id->type); |
327 g_free(id->name); | 327 g_free(id->name); |
328 g_free(id); | 328 g_free(id); |
329 | 329 |
330 clientinfo->identities = g_list_delete_link(clientinfo->identities,clientinfo->identities); | 330 clientinfo->identities = g_list_delete_link(clientinfo->identities,clientinfo->identities); |
331 } | 331 } |
332 while(clientinfo->features) { | 332 while(clientinfo->features) { |
333 char *feat = clientinfo->features->data; | 333 char *feat = clientinfo->features->data; |
334 g_free(feat); | 334 g_free(feat); |
335 | 335 |
336 clientinfo->features = g_list_delete_link(clientinfo->features,clientinfo->features); | 336 clientinfo->features = g_list_delete_link(clientinfo->features,clientinfo->features); |
337 } | 337 } |
338 | 338 |
339 g_free(clientinfo); | 339 g_free(clientinfo); |
340 } | 340 } |
341 | 341 |
342 typedef struct _jabber_caps_cbplususerdata { | 342 typedef struct _jabber_caps_cbplususerdata { |
343 jabber_caps_get_info_cb cb; | 343 jabber_caps_get_info_cb cb; |
344 gpointer user_data; | 344 gpointer user_data; |
345 | 345 |
346 char *who; | 346 char *who; |
347 char *node; | 347 char *node; |
348 char *ver; | 348 char *ver; |
349 GList *ext; | 349 GList *ext; |
350 unsigned extOutstanding; | 350 unsigned extOutstanding; |