From c7b692cfa7a9c2250afa86c861ffd41f69999b17 Mon Sep 17 00:00:00 2001 From: Mark <> Date: Wed, 4 Feb 2004 23:36:43 +0000 Subject: [PATCH] begin depreciation of __module_functions via warning comments and add some new events to events.h to be implemented for 2.5.15 release --- Bahamut.c | 2 +- Ircu.c | 4 ++-- QuantumIRCd.c | 2 +- Ultimate.c | 2 +- Unreal.c | 2 +- Viagra.c | 2 +- dl/modules.txt | 10 +++++++++- dl/template/template.c | 33 +++++++++++---------------------- events.h | 30 +++++++++++++++++++++++++++++- hybrid7.c | 2 +- ircd.c | 2 +- ircd.h | 2 +- liquidircd.c | 2 +- mystic.c | 2 +- neoircd.c | 2 +- 15 files changed, 62 insertions(+), 37 deletions(-) diff --git a/Bahamut.c b/Bahamut.c index eb7a554a..de337837 100644 --- a/Bahamut.c +++ b/Bahamut.c @@ -57,7 +57,7 @@ const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, m_private, 0}, {MSG_NOTICE, m_notice, 0}, {MSG_STATS, m_stats, 0}, {MSG_VERSION, m_version, 0}, diff --git a/Ircu.c b/Ircu.c index 04ab6d1e..aca47b68 100644 --- a/Ircu.c +++ b/Ircu.c @@ -56,8 +56,8 @@ const char services_bot_modes[]= "+oS"; /* this is the command list and associated functions to run */ ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0}, - {MSG_CPRIVMSG, TOK_CPRIVMSG, m_privmsg, 0}, + {MSG_PRIVATE, TOK_PRIVATE, m_private, 0}, + {MSG_CPRIVMSG, TOK_CPRIVMSG, m_private, 0}, {MSG_NOTICE, TOK_NOTICE, m_notice, 0}, {MSG_CNOTICE, TOK_CNOTICE, m_notice, 0}, {MSG_STATS, TOK_STATS, m_stats, 0}, diff --git a/QuantumIRCd.c b/QuantumIRCd.c index 1b1d0479..ce703852 100644 --- a/QuantumIRCd.c +++ b/QuantumIRCd.c @@ -63,7 +63,7 @@ const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, TOK_PRIVATE, m_private, 0}, {MSG_NOTICE, TOK_NOTICE, m_notice, 0}, {MSG_STATS, TOK_STATS, m_stats, 0}, {MSG_SETHOST, TOK_SETHOST, m_vhost, 0}, diff --git a/Ultimate.c b/Ultimate.c index aa0c448f..0beb0e8c 100644 --- a/Ultimate.c +++ b/Ultimate.c @@ -77,7 +77,7 @@ const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { /* Command Token Function srvmsg */ - {MSG_PRIVATE, /*TOK_PRIVATE, */m_privmsg, 0}, + {MSG_PRIVATE, /*TOK_PRIVATE, */m_private, 0}, {MSG_NOTICE, /*TOK_NOTICE, */m_notice, 0}, {MSG_STATS, /*TOK_STATS, */m_stats, 0}, {MSG_SETHOST, /*TOK_SETHOST, */m_vhost, 0}, diff --git a/Unreal.c b/Unreal.c index 141f3d1a..b5a4cfe0 100644 --- a/Unreal.c +++ b/Unreal.c @@ -71,7 +71,7 @@ const char services_bot_modes[]= "+oSq"; ircd_cmd cmd_list[] = { /*Message Token Function usage */ - {MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, TOK_PRIVATE, m_private, 0}, {MSG_NOTICE, TOK_NOTICE, m_notice, 0}, {MSG_STATS, TOK_STATS, m_stats, 0}, {MSG_SETHOST, TOK_SETHOST, m_vhost, 0}, diff --git a/Viagra.c b/Viagra.c index 0c09cb51..99f8b824 100755 --- a/Viagra.c +++ b/Viagra.c @@ -63,7 +63,7 @@ const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, m_private, 0}, {MSG_NOTICE, m_notice, 0}, {MSG_STATS, m_stats, 0}, {MSG_VERSION, m_version, 0}, diff --git a/dl/modules.txt b/dl/modules.txt index 6e409075..9e7e6ef1 100644 --- a/dl/modules.txt +++ b/dl/modules.txt @@ -90,7 +90,15 @@ to check that they are compatible. We also need to export a list of any responses to IRCd commands sent by users to our modules that we wish to support e.g. /VERSION mymodule. This -is optional. +is optional. + +******************************** WARNING ******************************** +This table is optional but depreciated. You should respond to module +events to be portable across all ircds and only use this table as a +last resort if a module event is not available. This table will be +removed from operation in a future release. If you need to use this +table for anything, tell us so we can add an appropiate event handler. +******************************** WARNING ******************************** NeoStats, and many IRCD's use tokens now, and the strings differ between IRCds so a hard coded string such as "VERSION" might not always work. diff --git a/dl/template/template.c b/dl/template/template.c index 2d1e6d02..c8ce1434 100755 --- a/dl/template/template.c +++ b/dl/template/template.c @@ -40,35 +40,24 @@ char s_module_bot_name[MAXNICK]; * This structure is required for your module to load and run on NeoStats */ ModuleInfo __module_info = { - "example", - "example Module Description", - "version 1.0", + "Template", + "Template Module Description", + "Version 1.0", __DATE__, __TIME__ }; -/** printf version information - * respond to the /VERSION command on IRC with this text - * This is recommended for your module to load and run on NeoStats - */ -int new_m_version(char *origin, char **av, int ac) -{ - numeric(351, origin, "Module Template Loaded, Version: %s %s %s", - __module_info.module_version, __module_info.module_build_date, - __module_info.module_build_time); - return 0; -} - /** Module function list * A list of IRCd (server) commands that we will respond to - * e.g. VERSION - * This table is optional +******************************** WARNING ******************************** +This table is optional but depreciated. You should respond to module +events to be portable across all ircds and only use this table as a +last resort if a module event is not available. This table will be +removed from operation in a future release. If you need to use this +table for anything, tell us so we can add an appropiate event handler. +******************************** WARNING ******************************** */ Functions __module_functions[] = { - {MSG_VERSION, new_m_version, 1}, -#ifdef GOTTOKENSUPPORT - {TOK_VERSION, new_m_version, 1}, -#endif {NULL, NULL, 0} }; @@ -127,7 +116,7 @@ static int Online(char **av, int ac) /** Module event list * What events we will act on * This is required if you want your module to respond to events on IRC - * see modules.txt for a list of all events available + * see events.h for a list of all events available */ EventFnList __module_events[] = { {EVENT_ONLINE, Online}, diff --git a/events.h b/events.h index 1194c4a9..f104b301 100644 --- a/events.h +++ b/events.h @@ -185,9 +185,37 @@ */ #define EVENT_CLIENTVERSION "CLIENTVERSION" - /* CHANMODE params are: * channel name * mode string */ #define EVENT_CHANMODE "CHANMODE" + +/* PRIVATE params are: + * from nick + * to nick + * message + */ +#define EVENT_PRIVATE "PRIVATE" + +/* NOTICE params are: + * from nick + * to nick + * message + */ +#define EVENT_NOTICE "NOTICE" + +/* CPRIVATE params are: + * from nick + * to channel + * message + */ +#define EVENT_CPRIVATE "CPRIVATE" + +/* CNOTICE params are: + * from nick + * to channel + * message + */ +#define EVENT_CNOTICE "CNOTICE" + diff --git a/hybrid7.c b/hybrid7.c index 635765f8..5f14c309 100644 --- a/hybrid7.c +++ b/hybrid7.c @@ -56,7 +56,7 @@ const char services_bot_modes[]= "+o"; /* this is the command list and associated functions to run */ ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, m_private, 0}, {MSG_NOTICE, m_notice, 0}, {MSG_STATS, m_stats, 0}, {MSG_VERSION, m_version, 0}, diff --git a/ircd.c b/ircd.c index 68315ef3..dbef7066 100644 --- a/ircd.c +++ b/ircd.c @@ -539,7 +539,7 @@ m_notice (char* origin, char **av, int ac, int cmdptr) * @return none */ void -m_privmsg (char* origin, char **av, int ac, int cmdptr) +m_private (char* origin, char **av, int ac, int cmdptr) { #ifndef IRCU int argc; diff --git a/ircd.h b/ircd.h index 72dfef70..d526cb43 100644 --- a/ircd.h +++ b/ircd.h @@ -80,7 +80,7 @@ long UmodeStringToMask(const char* UmodeString, long Umode); char* SmodeMaskToString(const long Umode); long SmodeStringToMask(const char* UmodeString, long Smode); int init_services_bot (void); -void m_privmsg (char* origin, char **av, int ac, int cmdptr); +void m_private (char* origin, char **av, int ac, int cmdptr); void m_notice (char* origin, char **av, int ac, int cmdptr); void do_motd (const char* nick, const char *remoteserver); void do_admin (const char* nick, const char *remoteserver); diff --git a/liquidircd.c b/liquidircd.c index d01bfe85..6418199e 100644 --- a/liquidircd.c +++ b/liquidircd.c @@ -59,7 +59,7 @@ const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, m_private, 0}, {MSG_NOTICE, m_notice, 0}, {MSG_STATS, m_stats, 0}, {MSG_SETHOST, m_vhost, 0}, diff --git a/mystic.c b/mystic.c index 3138fe23..a57eeef2 100644 --- a/mystic.c +++ b/mystic.c @@ -59,7 +59,7 @@ const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, TOK_PRIVATE, m_private, 0}, {MSG_NOTICE, TOK_NOTICE, m_notice, 0}, {MSG_STATS, TOK_STATS, m_stats, 0}, {MSG_SETHOST, TOK_SETHOST, m_vhost, 0}, diff --git a/neoircd.c b/neoircd.c index 6f7c1ff0..6ea191ec 100644 --- a/neoircd.c +++ b/neoircd.c @@ -56,7 +56,7 @@ const char services_bot_modes[]= "+oS"; /* this is the command list and associated functions to run */ ircd_cmd cmd_list[] = { /* Command Function srvmsg */ - {MSG_PRIVATE, m_privmsg, 0}, + {MSG_PRIVATE, m_private, 0}, {MSG_NOTICE, m_notice, 0}, {MSG_STATS, m_stats, 0}, {MSG_VERSION, m_version, 0},