40 |
40 |
41 // |
41 // |
42 // module description |
42 // module description |
43 // |
43 // |
44 |
44 |
45 static void disco_init (void); |
45 void disco_init (void); |
46 static void disco_uninit (void); |
46 void disco_uninit (void); |
47 |
47 |
48 #define DESCRIPTION ( "Service discovery requests\nProvides command /disco" ) |
48 #define DESCRIPTION ( "Service discovery requests\nProvides command /disco" ) |
49 |
|
50 static module_info_t info_disco_experimental = { |
|
51 .branch = "experimental", |
|
52 .api = 27, |
|
53 .version = PROJECT_VERSION, |
|
54 .description = DESCRIPTION, |
|
55 .requires = NULL, |
|
56 .init = disco_init, |
|
57 .uninit = disco_uninit, |
|
58 .next = NULL, |
|
59 }; |
|
60 |
49 |
61 static module_info_t info_disco_dev = { |
50 static module_info_t info_disco_dev = { |
62 .branch = "dev", |
51 .branch = "dev", |
63 .api = 13, |
52 .api = 13, |
64 .version = PROJECT_VERSION, |
53 .version = PROJECT_VERSION, |
65 .description = DESCRIPTION, |
54 .description = DESCRIPTION, |
66 .requires = NULL, |
55 .requires = NULL, |
67 .init = disco_init, |
56 .init = disco_init, |
68 .uninit = disco_uninit, |
57 .uninit = disco_uninit, |
69 .next = &info_disco_experimental, |
58 .next = NULL, |
70 }; |
59 }; |
71 |
60 |
72 module_info_t info_disco = { |
61 module_info_t info_disco = { |
73 .branch = "0.10.0", |
62 .branch = "0.10.0", |
74 .api = 1, |
63 .api = 1, |
646 { |
635 { |
647 disco_unregister_handlers (); |
636 disco_unregister_handlers (); |
648 return HOOK_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
637 return HOOK_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
649 } |
638 } |
650 |
639 |
651 static void disco_init (void) |
640 void disco_init (void) |
652 { |
641 { |
653 // completion |
642 // completion |
654 disco_cid = compl_new_category (); |
643 disco_cid = compl_new_category (); |
655 if (disco_cid) { |
644 if (disco_cid) { |
656 compl_add_category_word (disco_cid, "info"); |
645 compl_add_category_word (disco_cid, "info"); |
659 |
648 |
660 // hook handler |
649 // hook handler |
661 disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL); |
650 disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL); |
662 |
651 |
663 // command |
652 // command |
664 #ifndef HAVE_CMD_ID |
653 #ifndef MCABBER_API_HAVE_CMD_ID |
665 cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
654 cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
666 #else |
655 #else |
667 disco_cmid = cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
656 disco_cmid = cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); |
668 #endif |
657 #endif |
669 |
658 |
670 return; |
659 return; |
671 } |
660 } |
672 |
661 |
673 static void disco_uninit (void) |
662 void disco_uninit (void) |
674 { |
663 { |
675 // command |
664 // command |
676 #ifndef HAVE_CMD_ID |
665 #ifndef MCABBER_API_HAVE_CMD_ID |
677 cmd_del ("disco"); |
666 cmd_del ("disco"); |
678 #else |
667 #else |
679 if (disco_cmid) |
668 if (disco_cmid) |
680 cmd_del (disco_cmid); |
669 cmd_del (disco_cmid); |
681 #endif |
670 #endif |