splitbuf updates, extended notice support, cleaned up ctcp core processing
This commit is contained in:
parent
65c50f0739
commit
c237b43b15
24 changed files with 185 additions and 178 deletions
|
@ -63,6 +63,8 @@ const char services_bot_modes[]= "+oS";
|
|||
|
||||
ircd_cmd cmd_list[] = {
|
||||
/* Command Function srvmsg */
|
||||
{MSG_PRIVATE, m_privmsg, 0},
|
||||
{MSG_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, m_stats, 0},
|
||||
{MSG_VERSION, m_version, 0},
|
||||
{MSG_MOTD, m_motd, 0},
|
||||
|
|
|
@ -35,6 +35,12 @@ NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rant
|
|||
- Added system to overide the core parse and splitbuf functions for IRCu; will merge
|
||||
back into core when IRCu support complete (M)
|
||||
- Bug fix in NICKV2 for Unreal; realname was not parsed properly (M)
|
||||
- Privmsg checks moved to ircd command lists and core function provided for processing (M)
|
||||
- Add notice check to ircd command lists (M)
|
||||
- Cleaned up bot message and bot chan message handling (M)
|
||||
- Main services bot is not a mod_usr which tidies up command processing and let's NeoStats
|
||||
show up in bot channel lists (M)
|
||||
- Optimise core CTCP checks to avoid unnecessary processing (M)
|
||||
|
||||
* NeoStats * Fish (F) * Version 2.5.14
|
||||
- Fix a bug with HostServ unable to load the database
|
||||
|
|
2
Ircu.c
2
Ircu.c
|
@ -57,6 +57,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, m_privmsg, 0},
|
||||
{MSG_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, m_stats, 0},
|
||||
{MSG_VERSION, m_version, 0},
|
||||
{MSG_MOTD, m_motd, 0},
|
||||
|
|
3
Ircu.h
3
Ircu.h
|
@ -209,9 +209,6 @@
|
|||
#define MSG_POST "POST" /* POS */
|
||||
#define TOK_POST "POST"
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp(MSG_PRIVATE, (msg)) || !strcmp("P", (msg)) || !strcmp("CPRIVMSG", (msg)) || !strcmp("CP", (msg)))
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
|
@ -69,6 +69,8 @@ const char services_bot_modes[]= "+oS";
|
|||
|
||||
ircd_cmd cmd_list[] = {
|
||||
/* Command Function srvmsg */
|
||||
{MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0},
|
||||
{MSG_NOTICE, TOK_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, TOK_STATS, m_stats, 0},
|
||||
{MSG_SETHOST, TOK_SETHOST, m_vhost, 0},
|
||||
{MSG_VERSION, TOK_VERSION, m_version, 0},
|
||||
|
|
|
@ -353,9 +353,6 @@
|
|||
#define MSG_CLIENT "CLIENT"
|
||||
#define MSG_SMODE "SMODE"
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
|
@ -78,6 +78,8 @@ const char services_bot_modes[]= "+oS";
|
|||
|
||||
ircd_cmd cmd_list[] = {
|
||||
/* Command Token Function srvmsg */
|
||||
{MSG_PRIVATE, /*TOK_PRIVATE, */m_privmsg, 0},
|
||||
{MSG_NOTICE, /*TOK_NOTICE, */m_notice, 0},
|
||||
{MSG_STATS, /*TOK_STATS, */m_stats, 0},
|
||||
{MSG_SETHOST, /*TOK_SETHOST, */m_vhost, 0},
|
||||
{MSG_VERSION, /*TOK_VERSION, */m_version, 0},
|
||||
|
|
|
@ -378,9 +378,6 @@
|
|||
#define MSG_CLIENT "CLIENT"
|
||||
#define MSG_SMODE "SMODE"
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* IRCD Specific mode chars */
|
||||
#ifdef ULTIMATE3
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
|
|
4
Unreal.c
4
Unreal.c
|
@ -70,10 +70,12 @@ const char ircd_version[] = "(U32)";
|
|||
#else
|
||||
const char ircd_version[] = "(U31)";
|
||||
#endif
|
||||
const char services_bot_modes[]= "+oSqd";
|
||||
const char services_bot_modes[]= "+oSq";
|
||||
|
||||
ircd_cmd cmd_list[] = {
|
||||
/*Message Token Function usage */
|
||||
{MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0},
|
||||
{MSG_NOTICE, TOK_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, TOK_STATS, m_stats, 0},
|
||||
{MSG_SETHOST, TOK_SETHOST, m_vhost, 0},
|
||||
{MSG_VERSION, TOK_VERSION, m_version, 0},
|
||||
|
|
3
Unreal.h
3
Unreal.h
|
@ -608,9 +608,6 @@
|
|||
#define TOK_BOTSERV "BS"
|
||||
#endif
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
77
commands.c
77
commands.c
|
@ -183,15 +183,15 @@ add_bot_cmd_list(ModUser* bot_ptr, bot_cmd* bot_cmd_list)
|
|||
if(bot_ptr->botcmds == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
/* set the module */
|
||||
SET_SEGV_INMODULE(bot_ptr->modname);
|
||||
|
||||
|
||||
/* Cycle through command list and add them */
|
||||
while(bot_cmd_list->cmd) {
|
||||
add_bot_cmd(bot_ptr->botcmds, bot_cmd_list);
|
||||
bot_cmd_list++;
|
||||
}
|
||||
CLEAR_SEGV_INMODULE();
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,6 @@ del_bot_cmd_list(ModUser* bot_ptr, bot_cmd* bot_cmd_list)
|
|||
if(bot_ptr->botcmds == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
/* set the module */
|
||||
SET_SEGV_INMODULE(bot_ptr->modname);
|
||||
|
||||
|
@ -233,12 +232,8 @@ del_all_bot_cmds(ModUser* bot_ptr)
|
|||
if(bot_ptr->botcmds == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/* set the module */
|
||||
SET_SEGV_INMODULE(bot_ptr->modname);
|
||||
|
||||
|
||||
/* Cycle through command hash and delete each command */
|
||||
hash_scan_begin(&hs, bot_ptr->botcmds);
|
||||
while ((cmdnode = hash_scan_next(&hs)) != NULL) {
|
||||
|
@ -259,20 +254,10 @@ del_all_bot_cmds(ModUser* bot_ptr)
|
|||
int
|
||||
add_services_cmd_list(bot_cmd* bot_cmd_list)
|
||||
{
|
||||
/* init bot hash if not created */
|
||||
if(botcmds == NULL) {
|
||||
botcmds = hash_create(-1, 0, 0);
|
||||
}
|
||||
/* If unable to create hash return failure */
|
||||
if(botcmds == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* Cycle through command list and add them */
|
||||
while(bot_cmd_list->cmd) {
|
||||
add_bot_cmd(botcmds, bot_cmd_list);
|
||||
bot_cmd_list++;
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
ModUser* bot_ptr;
|
||||
|
||||
bot_ptr = findbot(s_Services);
|
||||
return(add_bot_cmd_list(bot_ptr, bot_cmd_list));
|
||||
}
|
||||
|
||||
/** @brief del_services_cmd_list delete a list of commands from the services bot
|
||||
|
@ -282,40 +267,10 @@ add_services_cmd_list(bot_cmd* bot_cmd_list)
|
|||
int
|
||||
del_services_cmd_list(bot_cmd* bot_cmd_list)
|
||||
{
|
||||
/* If no hash return failure */
|
||||
if(botcmds == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* Cycle through command list and delete them */
|
||||
while(bot_cmd_list->cmd) {
|
||||
del_bot_cmd(botcmds, bot_cmd_list);
|
||||
bot_cmd_list++;
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
ModUser* bot_ptr;
|
||||
|
||||
/** @brief servicesbot process services bot command list
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
void
|
||||
servicesbot (char *nick, char **av, int ac)
|
||||
{
|
||||
User *u;
|
||||
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
u = finduser (nick);
|
||||
if (!u) {
|
||||
nlog (LOG_WARNING, LOG_CORE, "servicesbot: unable to find user %s (%s)", nick, s_Services);
|
||||
return;
|
||||
}
|
||||
me.requests++;
|
||||
/* Use fake bot structure so we can use the main command routine */
|
||||
strlcpy(fake_bot.nick, s_Services, MAXNICK);
|
||||
fake_bot.botcmds = botcmds;
|
||||
fake_bot.flags = me.onlyopers ? BOT_FLAG_ONLY_OPERS : 0;
|
||||
run_bot_cmd (&fake_bot, u, av, ac);
|
||||
bot_ptr = findbot(s_Services);
|
||||
return(del_bot_cmd_list(bot_ptr, bot_cmd_list));
|
||||
}
|
||||
|
||||
/** @brief run_bot_cmd process bot command list
|
||||
|
@ -411,20 +366,6 @@ run_bot_cmd (ModUser* bot_ptr, User *u, char **av, int ac)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Trap CTCP commands and silently drop them to avoid unknown command errors
|
||||
* Why bother? Well we might be able to use some of them in the future
|
||||
* so this is mainly a test and we may want to pass some of this onto
|
||||
* SecureServ for a quick trojan check so log attempts to give an indication
|
||||
* of usage.
|
||||
*/
|
||||
if (av[1][0] == '\1') {
|
||||
char* buf;
|
||||
buf = joinbuf(av, ac, 1);
|
||||
nlog (LOG_NORMAL, LOG_MOD, "%s requested CTCP %s", u->nick, buf);
|
||||
free(buf);
|
||||
CLEAR_SEGV_INMODULE();
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* We have run out of commands so report failure */
|
||||
prefmsg (u->nick, bot_ptr->nick, "Syntax error: unknown command: \2%s\2", av[1]);
|
||||
chanalert (bot_ptr->nick, "%s requested %s, but that is an unknown command", u->nick, av[1]);
|
||||
|
|
94
dl.c
94
dl.c
|
@ -39,6 +39,8 @@
|
|||
#include "sqlsrv/rta.h"
|
||||
#endif
|
||||
|
||||
#define MAX_CMD_LINE_LENGTH 350
|
||||
|
||||
/** @brief Module list
|
||||
*
|
||||
*/
|
||||
|
@ -798,6 +800,73 @@ bot_chan_message (char *origin, char **av, int ac)
|
|||
}
|
||||
}
|
||||
|
||||
/** @brief send a message to a channel bot
|
||||
*
|
||||
* @param origin
|
||||
* @param av (note chan string in av[0])
|
||||
* @param ac
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
bot_message (char *origin, char **av, int ac)
|
||||
{
|
||||
User *u;
|
||||
ModUser *mod_usr;
|
||||
|
||||
/* Check command length */
|
||||
if (strnlen (av[1], MAX_CMD_LINE_LENGTH) >= MAX_CMD_LINE_LENGTH) {
|
||||
prefmsg (origin, s_Services, "command line too long!");
|
||||
notice (s_Services, "%s tried to send a very LARGE command, we told them to shove it!", origin);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Trap CTCP commands and silently drop them to avoid unknown command errors
|
||||
* Why bother? Well we might be able to use some of them in the future
|
||||
* so this is mainly a test and we may want to pass some of this onto
|
||||
* SecureServ for a quick trojan check so log attempts to give an indication
|
||||
* of usage.
|
||||
*/
|
||||
if (av[1][0] == '\1') {
|
||||
char* buf;
|
||||
buf = joinbuf(av, ac, 1);
|
||||
nlog (LOG_NORMAL, LOG_MOD, "%s requested CTCP %s", origin, buf);
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
u = finduser (origin);
|
||||
|
||||
if (flood (u)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mod_usr = findbot (av[0]);
|
||||
/* Check to see if any of the Modules have this nick Registered */
|
||||
if (!mod_usr) {
|
||||
nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s not found: %s", mod_usr->nick);
|
||||
return;
|
||||
}
|
||||
nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s", mod_usr->nick);
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
SET_SEGV_INMODULE(mod_usr->modname);
|
||||
if (setjmp (sigvbuf) == 0) {
|
||||
if(mod_usr->function) {
|
||||
mod_usr->function (origin, av, ac);
|
||||
}
|
||||
else {
|
||||
if (!u) {
|
||||
nlog (LOG_WARNING, LOG_CORE, "Unable to finduser %s (%s)", origin, mod_usr->nick);
|
||||
} else {
|
||||
run_bot_cmd(mod_usr, u, av, ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
CLEAR_SEGV_INMODULE();
|
||||
return;
|
||||
}
|
||||
|
||||
/** @brief dump list of module bots and channels
|
||||
*
|
||||
* @param u
|
||||
|
@ -884,6 +953,31 @@ add_mod_user (char *nick, char *mod_name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/** @brief
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ModUser *
|
||||
add_neostats_mod_user (char *nick)
|
||||
{
|
||||
ModUser *mod_usr;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
/* add a brand new user */
|
||||
mod_usr = new_bot (nick);
|
||||
if(mod_usr) {
|
||||
strlcpy (mod_usr->modname, "NeoStats", MAX_MOD_NAME);
|
||||
mod_usr->function = NULL;
|
||||
mod_usr->chanfunc = NULL;
|
||||
mod_usr->botcmds = hash_create(-1, 0, 0);
|
||||
return mod_usr;
|
||||
}
|
||||
nlog (LOG_WARNING, LOG_CORE, "add_neostats_mod_user: Couldn't Add ModuleBot to List");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @brief
|
||||
*
|
||||
* @param
|
||||
|
|
3
dl.h
3
dl.h
|
@ -223,6 +223,7 @@ int unload_module (char *module_name, User * u);
|
|||
int list_modules (User * u, char **av, int ac);
|
||||
int list_bots (User * u, char **av, int ac);
|
||||
ModUser* add_mod_user (char *nick, char *mod_name);
|
||||
ModUser* add_neostats_mod_user (char *nick);
|
||||
int del_mod_user (char *nick);
|
||||
int add_mod_timer (char *func_name, char *timer_name, char *mod_name, int interval);
|
||||
int del_mod_timer (char *timer_name);
|
||||
|
@ -240,6 +241,8 @@ int get_dl_handle (char *mod_name);
|
|||
void add_bot_to_chan (char *bot, char *chan);
|
||||
void del_bot_from_chan (char *bot, char *chan);
|
||||
void bot_chan_message (char *origin, char **av, int ac);
|
||||
void bot_message (char *origin, char **av, int ac);
|
||||
|
||||
int list_bot_chans (User * u, char **av, int ac);
|
||||
int get_mod_num (char *mod_name);
|
||||
void unload_modules(void);
|
||||
|
|
|
@ -61,6 +61,8 @@ 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_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, m_stats, 0},
|
||||
{MSG_VERSION, m_version, 0},
|
||||
{MSG_MOTD, m_motd, 0},
|
||||
|
|
|
@ -214,9 +214,6 @@
|
|||
#define MSG_SJOIN "SJOIN"
|
||||
#define MSG_TBURST "TBURST"
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
127
ircd.c
127
ircd.c
|
@ -46,6 +46,8 @@ static long services_bot_umode= 0;
|
|||
#ifdef NEW_STYLE_SPLITBUF
|
||||
static char privmsgbuffer[BUFSIZE];
|
||||
#endif
|
||||
/* Temp flag for backward compatibility in new splitbuf system */
|
||||
static int SkipModuleFunction = 0;
|
||||
|
||||
static int signon_newbot (const char *nick, const char *user, const char *host, const char *rname, long Umode);
|
||||
|
||||
|
@ -519,16 +521,35 @@ joinbuf (char **av, int ac, int from)
|
|||
*
|
||||
* @return none
|
||||
*/
|
||||
static void
|
||||
m_privmsg (int cmdptr, char* origin, char **av, int ac)
|
||||
void
|
||||
m_notice (char* origin, char **av, int ac, int cmdptr)
|
||||
{
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
int argc;
|
||||
char **argv;
|
||||
argc = split_buf (privmsgbuffer, &argv, 1);
|
||||
ModuleFunction (cmdptr, MSG_NOTICE, origin, argv, argc);
|
||||
free (argv);
|
||||
#else
|
||||
ModuleFunction (cmdptr, MSG_NOTICE, origin, av, ac);
|
||||
#endif
|
||||
SkipModuleFunction = 1;
|
||||
}
|
||||
|
||||
/** @brief process privmsg
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
m_privmsg (char* origin, char **av, int ac, int cmdptr)
|
||||
{
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
int argc;
|
||||
char **argv;
|
||||
#endif
|
||||
char target[64];
|
||||
User *u;
|
||||
ModUser *mod_usr;
|
||||
|
||||
/* its a privmsg, now lets see who too... */
|
||||
if (strstr (av[0], "!")) {
|
||||
|
@ -539,75 +560,21 @@ m_privmsg (int cmdptr, char* origin, char **av, int ac)
|
|||
av[0] = strtok (target, "@");
|
||||
}
|
||||
|
||||
if (!strcasecmp (s_Services, av[0])) {
|
||||
if (flood (finduser (origin))) {
|
||||
return;
|
||||
}
|
||||
/* its to the Internal Services Bot */
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
argc = split_buf (privmsgbuffer, &argv, 1);
|
||||
servicesbot (origin, argv, argc);
|
||||
free (argv);
|
||||
#else
|
||||
servicesbot (origin, av, ac);
|
||||
#endif
|
||||
return;
|
||||
argc = split_buf (privmsgbuffer, &argv, 1);
|
||||
if(av[0][0] == '#') {
|
||||
bot_chan_message (origin, argv, argc);
|
||||
} else {
|
||||
mod_usr = findbot (av[0]);
|
||||
/* Check to see if any of the Modules have this nick Registered */
|
||||
if (mod_usr) {
|
||||
nlog (LOG_DEBUG1, LOG_CORE, "nicks: %s", mod_usr->nick);
|
||||
if (flood (finduser (origin))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check command length */
|
||||
if (strnlen (av[1], MAX_CMD_LINE_LENGTH) >= MAX_CMD_LINE_LENGTH) {
|
||||
prefmsg (origin, s_Services, "command line too long!");
|
||||
notice (s_Services, "%s tried to send a very LARGE command, we told them to shove it!", origin);
|
||||
return;
|
||||
}
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
SET_SEGV_INMODULE(mod_usr->modname);
|
||||
if (setjmp (sigvbuf) == 0) {
|
||||
if(mod_usr->function) {
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
argc = split_buf (privmsgbuffer, &argv, 1);
|
||||
mod_usr->function (origin, argv, argc);
|
||||
free (argv);
|
||||
#else
|
||||
mod_usr->function (origin, av, ac);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
u = finduser (origin);
|
||||
if (!u) {
|
||||
nlog (LOG_WARNING, LOG_CORE, "Unable to finduser %s (%s)", origin, mod_usr->nick);
|
||||
} else {
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
argc = split_buf (privmsgbuffer, &argv, 1);
|
||||
run_bot_cmd(mod_usr, u, argv, argc);
|
||||
free (argv);
|
||||
#else
|
||||
run_bot_cmd(mod_usr, u, av, ac);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
CLEAR_SEGV_INMODULE();
|
||||
return;
|
||||
} else {
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
argc = split_buf (privmsgbuffer, &argv, 1);
|
||||
bot_chan_message (origin, argv, argc);
|
||||
free (argv);
|
||||
#else
|
||||
bot_chan_message (origin, av, ac);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
bot_message (origin, argv, argc);
|
||||
}
|
||||
free (argv);
|
||||
#else
|
||||
if(av[0][0] == '#') {
|
||||
bot_chan_message (origin, av, ac);
|
||||
} else {
|
||||
bot_message (origin, av, ac);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -624,12 +591,7 @@ process_ircd_cmd (int cmdptr, char *cmd, char* origin, char **av, int ac)
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
|
||||
/* If a privmsg, handle it internally */
|
||||
if( is_privmsg(cmd) ) {
|
||||
m_privmsg (cmdptr, origin, av, ac);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%s\n",cmd);
|
||||
for (i = 0; i < ircd_cmdcount; i++) {
|
||||
if (!strcmp (cmd_list[i].name, cmd)
|
||||
#ifdef GOTTOKENSUPPORT
|
||||
|
@ -651,7 +613,10 @@ process_ircd_cmd (int cmdptr, char *cmd, char* origin, char **av, int ac)
|
|||
}
|
||||
#endif
|
||||
/* Send to modules */
|
||||
ModuleFunction (cmdptr, cmd, origin, av, ac);
|
||||
if(!SkipModuleFunction) {
|
||||
ModuleFunction (cmdptr, cmd, origin, av, ac);
|
||||
}
|
||||
SkipModuleFunction = 0;
|
||||
}
|
||||
|
||||
/** @brief parse
|
||||
|
@ -670,6 +635,7 @@ parse (char *line)
|
|||
char **av;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
|
||||
strip (line);
|
||||
strlcpy (recbuf, line, BUFSIZE);
|
||||
if (!(*line))
|
||||
|
@ -700,13 +666,8 @@ parse (char *line)
|
|||
strlcpy (cmd, line, sizeof (cmd));
|
||||
#ifdef NEW_STYLE_SPLITBUF
|
||||
strlcpy (privmsgbuffer, coreLine, BUFSIZE);
|
||||
if(strcmp(cmd,"NOTICE")==0||strcmp(cmd,"B")==0)
|
||||
ac = split_buf (coreLine, &av, 1);
|
||||
else
|
||||
ac = splitbuf (coreLine, &av, 1);
|
||||
#else
|
||||
ac = splitbuf (coreLine, &av, 1);
|
||||
#endif
|
||||
ac = splitbuf (coreLine, &av, 1);
|
||||
process_ircd_cmd (cmdptr, cmd, origin, av, ac);
|
||||
free (av);
|
||||
}
|
||||
|
|
4
ircd.h
4
ircd.h
|
@ -23,8 +23,6 @@
|
|||
#ifndef IRCD_H
|
||||
#define IRCD_H
|
||||
|
||||
#define MAX_CMD_LINE_LENGTH 350
|
||||
|
||||
typedef void (*ircd_cmd_handler) (char *origin, char **argv, int argc, int srv);
|
||||
|
||||
typedef struct ircd_cmd{
|
||||
|
@ -87,6 +85,8 @@ void ns_usr_pong (char *origin, char **argv, int argc);
|
|||
void ns_usr_version (char *origin, char **argv, int argc);
|
||||
void ns_srv_protocol(char *origin, char **argv, int argc);
|
||||
void handle_sjoin (char* tstime, char* channame, char *modes, int offset, char *sjoinchan, char **argv, int argc);
|
||||
void m_privmsg (char* origin, char **av, int ac, int cmdptr);
|
||||
void m_notice (char* origin, char **av, int ac, int cmdptr);
|
||||
|
||||
/* Defined in ircd specific files but common to all */
|
||||
void init_ircd (void);
|
||||
|
|
|
@ -64,6 +64,8 @@ const char services_bot_modes[]= "+oS";
|
|||
|
||||
ircd_cmd cmd_list[] = {
|
||||
/* Command Function srvmsg */
|
||||
{MSG_PRIVATE, m_privmsg, 0},
|
||||
{MSG_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, m_stats, 0},
|
||||
{MSG_SETHOST, m_vhost, 0},
|
||||
{MSG_VERSION, m_version, 0},
|
||||
|
|
|
@ -177,9 +177,6 @@
|
|||
#define MSG_LAG "LAG" /* LAG */
|
||||
#define MSG_LAGTEST "LAGTEST" /* LAGTEST */
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
2
mystic.c
2
mystic.c
|
@ -65,6 +65,8 @@ const char services_bot_modes[]= "+oS";
|
|||
|
||||
ircd_cmd cmd_list[] = {
|
||||
/* Command Function srvmsg */
|
||||
{MSG_PRIVATE, TOK_PRIVATE, m_privmsg, 0},
|
||||
{MSG_NOTICE, TOK_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, TOK_STATS, m_stats, 0},
|
||||
{MSG_SETHOST, TOK_SETHOST, m_vhost, 0},
|
||||
{MSG_VERSION, TOK_VERSION, m_version, 0},
|
||||
|
|
3
mystic.h
3
mystic.h
|
@ -355,9 +355,6 @@
|
|||
#define MSG_LOVESERV "LOVESERV" /* LOVESERV */
|
||||
#define TOK_LOVESERV "!Y" /* 33 + 90 */
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
|
@ -61,6 +61,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, m_privmsg, 0},
|
||||
{MSG_NOTICE, m_notice, 0},
|
||||
{MSG_STATS, m_stats, 0},
|
||||
{MSG_VERSION, m_version, 0},
|
||||
{MSG_MOTD, m_motd, 0},
|
||||
|
|
|
@ -214,9 +214,6 @@
|
|||
#define MSG_SJOIN "SJOIN"
|
||||
#define MSG_TBURST "TBURST"
|
||||
|
||||
/* message macros */
|
||||
#define is_privmsg(msg) ( !strcmp (MSG_PRIVATE, (msg)) || !strcmp ("!", (msg)) )
|
||||
|
||||
/* Umode chars */
|
||||
#define UMODE_CH_LOCOP 'O'
|
||||
#define UMODE_CH_OPER 'o'
|
||||
|
|
|
@ -56,6 +56,9 @@ static int ns_unload (User * u, char **av, int ac);
|
|||
static char quitmsg[BUFSIZE];
|
||||
static char no_reason[]="no reason given";
|
||||
|
||||
#undef NS_ULEVEL_ROOT
|
||||
#define NS_ULEVEL_ROOT 0
|
||||
|
||||
static bot_cmd ns_commands[]=
|
||||
{
|
||||
{"LEVEL", ns_level, 0, 0, ns_help_level, ns_help_level_oneline},
|
||||
|
@ -92,8 +95,13 @@ static bot_cmd ns_commands[]=
|
|||
int
|
||||
init_services(void)
|
||||
{
|
||||
ModUser* bot_ptr;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
/* Add command list to services bot */
|
||||
bot_ptr = add_neostats_mod_user (s_Services);
|
||||
bot_ptr->flags = me.onlyopers ? BOT_FLAG_ONLY_OPERS : 0;
|
||||
bot_ptr->botcmds = hash_create(-1, 0, 0);
|
||||
add_services_cmd_list(ns_commands);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
|
Reference in a new issue