| 56 } |
56 } |
| 57 |
57 |
| 58 if(!jbr) |
58 if(!jbr) |
| 59 return; |
59 return; |
| 60 |
60 |
| 61 if(jbr->commands) { |
61 /* since the list we just received is complete, wipe the old one */ |
| 62 /* since the list we just received is complete, wipe the old one */ |
62 g_list_free_full(jbr->commands, (GDestroyNotify)jabber_adhoc_commands_free); |
| 63 while(jbr->commands) { |
63 jbr->commands = NULL; |
| 64 JabberAdHocCommands *cmd = jbr->commands->data; |
|
| 65 g_free(cmd->jid); |
|
| 66 g_free(cmd->node); |
|
| 67 g_free(cmd->name); |
|
| 68 g_free(cmd); |
|
| 69 jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); |
|
| 70 } |
|
| 71 } |
|
| 72 |
64 |
| 73 for(item = query->child; item; item = item->next) { |
65 for(item = query->child; item; item = item->next) { |
| 74 JabberAdHocCommands *cmd; |
66 JabberAdHocCommands *cmd; |
| 75 if(item->type != PURPLE_XMLNODE_TYPE_TAG) |
67 if(item->type != PURPLE_XMLNODE_TYPE_TAG) |
| 76 continue; |
68 continue; |
| 239 |
231 |
| 240 if(!query) |
232 if(!query) |
| 241 return; |
233 return; |
| 242 |
234 |
| 243 /* clean current list (just in case there is one) */ |
235 /* clean current list (just in case there is one) */ |
| 244 while(js->commands) { |
236 g_list_free_full(js->commands, (GDestroyNotify)jabber_adhoc_commands_free); |
| 245 JabberAdHocCommands *cmd = js->commands->data; |
237 js->commands = NULL; |
| 246 g_free(cmd->jid); |
|
| 247 g_free(cmd->node); |
|
| 248 g_free(cmd->name); |
|
| 249 g_free(cmd); |
|
| 250 js->commands = g_list_delete_link(js->commands, js->commands); |
|
| 251 } |
|
| 252 |
238 |
| 253 /* re-fill list */ |
239 /* re-fill list */ |
| 254 for(item = query->child; item; item = item->next) { |
240 for(item = query->child; item; item = item->next) { |
| 255 JabberAdHocCommands *cmd; |
241 JabberAdHocCommands *cmd; |
| 256 if(item->type != PURPLE_XMLNODE_TYPE_TAG) |
242 if(item->type != PURPLE_XMLNODE_TYPE_TAG) |