add set topic support

This commit is contained in:
Mark 2005-04-30 22:09:25 +00:00
parent 3328296ea5
commit 77d9649d30
12 changed files with 668 additions and 468 deletions

4
.gitattributes vendored
View file

@ -401,7 +401,11 @@ modules/ircdauth/ircdauth.c -text
modules/ircdauth/ircdauth.vcproj -text
modules/modules.txt -text
modules/nstest/Makefile.am -text
modules/nstest/commands.c -text
modules/nstest/commands.h -text
modules/nstest/events.c -text
modules/nstest/main.c -text
modules/nstest/main.h -text
modules/nstest/nstest.vcproj -text
modules/operlog/Makefile.am -text
modules/operlog/Makefile.in -text

View file

@ -4,6 +4,7 @@ Anything we add/remove/fix/change is in here (even our rants)
Fish (F), Mark (M), DeadNotBuried (D)
===============================================================================
* NeoStats * Version 3.0.a3-dev
- Add support to set topic from NeoStats. (M)
- Add _m_ignorecommand function for protocol modules to silently drop messages
that they receive but require no further processing by NeoStats. (M).
- Add seperate protocol files for IRCu and variants rathe than require users

View file

@ -1180,6 +1180,8 @@ EXPORTFUNC int irc_join( const Bot *botptr, const char *chan, const char *chanmo
EXPORTFUNC int irc_part( const Bot *botptr, const char *chan, const char *quitmsg );
EXPORTFUNC int irc_kick( const Bot *botptr, const char *chan, const char *target, const char *reason );
EXPORTFUNC int irc_invite( const Bot *botptr, const Client *target, const char *chan );
EXPORTFUNC int irc_topic( const Bot *botptr, const Channel *channel, const char *topic );
EXPORTFUNC int irc_cloakhost( const Bot *botptr );
EXPORTFUNC int irc_setname( const Bot *botptr, const char *realname );

View file

@ -135,6 +135,8 @@ MSGDEF( MSG_KICK );
MSGDEF( TOK_KICK );
MSGDEF( MSG_INVITE );
MSGDEF( TOK_INVITE );
MSGDEF( MSG_TOPIC );
MSGDEF( TOK_TOPIC );
MSGDEF( MSG_PING );
MSGDEF( TOK_PING );
MSGDEF( MSG_PONG );
@ -343,6 +345,7 @@ MODULEFUNC void send_quit( const char *source, const char *quitmsg );
MODULEFUNC void send_kill( const char *source, const char *target, const char *reason );
MODULEFUNC void send_kick( const char *source, const char *chan, const char *target, const char *reason );
MODULEFUNC void send_invite( const char *source, const char *target, const char *chan );
MODULEFUNC void send_topic( const char *source, const char *channel, const char *topic );
MODULEFUNC void send_svskill( const char *source, const char *target, const char *reason );
MODULEFUNC void send_svsmode( const char *source, const char *target, const char *modes );
MODULEFUNC void send_svshost( const char *source, const char *target, const char *vhost );

105
modules/nstest/commands.c Executable file
View file

@ -0,0 +1,105 @@
/* NeoStats - IRC Statistical Services
** Copyright (c) 2005 Mark Hetherington
** http://www.neostats.net/
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
** USA
**
** NeoStats CVS Identification
** $Id$
*/
#include "neostats.h"
#include "main.h"
char testchannel[MAXCHANLEN];
const char ns_help_dummy_oneline[] ="dummy";
const char *ns_help_dummy[] = {
"dummy",
NULL
};
static int ns_cmd_ctcptest( CmdParams *cmdparams );
static int ns_cmd_chantest( CmdParams *cmdparams );
/** Bot pointer */
static Bot *ns_testbot;
/** Bot setting table */
bot_setting ns_settings[] =
{
{"TESTCHANNEL", testchannel, SET_TYPE_CHANNEL, 0, MAXCHANLEN, NS_ULEVEL_ADMIN, NULL, ns_help_dummy, NULL,( void* )"#test" },
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
};
/** Bot comand table */
bot_cmd ns_commands[]=
{
{"CTCPTEST",ns_cmd_ctcptest,0, NS_ULEVEL_LOCOPER, ns_help_dummy, ns_help_dummy_oneline },
{"CHANTEST",ns_cmd_chantest,0, NS_ULEVEL_LOCOPER, ns_help_dummy, ns_help_dummy_oneline },
{NULL, NULL, 0, 0, NULL, NULL}
};
/** BotInfo */
static BotInfo ns_testbotinfo =
{
"nstestbot",
"nstestbot",
"ns",
BOT_COMMON_HOST,
"nstest",
0,
NULL,
NULL,
};
static int ns_cmd_ctcptest( CmdParams *cmdparams )
{
irc_chanalert( ns_bot, "Testing CTCP VERSION request" );
irc_ctcp_version_req( ns_bot, cmdparams->source );
irc_chanalert( ns_bot, "Testing CTCP PING request" );
irc_ctcp_ping_req( ns_bot, cmdparams->source );
irc_chanalert( ns_bot, "Testing CTCP FINGER request" );
irc_ctcp_finger_req( ns_bot, cmdparams->source );
irc_chanalert( ns_bot, "Testing CTCP ACTION request" );
irc_ctcp_action_req( ns_bot, cmdparams->source, "test action" );
irc_chanalert( ns_bot, "Testing CTCP TIME request" );
irc_ctcp_time_req( ns_bot, cmdparams->source );
return NS_SUCCESS;
}
static int ns_cmd_chantest( CmdParams *cmdparams )
{
irc_chanalert( ns_bot, "Testing AddBot" );
ns_testbot = AddBot( &ns_testbotinfo );
if( !ns_testbot )
{
return NS_FAILURE;
}
irc_chanalert( ns_bot, "Testing join" );
irc_join( ns_testbot, testchannel, NULL );
irc_chanalert( ns_bot, "Testing invite" );
irc_invite( ns_testbot, cmdparams->source, testchannel );
irc_chanalert( ns_bot, "Testing CTCP ACTION" );
irc_ctcp_action_req( ns_bot, testchannel, "test action" );
irc_chanalert( ns_bot, "Testing topic" );
irc_topic( ns_testbot, FindChannel( testchannel ), "Test topic" );
irc_chanalert( ns_bot, "Testing part" );
irc_part( ns_testbot, testchannel, "quit" );
irc_chanalert( ns_bot, "Testing quit" );
irc_quit( ns_testbot, "quit" );
return NS_SUCCESS;
}

28
modules/nstest/commands.h Executable file
View file

@ -0,0 +1,28 @@
/* NeoStats - IRC Statistical Services
** Copyright (c) 2005 Mark Hetherington
** http://www.neostats.net/
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
** USA
**
** NeoStats CVS Identification
** $Id$
*/
/** Bot setting table */
extern bot_setting ns_settings[];
/** Bot comand table */
extern bot_cmd ns_commands[];

455
modules/nstest/events.c Executable file
View file

@ -0,0 +1,455 @@
/* NeoStats - IRC Statistical Services
** Copyright (c) 2005 Mark Hetherington
** http://www.neostats.net/
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
** USA
**
** NeoStats CVS Identification
** $Id$
*/
#include "neostats.h"
#include "main.h"
static int ns_event_moduleload( CmdParams *cmdparams );
static int ns_event_moduleunload( CmdParams *cmdparams );
static int ns_event_server( CmdParams *cmdparams );
static int ns_event_squit( CmdParams *cmdparams );
static int ns_event_ping( CmdParams *cmdparams );
static int ns_event_pong( CmdParams *cmdparams );
static int ns_event_signon( CmdParams *cmdparams );
static int ns_event_quit( CmdParams *cmdparams );
static int ns_event_nickip( CmdParams *cmdparams );
static int ns_event_kill( CmdParams *cmdparams );
static int ns_event_localkill( CmdParams *cmdparams );
static int ns_event_globalkill( CmdParams *cmdparams );
static int ns_event_serverkill( CmdParams *cmdparams );
static int ns_event_botkill( CmdParams *cmdparams );
static int ns_event_nick( CmdParams *cmdparams );
static int ns_event_away( CmdParams *cmdparams );
static int ns_event_umode( CmdParams *cmdparams );
static int ns_event_smode( CmdParams *cmdparams );
static int ns_event_newchan( CmdParams *cmdparams );
static int ns_event_delchan( CmdParams *cmdparams );
static int ns_event_join( CmdParams *cmdparams );
static int ns_event_part( CmdParams *cmdparams );
static int ns_event_partbot( CmdParams *cmdparams );
static int ns_event_emptychan( CmdParams *cmdparams );
static int ns_event_kick( CmdParams *cmdparams );
static int ns_event_kickbot( CmdParams *cmdparams );
static int ns_event_topic( CmdParams *cmdparams );
static int ns_event_cmode( CmdParams *cmdparams );
static int ns_event_private( CmdParams *cmdparams );
static int ns_event_notice( CmdParams *cmdparams );
static int ns_event_cprivate( CmdParams *cmdparams );
static int ns_event_cnotice( CmdParams *cmdparams );
static int ns_event_globops( CmdParams *cmdparams );
static int ns_event_chatops( CmdParams *cmdparams );
static int ns_event_wallops( CmdParams *cmdparams );
static int ns_event_ctcpversionrpl( CmdParams *cmdparams );
static int ns_event_ctcpversionreq( CmdParams *cmdparams );
static int ns_event_ctcpfingerrpl( CmdParams *cmdparams );
static int ns_event_ctcpfingerreq( CmdParams *cmdparams );
static int ns_event_ctcpactionreq( CmdParams *cmdparams );
static int ns_event_ctcptimerpl( CmdParams *cmdparams );
static int ns_event_ctcptimereq( CmdParams *cmdparams );
static int ns_event_ctcppingrpl( CmdParams *cmdparams );
static int ns_event_ctcppingreq( CmdParams *cmdparams );
static int ns_event_dccsend( CmdParams *cmdparams );
static int ns_event_addban( CmdParams *cmdparams );
static int ns_event_delban( CmdParams *cmdparams );
/** Module Events */
ModuleEvent module_events[] =
{
{EVENT_MODULELOAD, ns_event_moduleload},
{EVENT_MODULEUNLOAD, ns_event_moduleunload},
{EVENT_SERVER, ns_event_server},
{EVENT_SQUIT, ns_event_squit},
{EVENT_PING, ns_event_ping},
{EVENT_PONG, ns_event_pong},
{EVENT_SIGNON, ns_event_signon},
{EVENT_QUIT, ns_event_quit},
{EVENT_NICKIP, ns_event_nickip},
{EVENT_KILL, ns_event_kill},
{EVENT_LOCALKILL, ns_event_localkill},
{EVENT_GLOBALKILL, ns_event_globalkill},
{EVENT_SERVERKILL, ns_event_serverkill},
{EVENT_BOTKILL, ns_event_botkill},
{EVENT_NICK, ns_event_nick},
{EVENT_AWAY, ns_event_away},
{EVENT_UMODE, ns_event_umode},
{EVENT_SMODE, ns_event_smode},
{EVENT_NEWCHAN, ns_event_newchan},
{EVENT_DELCHAN, ns_event_delchan},
{EVENT_JOIN, ns_event_join},
{EVENT_PART, ns_event_part},
{EVENT_PARTBOT, ns_event_partbot},
{EVENT_EMPTYCHAN, ns_event_emptychan},
{EVENT_KICK, ns_event_kick},
{EVENT_KICKBOT, ns_event_kickbot},
{EVENT_TOPIC, ns_event_topic},
{EVENT_CMODE, ns_event_cmode},
{EVENT_PRIVATE, ns_event_private},
{EVENT_NOTICE, ns_event_notice},
{EVENT_CPRIVATE, ns_event_cprivate},
{EVENT_CNOTICE, ns_event_cnotice},
{EVENT_GLOBOPS, ns_event_globops},
{EVENT_CHATOPS, ns_event_chatops},
{EVENT_WALLOPS, ns_event_wallops},
{EVENT_CTCPVERSIONRPL, ns_event_ctcpversionrpl},
{EVENT_CTCPVERSIONREQ, ns_event_ctcpversionreq},
{EVENT_CTCPFINGERRPL, ns_event_ctcpfingerrpl},
{EVENT_CTCPFINGERREQ, ns_event_ctcpfingerreq},
{EVENT_CTCPACTIONREQ, ns_event_ctcpactionreq},
{EVENT_CTCPTIMERPL, ns_event_ctcptimerpl},
{EVENT_CTCPTIMEREQ, ns_event_ctcptimereq},
{EVENT_CTCPPINGRPL, ns_event_ctcppingrpl},
{EVENT_CTCPPINGREQ, ns_event_ctcppingreq},
{EVENT_DCCSEND, ns_event_dccsend},
{EVENT_ADDBAN, ns_event_addban},
{EVENT_DELBAN, ns_event_delban},
{EVENT_NULL, NULL}
};
static int ns_event_moduleload( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_MODULELOAD %s", cmdparams->param );
irc_chanalert( ns_bot, "EVENT_MODULELOAD %s", cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_moduleunload( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_MODULEUNLOAD %s", cmdparams->param );
irc_chanalert( ns_bot, "EVENT_MODULEUNLOAD %s", cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_server( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SERVER %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_SERVER %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_squit( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SQUIT %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_SQUIT %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ping( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PING %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_PING %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_pong( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PONG %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_PONG %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_signon( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SIGNON %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_SIGNON %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_quit( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_QUIT %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_QUIT %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_nickip( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NICKIP %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_NICKIP %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_kill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_KILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_KILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_localkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_LOCALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_LOCALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_globalkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_GLOBALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_GLOBALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_serverkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SERVERKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_SERVERKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_botkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_BOTKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_BOTKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_nick( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NICK %s %s", cmdparams->param , cmdparams->source->name);
irc_chanalert( ns_bot, "EVENT_NICK %s %s", cmdparams->param , cmdparams->source->name);
return NS_SUCCESS;
}
static int ns_event_away( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_AWAY %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_AWAY %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_umode( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_UMODE %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_UMODE %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_smode( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SMODE %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_SMODE %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_newchan( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NEWCHAN %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_NEWCHAN %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_delchan( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_DELCHAN %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_DELCHAN %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_join( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_JOIN %s %s", cmdparams->source->name, cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_JOIN %s %s", cmdparams->source->name, cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_part( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PART %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_PART %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_partbot( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PARTBOT %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_PARTBOT %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_emptychan( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_EMPTYCHAN %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_EMPTYCHAN %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_kick( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_KICK %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_KICK %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_kickbot( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_KICKBOT %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_KICKBOT %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_topic( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_TOPIC %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_TOPIC %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_cmode( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CMODE %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_CMODE %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_private( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PRIVATE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_PRIVATE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_notice( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NOTICE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_NOTICE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_cprivate( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CPRIVATE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CPRIVATE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_cnotice( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CNOTICE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CNOTICE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_globops( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_GLOBOPS %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_GLOBOPS %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_chatops( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CHATOPS %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CHATOPS %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_wallops( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_WALLOPS %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_WALLOPS %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpversionrpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPVERSIONRPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPVERSIONRPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpversionreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPVERSIONREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPVERSIONREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpfingerrpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPFINGERRPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPFINGERRPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpfingerreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPFINGERREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPFINGERREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpactionreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPACTIONREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPACTIONREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcptimerpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPTIMERPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPTIMERPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcptimereq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPTIMEREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPTIMEREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcppingrpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPPINGRPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPPINGRPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcppingreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPPINGREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPPINGREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_dccsend( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_DCCSEND %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_DCCSEND %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_addban( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_ADDBAN %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_ADDBAN %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_delban( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_DELBAN %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_DELBAN %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}

View file

@ -22,65 +22,10 @@
*/
#include "neostats.h"
const char ns_help_dummy_oneline[] ="dummy";
const char *ns_help_dummy[] = {
"dummy",
NULL
};
static int ns_event_moduleload( CmdParams *cmdparams );
static int ns_event_moduleunload( CmdParams *cmdparams );
static int ns_event_server( CmdParams *cmdparams );
static int ns_event_squit( CmdParams *cmdparams );
static int ns_event_ping( CmdParams *cmdparams );
static int ns_event_pong( CmdParams *cmdparams );
static int ns_event_signon( CmdParams *cmdparams );
static int ns_event_quit( CmdParams *cmdparams );
static int ns_event_nickip( CmdParams *cmdparams );
static int ns_event_kill( CmdParams *cmdparams );
static int ns_event_localkill( CmdParams *cmdparams );
static int ns_event_globalkill( CmdParams *cmdparams );
static int ns_event_serverkill( CmdParams *cmdparams );
static int ns_event_botkill( CmdParams *cmdparams );
static int ns_event_nick( CmdParams *cmdparams );
static int ns_event_away( CmdParams *cmdparams );
static int ns_event_umode( CmdParams *cmdparams );
static int ns_event_smode( CmdParams *cmdparams );
static int ns_event_newchan( CmdParams *cmdparams );
static int ns_event_delchan( CmdParams *cmdparams );
static int ns_event_join( CmdParams *cmdparams );
static int ns_event_part( CmdParams *cmdparams );
static int ns_event_partbot( CmdParams *cmdparams );
static int ns_event_emptychan( CmdParams *cmdparams );
static int ns_event_kick( CmdParams *cmdparams );
static int ns_event_kickbot( CmdParams *cmdparams );
static int ns_event_topic( CmdParams *cmdparams );
static int ns_event_cmode( CmdParams *cmdparams );
static int ns_event_private( CmdParams *cmdparams );
static int ns_event_notice( CmdParams *cmdparams );
static int ns_event_cprivate( CmdParams *cmdparams );
static int ns_event_cnotice( CmdParams *cmdparams );
static int ns_event_globops( CmdParams *cmdparams );
static int ns_event_chatops( CmdParams *cmdparams );
static int ns_event_wallops( CmdParams *cmdparams );
static int ns_event_ctcpversionrpl( CmdParams *cmdparams );
static int ns_event_ctcpversionreq( CmdParams *cmdparams );
static int ns_event_ctcpfingerrpl( CmdParams *cmdparams );
static int ns_event_ctcpfingerreq( CmdParams *cmdparams );
static int ns_event_ctcpactionreq( CmdParams *cmdparams );
static int ns_event_ctcptimerpl( CmdParams *cmdparams );
static int ns_event_ctcptimereq( CmdParams *cmdparams );
static int ns_event_ctcppingrpl( CmdParams *cmdparams );
static int ns_event_ctcppingreq( CmdParams *cmdparams );
static int ns_event_dccsend( CmdParams *cmdparams );
static int ns_event_addban( CmdParams *cmdparams );
static int ns_event_delban( CmdParams *cmdparams );
static int ns_cmd_ctcptest( CmdParams *cmdparams );
#include "commands.h"
/** Bot pointer */
static Bot *ns_bot;
Bot *ns_bot;
const char *ns_about[] =
{
@ -113,19 +58,6 @@ ModuleInfo module_info =
0,
};
/** Bot setting table */
static bot_setting ns_settings[] =
{
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
};
/** Bot comand table */
static bot_cmd ns_commands[]=
{
{"CTCPTEST",ns_cmd_ctcptest,0, NS_ULEVEL_LOCOPER, ns_help_dummy, ns_help_dummy_oneline },
{NULL, NULL, 0, 0, NULL, NULL}
};
/** BotInfo */
static BotInfo ns_botinfo =
{
@ -139,59 +71,6 @@ static BotInfo ns_botinfo =
ns_settings,
};
/** Module Events */
ModuleEvent module_events[] =
{
{EVENT_MODULELOAD, ns_event_moduleload},
{EVENT_MODULEUNLOAD, ns_event_moduleunload},
{EVENT_SERVER, ns_event_server},
{EVENT_SQUIT, ns_event_squit},
{EVENT_PING, ns_event_ping},
{EVENT_PONG, ns_event_pong},
{EVENT_SIGNON, ns_event_signon},
{EVENT_QUIT, ns_event_quit},
{EVENT_NICKIP, ns_event_nickip},
{EVENT_KILL, ns_event_kill},
{EVENT_LOCALKILL, ns_event_localkill},
{EVENT_GLOBALKILL, ns_event_globalkill},
{EVENT_SERVERKILL, ns_event_serverkill},
{EVENT_BOTKILL, ns_event_botkill},
{EVENT_NICK, ns_event_nick},
{EVENT_AWAY, ns_event_away},
{EVENT_UMODE, ns_event_umode},
{EVENT_SMODE, ns_event_smode},
{EVENT_NEWCHAN, ns_event_newchan},
{EVENT_DELCHAN, ns_event_delchan},
{EVENT_JOIN, ns_event_join},
{EVENT_PART, ns_event_part},
{EVENT_PARTBOT, ns_event_partbot},
{EVENT_EMPTYCHAN, ns_event_emptychan},
{EVENT_KICK, ns_event_kick},
{EVENT_KICKBOT, ns_event_kickbot},
{EVENT_TOPIC, ns_event_topic},
{EVENT_CMODE, ns_event_cmode},
{EVENT_PRIVATE, ns_event_private},
{EVENT_NOTICE, ns_event_notice},
{EVENT_CPRIVATE, ns_event_cprivate},
{EVENT_CNOTICE, ns_event_cnotice},
{EVENT_GLOBOPS, ns_event_globops},
{EVENT_CHATOPS, ns_event_chatops},
{EVENT_WALLOPS, ns_event_wallops},
{EVENT_CTCPVERSIONRPL, ns_event_ctcpversionrpl},
{EVENT_CTCPVERSIONREQ, ns_event_ctcpversionreq},
{EVENT_CTCPFINGERRPL, ns_event_ctcpfingerrpl},
{EVENT_CTCPFINGERREQ, ns_event_ctcpfingerreq},
{EVENT_CTCPACTIONREQ, ns_event_ctcpactionreq},
{EVENT_CTCPTIMERPL, ns_event_ctcptimerpl},
{EVENT_CTCPTIMEREQ, ns_event_ctcptimereq},
{EVENT_CTCPPINGRPL, ns_event_ctcppingrpl},
{EVENT_CTCPPINGREQ, ns_event_ctcppingreq},
{EVENT_DCCSEND, ns_event_dccsend},
{EVENT_ADDBAN, ns_event_addban},
{EVENT_DELBAN, ns_event_delban},
{EVENT_NULL, NULL}
};
/** @brief ModInit
*
* Init handler
@ -242,348 +121,8 @@ int ModSynch( void )
* @return NS_SUCCESS if suceeds else NS_FAILURE
*/
int ModFini (void)
int ModFini( void )
{
SET_SEGV_LOCATION();
return NS_SUCCESS;
}
static int ns_cmd_ctcptest( CmdParams *cmdparams )
{
irc_ctcp_version_req( ns_bot, cmdparams->source );
//irc_ctcp_version_rpl( ns_bot, cmdparams->source, const char *version );
irc_ctcp_ping_req( ns_bot, cmdparams->source );
irc_ctcp_finger_req( ns_bot, cmdparams->source );
irc_ctcp_action_req( ns_bot, cmdparams->source, "test action" );
irc_ctcp_time_req( ns_bot, cmdparams->source );
return NS_SUCCESS;
}
static int ns_event_moduleload( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_MODULELOAD %s", cmdparams->param );
irc_chanalert( ns_bot, "EVENT_MODULELOAD %s", cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_moduleunload( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_MODULEUNLOAD %s", cmdparams->param );
irc_chanalert( ns_bot, "EVENT_MODULEUNLOAD %s", cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_server( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SERVER %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_SERVER %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_squit( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SQUIT %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_SQUIT %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ping( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PING %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_PING %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_pong( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PONG %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_PONG %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_signon( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SIGNON %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_SIGNON %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_quit( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_QUIT %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_QUIT %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_nickip( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NICKIP %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_NICKIP %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_kill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_KILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_KILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_localkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_LOCALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_LOCALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_globalkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_GLOBALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_GLOBALKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_serverkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SERVERKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_SERVERKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_botkill( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_BOTKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_BOTKILL %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_nick( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NICK %s %s", cmdparams->param , cmdparams->source->name);
irc_chanalert( ns_bot, "EVENT_NICK %s %s", cmdparams->param , cmdparams->source->name);
return NS_SUCCESS;
}
static int ns_event_away( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_AWAY %s", cmdparams->source->name );
irc_chanalert( ns_bot, "EVENT_AWAY %s", cmdparams->source->name );
return NS_SUCCESS;
}
static int ns_event_umode( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_UMODE %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_UMODE %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_smode( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_SMODE %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_SMODE %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_newchan( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NEWCHAN %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_NEWCHAN %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_delchan( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_DELCHAN %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_DELCHAN %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_join( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_JOIN %s %s", cmdparams->source->name, cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_JOIN %s %s", cmdparams->source->name, cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_part( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PART %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_PART %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_partbot( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PARTBOT %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_PARTBOT %s %s %s", cmdparams->source->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_emptychan( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_EMPTYCHAN %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_EMPTYCHAN %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_kick( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_KICK %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_KICK %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_kickbot( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_KICKBOT %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_KICKBOT %s %s %s %s", cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_topic( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_TOPIC %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_TOPIC %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_cmode( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CMODE %s", cmdparams->channel->name );
irc_chanalert( ns_bot, "EVENT_CMODE %s", cmdparams->channel->name );
return NS_SUCCESS;
}
static int ns_event_private( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_PRIVATE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_PRIVATE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_notice( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_NOTICE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_NOTICE %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_cprivate( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CPRIVATE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CPRIVATE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_cnotice( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CNOTICE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CNOTICE %s %s %s %s", cmdparams->source->name, cmdparams->bot->u->name, cmdparams->channel->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_globops( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_GLOBOPS %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_GLOBOPS %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_chatops( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CHATOPS %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CHATOPS %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_wallops( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_WALLOPS %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_WALLOPS %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpversionrpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPVERSIONRPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPVERSIONRPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpversionreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPVERSIONREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPVERSIONREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpfingerrpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPFINGERRPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPFINGERRPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpfingerreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPFINGERREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPFINGERREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcpactionreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPACTIONREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPACTIONREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcptimerpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPTIMERPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPTIMERPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcptimereq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPTIMEREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPTIMEREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcppingrpl( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPPINGRPL %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPPINGRPL %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_ctcppingreq( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_CTCPPINGREQ %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_CTCPPINGREQ %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_dccsend( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_DCCSEND %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_DCCSEND %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_addban( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_ADDBAN %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_ADDBAN %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}
static int ns_event_delban( CmdParams *cmdparams )
{
dlog( DEBUG1, "EVENT_DELBAN %s %s", cmdparams->source->name, cmdparams->param );
irc_chanalert( ns_bot, "EVENT_DELBAN %s %s", cmdparams->source->name, cmdparams->param );
return NS_SUCCESS;
}

26
modules/nstest/main.h Executable file
View file

@ -0,0 +1,26 @@
/* NeoStats - IRC Statistical Services
** Copyright (c) 2005 Mark Hetherington
** http://www.neostats.net/
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
** USA
**
** NeoStats CVS Identification
** $Id$
*/
/** Bot pointer */
extern Bot *ns_bot;

View file

@ -121,6 +121,12 @@
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\commands.c">
</File>
<File
RelativePath=".\events.c">
</File>
<File
RelativePath=".\main.c">
</File>
@ -129,6 +135,12 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\commands.h">
</File>
<File
RelativePath=".\main.h">
</File>
</Filter>
<Filter
Name="Resource Files"

View file

@ -64,6 +64,7 @@ static void( *irc_send_cmode )( const char *sourceserver, const char *sourceuser
static void( *irc_send_kill )( const char *source, const char *target, const char *reason );
static void( *irc_send_kick )( const char *source, const char *chan, const char *target, const char *reason );
static void( *irc_send_invite )( const char *source, const char *to, const char *chan );
static void( *irc_send_topic )( const char *source, const char *channel, const char *topic );
static void( *irc_send_svskill )( const char *source, const char *target, const char *reason );
static void( *irc_send_svsmode )( const char *source, const char *target, const char *modes );
static void( *irc_send_svshost )( const char *source, const char *who, const char *vhost );
@ -119,6 +120,7 @@ static void _send_join( const char *source, const char *chan, const char *key, c
static void _send_part( const char *source, const char *chan, const char *reason );
static void _send_kick( const char *source, const char *chan, const char *target, const char *reason );
static void _send_invite( const char *source, const char *target, const char *chan );
static void _send_topic( const char *source, const char *channel, const char *topic );
static void _send_quit( const char *source, const char *quitmsg );
static void _send_ping( const char *source, const char *reply, const char *target );
static void _send_pong( const char *reply );
@ -175,6 +177,7 @@ protocol_sym protocol_sym_table[] =
{( void * )&irc_send_kill, _send_kill, "send_kill", &MSG_KILL, "MSG_KILL", &TOK_KILL, "TOK_KILL", 0, 0},
{( void * )&irc_send_kick, _send_kick, "send_kick", &MSG_KICK, "MSG_KICK", &TOK_KICK, "TOK_KICK", 0, 0},
{( void * )&irc_send_invite, _send_invite, "send_invite", &MSG_INVITE, "MSG_INVITE", &TOK_INVITE, "TOK_INVITE", 0, 0},
{( void * )&irc_send_topic, _send_topic, "send_topic", &MSG_TOPIC, "MSG_TOPIC", &TOK_TOPIC, "TOK_TOPIC", 0, 0},
{( void * )&irc_send_svskill, _send_svskill, "send_svskill", &MSG_SVSKILL, "MSG_SVSKILL", &TOK_SVSKILL, "TOK_SVSKILL", 0, FEATURE_SVSKILL},
{( void * )&irc_send_svsmode, _send_svsmode, "send_svsmode", &MSG_SVSMODE, "MSG_SVSMODE", &TOK_SVSMODE, "TOK_SVSMODE", 0, FEATURE_SVSMODE},
{( void * )&irc_send_svshost, NULL, "send_svshost", &MSG_SVSHOST, "MSG_SVSHOST", &TOK_SVSHOST, "TOK_SVSHOST", 0, FEATURE_SVSHOST},
@ -350,6 +353,12 @@ static void _send_invite( const char *source, const char *target, const char *ch
send_cmd( ":%s %s %s %s", source, MSGTOK( INVITE ), target, chan );
}
static void _send_topic( const char *source, const char *channel, const char *topic )
{
send_cmd( ":%s %s %s :%s", source, MSGTOK( TOPIC ), channel, topic );
}
static void _send_nickchange( const char *oldnick, const char *newnick, const unsigned long ts )
{
if( ircd_srv.protocol & PROTOCOL_P10 )
@ -1130,6 +1139,22 @@ int irc_invite( const Bot *botptr, const Client *target, const char *chan )
return NS_SUCCESS;
}
/** @brief irc_invite
*
* @return NS_SUCCESS if succeeds, NS_FAILURE if not
*/
int irc_topic( const Bot *botptr, const Channel *channel, const char *topic )
{
if( !irc_send_topic ) {
unsupported_cmd( "TOPIC" );
return NS_FAILURE;
}
irc_send_topic( botptr->u->name, channel->name, topic );
do_topic( botptr->u->name, channel->name, me.strnow, topic );
return NS_SUCCESS;
}
/** @brief irc_svstime
*
* @return NS_SUCCESS if succeeds, NS_FAILURE if not

View file

@ -476,6 +476,10 @@ unload_module (const char *modname, Client * u)
{
FiniModExcludes(mod_ptr);
}
cmdparams = ns_calloc (sizeof(CmdParams));
cmdparams->param = (char*)modname;
SendAllModuleEvent(EVENT_MODULEUNLOAD, cmdparams);
ns_free(cmdparams);
RESET_RUN_LEVEL();
#ifndef VALGRIND
SET_RUN_LEVEL(mod_ptr);
@ -499,10 +503,6 @@ unload_module (const char *modname, Client * u)
if (fchannelmoddata & (1 << moduleindex)) {
CleanupChannelModdata (moduleindex);
}
cmdparams = ns_calloc (sizeof(CmdParams));
cmdparams->param = (char*)modname;
SendAllModuleEvent(EVENT_MODULEUNLOAD, cmdparams);
ns_free(cmdparams);
return NS_SUCCESS;
}