Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/adhoccommands.c @ 18691:54a5fbeadd7c
Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Fri, 13 Jul 2007 15:34:16 +0000 |
parents | 49fe31a64716 |
children | c72d2458b22e |
comparison
equal
deleted
inserted
replaced
18690:fdd07827ecb1 | 18691:54a5fbeadd7c |
---|---|
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 void jabber_adhoc_init_server_commands(JabberStream *js, GList **m) { | 263 void jabber_adhoc_init_server_commands(JabberStream *js, GList **m) { |
264 GList *cmdlst; | 264 GList *cmdlst; |
265 | 265 JabberBuddy *jb; |
266 | |
267 /* also add commands for other clients connected to the same account on another resource */ | |
268 char *accountname = g_strdup_printf("%s@%s", js->user->node, js->user->domain); | |
269 if((jb = jabber_buddy_find(js, accountname, TRUE))) { | |
270 GList *iter; | |
271 for(iter = jb->resources; iter; iter = g_list_next(iter)) { | |
272 JabberBuddyResource *jbr = iter->data; | |
273 GList *riter; | |
274 for(riter = jbr->commands; riter; riter = g_list_next(riter)) { | |
275 JabberAdHocCommands *cmd = riter->data; | |
276 char *cmdname = g_strdup_printf("[%s] %s",jbr->name,cmd->name); | |
277 PurplePluginAction *act = purple_plugin_action_new(cmdname, jabber_adhoc_server_execute); | |
278 act->user_data = cmd; | |
279 *m = g_list_append(*m, act); | |
280 g_free(cmdname); | |
281 } | |
282 } | |
283 } | |
284 g_free(accountname); | |
285 | |
286 /* now add server commands */ | |
266 for(cmdlst = js->commands; cmdlst; cmdlst = g_list_next(cmdlst)) { | 287 for(cmdlst = js->commands; cmdlst; cmdlst = g_list_next(cmdlst)) { |
267 JabberAdHocCommands *cmd = cmdlst->data; | 288 JabberAdHocCommands *cmd = cmdlst->data; |
268 PurplePluginAction *act = purple_plugin_action_new(cmd->name, jabber_adhoc_server_execute); | 289 char *cmdname = g_strdup_printf("[%s] %s",js->user->domain,cmd->name); |
290 PurplePluginAction *act = purple_plugin_action_new(cmdname, jabber_adhoc_server_execute); | |
269 act->user_data = cmd; | 291 act->user_data = cmd; |
270 *m = g_list_append(*m, act); | 292 *m = g_list_append(*m, act); |
271 } | 293 g_free(cmdname); |
272 } | 294 } |
295 } |