equal
deleted
inserted
replaced
47 |
47 |
48 #define DESCRIPTION ( "Service discovery requests\nProvides command /disco" ) |
48 #define DESCRIPTION ( "Service discovery requests\nProvides command /disco" ) |
49 |
49 |
50 static module_info_t info_disco_experimental = { |
50 static module_info_t info_disco_experimental = { |
51 .branch = "experimental", |
51 .branch = "experimental", |
52 .api = 15, |
52 #ifndef HAVE_CMD_ID |
|
53 .api = 20, |
|
54 #else |
|
55 .api = 23, |
|
56 #endif |
53 .version = PROJECT_VERSION, |
57 .version = PROJECT_VERSION, |
54 .description = DESCRIPTION, |
58 .description = DESCRIPTION, |
55 .requires = NULL, |
59 .requires = NULL, |
56 .init = disco_init, |
60 .init = disco_init, |
57 .uninit = disco_uninit, |
61 .uninit = disco_uninit, |
94 } disco_handler_t; |
98 } disco_handler_t; |
95 |
99 |
96 // |
100 // |
97 // globals |
101 // globals |
98 // |
102 // |
|
103 |
|
104 #ifdef HAVE_CMD_ID |
|
105 static gpointer disco_cmid = NULL; |
|
106 #endif |
99 |
107 |
100 static guint disco_cid = 0; |
108 static guint disco_cid = 0; |
101 static guint disco_hid = 0; |
109 static guint disco_hid = 0; |
102 static GSList *reply_handlers = NULL; |
110 static GSList *reply_handlers = NULL; |
103 |
111 |
644 |
652 |
645 // hook handler |
653 // hook handler |
646 disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL); |
654 disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL); |
647 |
655 |
648 // command |
656 // command |
|
657 #ifndef HAVE_CMD_ID |
649 cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
658 cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
|
659 #else |
|
660 disco_cmid = cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
|
661 #endif |
650 |
662 |
651 return; |
663 return; |
652 } |
664 } |
653 |
665 |
654 static void disco_uninit (void) |
666 static void disco_uninit (void) |
655 { |
667 { |
656 // command |
668 // command |
|
669 #ifndef HAVE_CMD_ID |
657 cmd_del ("disco"); |
670 cmd_del ("disco"); |
|
671 #else |
|
672 if (disco_cmid) |
|
673 cmd_del (disco_cmid); |
|
674 #endif |
658 |
675 |
659 // completion |
676 // completion |
660 if (disco_cid) |
677 if (disco_cid) |
661 compl_del_category (disco_cid); |
678 compl_del_category (disco_cid); |
662 |
679 |