# HG changeset patch # User Myhailo Danylenko # Date 1304808004 -10800 # Node ID 30b410060a659d83fbfb4b1654bf805bd2f11cae # Parent d7a61b1745f44ec5c8ee7a6ba42ace24e5597863# Parent 751d06b00558cc38ad7f5d21d9e345eebcfd98cb Merge with McKael repo with fixes diff -r d7a61b1745f4 -r 30b410060a65 .hgignore diff -r d7a61b1745f4 -r 30b410060a65 config.h.in --- a/config.h.in Sat May 07 15:15:30 2011 +0300 +++ b/config.h.in Sun May 08 01:40:04 2011 +0300 @@ -4,6 +4,8 @@ #cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER +#include + #define PROJECT_VERSION ( "${PROJECT_VERSION}" ) #endif diff -r d7a61b1745f4 -r 30b410060a65 disco.c --- a/disco.c Sat May 07 15:15:30 2011 +0300 +++ b/disco.c Sun May 08 01:40:04 2011 +0300 @@ -1,5 +1,5 @@ -/* Copyright 2009 Myhailo Danylenko +/* Copyright 2009,2010 Myhailo Danylenko * * Service discovery requests * @@ -49,7 +49,7 @@ static module_info_t info_disco_dev = { .branch = "dev", - .api = 13, + .api = 20, .version = PROJECT_VERSION, .description = DESCRIPTION, .requires = NULL, @@ -58,7 +58,7 @@ .next = NULL, }; -module_info_t info_disco = { +module_info_t info_disco_0_10_0 = { .branch = "0.10.0", .api = 1, .version = PROJECT_VERSION, @@ -69,6 +69,17 @@ .next = &info_disco_dev, }; +module_info_t info_disco = { + .branch = "0.10.1", + .api = 1, + .version = PROJECT_VERSION, + .description = DESCRIPTION, + .requires = NULL, + .init = disco_init, + .uninit = disco_uninit, + .next = &info_disco_0_10_0, +}; + // // private types // @@ -174,7 +185,7 @@ identities = g_slist_append (identities, identity); } else if (!strcasecmp (node->name, "feature")) features = g_slist_insert_sorted (features, (gpointer) lm_message_node_get_attribute (node, "var"), (GCompareFunc) g_strcmp0); - + // call handler cb -> handler (identities, features, cb -> data); @@ -252,7 +263,7 @@ items = g_slist_append (items, item); } - + // call handler cb -> handler (items, cb -> data); @@ -358,7 +369,7 @@ { disco_info_reply_handler_t *cb = g_new (disco_info_reply_handler_t, 1); - + lhandler = lm_message_handler_new (disco_info_reply_handler, cb, disco_info_reply_handler_destroy_notify); cb -> handler = handler; @@ -407,7 +418,7 @@ { disco_items_reply_handler_t *cb = g_new (disco_items_reply_handler_t, 1); - + lhandler = lm_message_handler_new (disco_items_reply_handler, cb, disco_items_reply_handler_destroy_notify); cb -> handler = handler; @@ -571,7 +582,7 @@ if (info != -1) { char *to = NULL; char *dnode = NULL; - + if (args[0] && args[1]) { char *p = args[1]; @@ -589,12 +600,31 @@ if (args[2]) dnode = to_utf8 (args[2]); } - // XXX send to all resources/current resource? + + if (!to) { + // Use currently selected item, if possible + if (current_buddy) { + gpointer bud = BUDDATA(current_buddy); + if (bud) { + guint type = buddy_gettype (bud); + if (type != ROSTER_TYPE_GROUP && type != ROSTER_TYPE_SPECIAL) + to = g_strdup (buddy_getjid (bud)); // XXX memleak! + } + } + } + + if (!to) { + scr_log_print (LPRINT_NORMAL, "Invalid disco target."); + free_arg_lst (args); + return; + } + + // XXX send to all resources/current resource? { disco_handler_t *cb = g_new (disco_handler_t, 1); - cb -> jid = to ? to : g_strdup (CURRENT_JID); + cb -> jid = to; cb -> node = dnode; if (info) @@ -672,7 +702,7 @@ // completion if (disco_cid) compl_del_category (disco_cid); - + // hook handler hk_del_handler (HOOK_PRE_DISCONNECT, disco_hid); diff -r d7a61b1745f4 -r 30b410060a65 disco.h --- a/disco.h Sat May 07 15:15:30 2011 +0300 +++ b/disco.h Sun May 08 01:40:04 2011 +0300 @@ -1,5 +1,5 @@ -/* Copyright 2009 Myhailo Danylenko +/* Copyright 2009,2010 Myhailo Danylenko * * Service discovery requests *