Module API, bot init, config system, core command processor improvements
This commit is contained in:
parent
dc6e1fa232
commit
4acc74ed17
48 changed files with 701 additions and 778 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -437,8 +437,6 @@ src/transfer.c -text
|
|||
src/transfer.h -text
|
||||
src/users.c eol=lf
|
||||
src/users.h eol=lf
|
||||
src/win32/getopt.c -text
|
||||
src/win32/getopt.h -text
|
||||
src/win32/neostats.aps -text
|
||||
src/win32/neostats.bmp -text
|
||||
src/win32/neostats.rc -text
|
||||
|
|
21
ChangeLog
21
ChangeLog
|
@ -4,6 +4,27 @@ Anything we add/remove/fix/change is in here (even our rants)
|
|||
Fish (F), Mark (M)
|
||||
===============================================================================
|
||||
* NeoStats * Version 3.0.genesis
|
||||
- makeconf updated to reflect changes and some tidy ups (M)
|
||||
- Depreciate some useless config items from neostats.cfg:
|
||||
STATSERV_NETNAME - we do not use this and overwrite it when we get netinfo
|
||||
NEOSTAT_HOST - Default to servername as host and allow online config
|
||||
NEOSTAT_USER - Default to Neo and allow online config
|
||||
This makes configuration easier (M)
|
||||
- Extend BotInfo structure and simplify init_bot function to use extended
|
||||
structure. (M)
|
||||
- Add synched field to Module structure so modules can tell when they are
|
||||
online without having to maintain local variables and can be taken offline
|
||||
easily by the core. (M)
|
||||
- Add automatic bot_info SET options. (M)
|
||||
- Core command processor now uses a hash for SET options to speed up option
|
||||
processing. (M)
|
||||
- Add feature check to load modules so that modules will not load if the
|
||||
selected protocol does not support a required feature. e.g. HostServ
|
||||
required SVSHOST support. (M)
|
||||
- Update auth modules so that they just calculate a level and leave the core
|
||||
to decide whether it overrides a current level. (M)
|
||||
- Reg nick support might not use mode +r so calculate the correct char when
|
||||
loading IRCd and use variable for checking it. (M)
|
||||
- Optimise UserLevel processing so after a user level is calculated it is then
|
||||
a lookup rather than needing to recalculate every time. (M)
|
||||
- Send STATS u request to incoming servers so we can store uptime info for
|
||||
|
|
63
makeconf
63
makeconf
|
@ -1,21 +1,17 @@
|
|||
#!/bin/sh
|
||||
# makeconf v 1.0 2001/02/11 15:21:32 Shmad
|
||||
# makeconf $Id
|
||||
|
||||
TIME=`date +"%H:%M:%S %Z"`
|
||||
DATE=`date +"%a, %b %e %Y"`
|
||||
STATSCONF="neostats.cfg"
|
||||
SERVNAME="stats.somenet.net"
|
||||
SERVNUMERIC="1"
|
||||
COMMENT="NeoStats 3.0 IRC Statistical and Alternative Services"
|
||||
COMMENT="NeoStats 3.0 IRC Services"
|
||||
LINKPORT="6667"
|
||||
LINKSERVER="127.0.0.1"
|
||||
LINKPASS="LinkPass"
|
||||
NETNAME="SomeNet-IRC"
|
||||
NEOHOST="NeoStats.Net"
|
||||
NEOUSER="Neo"
|
||||
NEOCHAN="#services"
|
||||
NEOCONN="10"
|
||||
NEOREC="10"
|
||||
BINDIP="127.0.0.1"
|
||||
LOGFNAMEFORMAT="-%m-%d"
|
||||
SETSERVERTIMES="24"
|
||||
|
@ -186,30 +182,6 @@ if [ ! -z "$cc" ]; then
|
|||
COMMENT="$cc"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "Network name? (refer to your networks file. ie: CyberChat-IRC)"
|
||||
echo $n " [$NETNAME] -> $c"
|
||||
read cc
|
||||
if [ ! -z "$cc" ]; then
|
||||
NETNAME="$cc"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "The host NeoStats is connecting from, most people use services.theirnetwork.net"
|
||||
echo $n " [$NEOHOST] -> $c"
|
||||
read cc
|
||||
if [ ! -z "$cc" ]; then
|
||||
NEOHOST="$cc"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "NeoStats User? (This is the part before @yourhost.net)"
|
||||
echo $n " [$NEOUSER] -> $c"
|
||||
read cc
|
||||
if [ ! -z "$cc" ]; then
|
||||
NEOUSER="$cc"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "What channel should NeoStats join on IRC?"
|
||||
echo $n " [$NEOCHAN] -> $c"
|
||||
|
@ -327,41 +299,10 @@ SERVER_INFOLINE "$COMMENT"
|
|||
|
||||
SERVER_NUMERIC "$SERVNUMERIC"
|
||||
|
||||
# STATSERV_NETNAME <network name> [REQUIRED]
|
||||
# Your network name, if unknown refer to your network file. Does not
|
||||
# apply to all IRCDs e.g.
|
||||
#
|
||||
# STATSERV_NETNAME neostats
|
||||
#
|
||||
# For irc.neostats.net
|
||||
|
||||
STATSERV_NETNAME $NETNAME
|
||||
|
||||
##########################
|
||||
# NeoStats Configuration #
|
||||
##########################
|
||||
|
||||
# NEOSTAT_HOST <host> [REQUIRED]
|
||||
# Specifies the Hostname that NeoStats comes from. Some people like to
|
||||
# make it the same as the Services host (e.g., services.neostats.net)
|
||||
# or one just for NeoStats (e.g., stats.neostats.net) e.g.
|
||||
#
|
||||
# NEOSTATS_HOST stats.neostats.net
|
||||
#
|
||||
# The bot will appear as NeoStats!user@stats.neostats.net
|
||||
|
||||
NEOSTAT_HOST $NEOHOST
|
||||
|
||||
# NEOSTAT_USER <user> [REQUIRED]
|
||||
# Specifies the User/ident of the NeoStats Bot (the part before the
|
||||
# @host) e.g.
|
||||
#
|
||||
# NEOSTATS_USER neo
|
||||
#
|
||||
# The bot will apear as NeoStats!neo@Host
|
||||
|
||||
NEOSTAT_USER $NEOUSER
|
||||
|
||||
# SERVICES_CHAN #<channel name> [REQUIRED]
|
||||
# Specify the channel that all bots on NeoStats
|
||||
# will automatically join, and echo out any
|
||||
|
|
42
src/auth.c
42
src/auth.c
|
@ -26,58 +26,50 @@
|
|||
#include "dl.h"
|
||||
#include "services.h"
|
||||
|
||||
typedef int (*getauthfunc) (User *, int curlvl);
|
||||
typedef int (*userauthfunc) (User *u);
|
||||
typedef int (*listauthfunc) (User * u);
|
||||
|
||||
typedef struct AuthModule {
|
||||
Module* module_ptr;
|
||||
getauthfunc getauth;
|
||||
userauthfunc userauth;
|
||||
listauthfunc listauth;
|
||||
}AuthModule;
|
||||
|
||||
extern void *load_auth_mods[NUM_MODULES];
|
||||
|
||||
static AuthModule AuthModList[NUM_MODULES];
|
||||
|
||||
static int AuthModuleCount = 0;
|
||||
|
||||
/* Do dl lookups in advance to speed up UserLevel processing
|
||||
*
|
||||
*/
|
||||
|
||||
int UserAuth(User * u)
|
||||
{
|
||||
int tmplvl = 0;
|
||||
int newauthlvl = 0;
|
||||
int authlvl = 0;
|
||||
int i;
|
||||
|
||||
if(IsServiceRoot(u)) {
|
||||
return(NS_ULEVEL_ROOT);
|
||||
}
|
||||
for(i = 0; i < AuthModuleCount; i ++)
|
||||
{
|
||||
if (AuthModList[i].getauth) {
|
||||
authlvl = AuthModList[i].getauth (u, tmplvl);
|
||||
/* if authlvl is greater than tmplvl, then auth is authoritive */
|
||||
if (authlvl > tmplvl) {
|
||||
tmplvl = authlvl;
|
||||
if (AuthModList[i].userauth) {
|
||||
authlvl = AuthModList[i].userauth (u);
|
||||
/* if authlvl is greater than newauthlvl, then auth is authoritive */
|
||||
if (authlvl > newauthlvl) {
|
||||
newauthlvl = authlvl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmplvl;
|
||||
return newauthlvl;
|
||||
}
|
||||
|
||||
static void load_auth_module(const char* name)
|
||||
{
|
||||
AuthModule* newauth;
|
||||
AuthModule* auth_module;
|
||||
|
||||
newauth = &AuthModList[AuthModuleCount];
|
||||
newauth->module_ptr = load_module (name, NULL);
|
||||
if(newauth->module_ptr) {
|
||||
newauth->getauth =
|
||||
ns_dlsym (newauth->module_ptr->dl_handle, "ModAuthUser");
|
||||
newauth->listauth =
|
||||
ns_dlsym (newauth->module_ptr->dl_handle, "ModAuthList");
|
||||
auth_module = &AuthModList[AuthModuleCount];
|
||||
auth_module->module_ptr = load_module (name, NULL);
|
||||
if(auth_module->module_ptr) {
|
||||
auth_module->userauth =
|
||||
ns_dlsym (auth_module->module_ptr->dl_handle, "ModAuthUser");
|
||||
auth_module->listauth =
|
||||
ns_dlsym (auth_module->module_ptr->dl_handle, "ModAuthList");
|
||||
AuthModuleCount ++;
|
||||
}
|
||||
}
|
||||
|
|
47
src/bots.c
47
src/bots.c
|
@ -21,6 +21,11 @@
|
|||
** $Id$
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
* - find free nick for bots if NICK and ALTNICK are in use
|
||||
* - CTCP handler
|
||||
*/
|
||||
|
||||
#include "neostats.h"
|
||||
#include "modules.h"
|
||||
#include "ircd.h"
|
||||
|
@ -345,7 +350,7 @@ new_bot (const char *bot_name)
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
dlog(DEBUG2, "new_bot: %s", bot_name);
|
||||
botptr = smalloc (sizeof (Bot));
|
||||
botptr = scalloc (sizeof (Bot));
|
||||
strlcpy (botptr->nick, bot_name, MAXNICK);
|
||||
bn = hnode_create (botptr);
|
||||
if (hash_isfull (bothash)) {
|
||||
|
@ -372,8 +377,6 @@ add_ns_bot (Module* modptr, const char *nick)
|
|||
botptr = new_bot (nick);
|
||||
if(botptr) {
|
||||
botptr->moduleptr = modptr;
|
||||
botptr->botcmds = NULL;
|
||||
botptr->bot_settings = NULL;
|
||||
botptr->set_ulevel = NS_ULEVEL_ROOT;
|
||||
return botptr;
|
||||
}
|
||||
|
@ -418,6 +421,8 @@ del_ns_bot (const char *bot_name)
|
|||
hash_delete (bothash, bn);
|
||||
botptr = hnode_get (bn);
|
||||
del_all_bot_cmds(botptr);
|
||||
del_all_bot_settings(botptr);
|
||||
del_bot_info_settings(botptr);
|
||||
hnode_destroy (bn);
|
||||
sfree (botptr);
|
||||
return NS_SUCCESS;
|
||||
|
@ -482,7 +487,7 @@ list_bots (CmdParams* cmdparams)
|
|||
hash_scan_begin (&bs, bothash);
|
||||
while ((bn = hash_scan_next (&bs)) != NULL) {
|
||||
botptr = hnode_get (bn);
|
||||
if(botptr->moduleptr == 0) {
|
||||
if((botptr->flags & 0x80000000)) {
|
||||
prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "NeoStats");
|
||||
prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Bots: %s", botptr->nick);
|
||||
} else {
|
||||
|
@ -521,13 +526,14 @@ int del_bots (Module *mod_ptr)
|
|||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
Bot * init_bot (BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list)
|
||||
Bot *init_bot (BotInfo* botinfo)
|
||||
{
|
||||
Bot * botptr;
|
||||
User *u;
|
||||
long Umode;
|
||||
char* nick;
|
||||
Module* modptr;
|
||||
char* host;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
/* When we are using single bot mode, for example in client mode where we
|
||||
|
@ -535,8 +541,8 @@ Bot * init_bot (BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd
|
|||
* commands and settings to it
|
||||
*/
|
||||
if(config.singlebotmode && ns_botptr) {
|
||||
add_bot_cmd_list (ns_botptr, bot_cmd_list);
|
||||
add_bot_settings (ns_botptr, bot_setting_list);
|
||||
add_bot_cmd_list (ns_botptr, botinfo->bot_cmd_list);
|
||||
add_bot_setting_list (ns_botptr, botinfo->bot_setting_list);
|
||||
return(ns_botptr);
|
||||
}
|
||||
modptr = GET_CUR_MODULE();
|
||||
|
@ -564,27 +570,28 @@ Bot * init_bot (BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd
|
|||
nlog (LOG_WARNING, "add_ns_bot failed for module %s bot %s", modptr->info->name, nick);
|
||||
return NULL;
|
||||
}
|
||||
Umode = UmodeStringToMask(modes, 0);
|
||||
signon_newbot (nick, botinfo->user, ((*botinfo->host)==0?me.name:botinfo->host),
|
||||
botinfo->realname, modes, Umode);
|
||||
host = ((*botinfo->host)==0?me.name:botinfo->host);
|
||||
if(botinfo->flags&BOT_FLAG_SERVICEBOT) {
|
||||
Umode = UmodeStringToMask(me.servicesumode, 0);
|
||||
signon_newbot (nick, botinfo->user, host, botinfo->realname, me.servicesumode, Umode);
|
||||
} else {
|
||||
signon_newbot (nick, botinfo->user, host, botinfo->realname, "", 0);
|
||||
}
|
||||
u = finduser (nick);
|
||||
/* set our link back to user struct for bot */
|
||||
botptr->u = u;
|
||||
/* Mark bot as services bot if needed */
|
||||
if ((Umode & service_umode_mask)) {
|
||||
flags |= BOT_FLAG_SERVICEBOT;
|
||||
}
|
||||
if (HaveUmodeDeaf()&&flags&BOT_FLAG_DEAF) {
|
||||
if (HaveUmodeDeaf()&&(botinfo->flags&BOT_FLAG_DEAF)) {
|
||||
sumode_cmd (nick, nick, UMODE_DEAF);
|
||||
}
|
||||
botptr->flags = flags;
|
||||
botptr->flags = botinfo->flags;
|
||||
SET_RUN_LEVEL(modptr);
|
||||
if (bot_cmd_list) {
|
||||
add_bot_cmd_list (botptr, bot_cmd_list);
|
||||
if (botinfo->bot_cmd_list) {
|
||||
add_bot_cmd_list (botptr, botinfo->bot_cmd_list);
|
||||
}
|
||||
if (bot_setting_list) {
|
||||
add_bot_settings (botptr, bot_setting_list);
|
||||
if (botinfo->bot_setting_list) {
|
||||
add_bot_setting_list (botptr, botinfo->bot_setting_list);
|
||||
}
|
||||
add_bot_info_settings (botptr, botinfo);
|
||||
RESET_RUN_LEVEL();
|
||||
return botptr;
|
||||
}
|
||||
|
|
345
src/commands.c
345
src/commands.c
|
@ -21,10 +21,17 @@
|
|||
** $Id$
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
* - Finish off error processing
|
||||
* - Make command logging optional
|
||||
* - Make command alerts optional
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include "neostats.h"
|
||||
#include "ns_help.h"
|
||||
#include "modules.h"
|
||||
#include "services.h"
|
||||
|
||||
|
@ -48,48 +55,6 @@ char * help_level_title[]=
|
|||
* by the core. A module can override these by defining them
|
||||
* in it's local bot command array.
|
||||
*/
|
||||
static const char cmd_help_oneline[]="Online help";
|
||||
static const char *cmd_help_help[] = {
|
||||
"Syntax: \2HELP [command]\2",
|
||||
"",
|
||||
"Provides help on the bot commands",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char cmd_help_about_oneline[] = "About Module";
|
||||
const char *cmd_help_about[] = {
|
||||
"Syntax: \2ABOUT\2",
|
||||
"",
|
||||
"Provides information about the module",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char cmd_help_credits_oneline[] = "Display credits";
|
||||
const char *cmd_help_credits[] = {
|
||||
"Syntax: \2CREDITS\2",
|
||||
"",
|
||||
"Show credits",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char cmd_help_version_oneline[] = "Display version";
|
||||
const char *cmd_help_version[] = {
|
||||
"Syntax: \2VERSION\2",
|
||||
"",
|
||||
"Show version information",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *cmd_help_set[] = {
|
||||
"Syntax: \2SET LIST\2",
|
||||
" \2SET <option> [<value>]\2",
|
||||
"",
|
||||
"LIST display the current settings",
|
||||
"",
|
||||
"Available Options are:",
|
||||
"",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Simplified command table for handling intrinsic commands.
|
||||
* We do not require all entries since we only use a few for
|
||||
|
@ -228,6 +193,12 @@ void msg_error_need_more_params (CmdParams * cmdparams)
|
|||
prefmsg (cmdparams->source.user->nick, cmdparams->dest.bot->nick, "/msg %s HELP %s for more information", cmdparams->dest.bot->nick, cmdparams->param);
|
||||
}
|
||||
|
||||
void msg_error_param_out_of_range (CmdParams * cmdparams)
|
||||
{
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Parameter out of range.");
|
||||
prefmsg (cmdparams->source.user->nick, cmdparams->dest.bot->nick, "/msg %s HELP %s for more information", cmdparams->dest.bot->nick, cmdparams->param);
|
||||
}
|
||||
|
||||
void msg_syntax_error (CmdParams * cmdparams)
|
||||
{
|
||||
prefmsg (cmdparams->source.user->nick, cmdparams->dest.bot->nick, "Syntax error");
|
||||
|
@ -247,6 +218,28 @@ void msg_only_opers (CmdParams * cmdparams)
|
|||
nlog (LOG_NORMAL, "%s requested %s, but is not an operator.", cmdparams->source.user->nick, cmdparams->param);
|
||||
}
|
||||
|
||||
void check_cmd_result(CmdParams * cmdparams, int cmdret, char* extra)
|
||||
{
|
||||
switch(cmdret) {
|
||||
case NS_ERR_SYNTAX_ERROR:
|
||||
msg_syntax_error (cmdparams);
|
||||
break;
|
||||
case NS_ERR_NEED_MORE_PARAMS:
|
||||
msg_error_need_more_params (cmdparams);
|
||||
break;
|
||||
case NS_ERR_PARAM_OUT_OF_RANGE:
|
||||
msg_error_param_out_of_range (cmdparams);
|
||||
break;
|
||||
case NS_ERR_UNKNOWN_COMMAND:
|
||||
case NS_ERR_NO_PERMISSION:
|
||||
break;
|
||||
case NS_FAILURE:
|
||||
case NS_SUCCESS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief add_bot_cmd adds a single command to the command hash
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
|
@ -390,30 +383,36 @@ del_services_cmd_list(bot_cmd* bot_cmd_list)
|
|||
int
|
||||
run_intrinsic_cmds (const char* cmd, CmdParams * cmdparams)
|
||||
{
|
||||
int cmdret;
|
||||
/* Handle intrinsic commands */
|
||||
/* Help */
|
||||
if (!ircstrcasecmp(cmd, "HELP")) {
|
||||
bot_cmd_help(cmdparams);
|
||||
cmdret = bot_cmd_help(cmdparams);
|
||||
check_cmd_result(cmdparams, cmdret, NULL);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* Handle SET if we have it */
|
||||
if (cmdparams->dest.bot->bot_settings && !ircstrcasecmp(cmd, "SET") ) {
|
||||
bot_cmd_set(cmdparams);
|
||||
if (cmdparams->dest.bot->botsettings && !ircstrcasecmp(cmd, "SET") ) {
|
||||
cmdret = bot_cmd_set(cmdparams);
|
||||
check_cmd_result(cmdparams, cmdret, NULL);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* About */
|
||||
if (!ircstrcasecmp(cmd, "ABOUT") && cmdparams->dest.bot->moduleptr && cmdparams->dest.bot->moduleptr->info->about_text ) {
|
||||
bot_cmd_about(cmdparams);
|
||||
cmdret = bot_cmd_about(cmdparams);
|
||||
check_cmd_result(cmdparams, cmdret, NULL);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* Version */
|
||||
if (!ircstrcasecmp(cmd, "VERSION")) {
|
||||
bot_cmd_version(cmdparams);
|
||||
cmdret = bot_cmd_version(cmdparams);
|
||||
check_cmd_result(cmdparams, cmdret, NULL);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
/* Credits */
|
||||
if (!ircstrcasecmp(cmd, "CREDITS") && cmdparams->dest.bot->moduleptr && cmdparams->dest.bot->moduleptr->info->copyright ) {
|
||||
bot_cmd_credits(cmdparams);
|
||||
cmdret = bot_cmd_credits(cmdparams);
|
||||
check_cmd_result(cmdparams, cmdret, NULL);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
return NS_FAILURE;
|
||||
|
@ -481,26 +480,14 @@ run_bot_cmd (CmdParams * cmdparams)
|
|||
cmdret = cmd_ptr->handler(cmdparams);
|
||||
RESET_RUN_LEVEL();
|
||||
}
|
||||
switch(cmdret) {
|
||||
case NS_ERR_SYNTAX_ERROR:
|
||||
msg_syntax_error (cmdparams);
|
||||
break;
|
||||
case NS_ERR_NEED_MORE_PARAMS:
|
||||
msg_error_need_more_params (cmdparams);
|
||||
break;
|
||||
case NS_ERR_NO_PERMISSION:
|
||||
break;
|
||||
case NS_FAILURE:
|
||||
case NS_SUCCESS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
check_cmd_result(cmdparams, cmdret, NULL);
|
||||
sfree (av);
|
||||
sfree (cmdparams->av);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
}
|
||||
if(run_intrinsic_cmds (av[0], cmdparams) == NS_SUCCESS) {
|
||||
cmdret = run_intrinsic_cmds (av[0], cmdparams);
|
||||
if(cmdret == NS_SUCCESS) {
|
||||
sfree (av);
|
||||
sfree (cmdparams->av);
|
||||
return NS_SUCCESS;
|
||||
|
@ -512,6 +499,32 @@ run_bot_cmd (CmdParams * cmdparams)
|
|||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief bot_cmd_help_set process bot help command
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
static int
|
||||
bot_cmd_help_set (CmdParams * cmdparams, int userlevel)
|
||||
{
|
||||
hnode_t *setnode;
|
||||
hscan_t hs;
|
||||
bot_setting* set_ptr;
|
||||
|
||||
/* Display HELP SET intro text and LIST command */
|
||||
privmsg_list (cmdparams->source.user->nick, cmdparams->dest.bot->nick, cmd_help_set);
|
||||
/* Display option specific text for current user level */
|
||||
hash_scan_begin(&hs, cmdparams->dest.bot->botsettings);
|
||||
while ((setnode = hash_scan_next(&hs)) != NULL) {
|
||||
set_ptr = hnode_get(setnode);
|
||||
if(set_ptr->helptext && userlevel >= set_ptr->ulevel)
|
||||
{
|
||||
privmsg_list (cmdparams->source.user->nick, cmdparams->dest.bot->nick, set_ptr->helptext);
|
||||
prefmsg(cmdparams->source.user->nick, cmdparams->dest.bot->nick, " ");
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
/** @brief bot_cmd_help process bot help command
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
|
@ -547,7 +560,7 @@ bot_cmd_help (CmdParams * cmdparams)
|
|||
cmd_ptr++;
|
||||
}
|
||||
/* Do we have a set command? */
|
||||
if(cmdparams->dest.bot->bot_settings && userlevel >= cmdparams->dest.bot->set_ulevel) {
|
||||
if(cmdparams->dest.bot->botsettings && userlevel >= cmdparams->dest.bot->set_ulevel) {
|
||||
prefmsg(cmdparams->source.user->nick, cmdparams->dest.bot->nick, " %-20s Configure %s", "SET", cmdparams->dest.bot->nick);
|
||||
}
|
||||
while(1) {
|
||||
|
@ -638,22 +651,9 @@ bot_cmd_help (CmdParams * cmdparams)
|
|||
}
|
||||
cmd_ptr++;
|
||||
}
|
||||
/* Handle SET if we have it */
|
||||
if (cmdparams->dest.bot->bot_settings && userlevel >= cmdparams->dest.bot->set_ulevel && !ircstrcasecmp(cmdparams->av[0], "SET") ) {
|
||||
bot_setting* set_ptr;
|
||||
set_ptr = cmdparams->dest.bot->bot_settings;
|
||||
/* Display HELP SET intro text and LIST command */
|
||||
privmsg_list (cmdparams->source.user->nick, cmdparams->dest.bot->nick, cmd_help_set);
|
||||
/* Display option specific text for current user level */
|
||||
while(set_ptr->option)
|
||||
{
|
||||
if(set_ptr->helptext && userlevel >= set_ptr->ulevel)
|
||||
{
|
||||
privmsg_list (cmdparams->source.user->nick, cmdparams->dest.bot->nick, set_ptr->helptext);
|
||||
prefmsg(cmdparams->source.user->nick, cmdparams->dest.bot->nick, " ");
|
||||
}
|
||||
set_ptr++;
|
||||
}
|
||||
/* Handle SET if we have it */
|
||||
if (cmdparams->dest.bot->botsettings && userlevel >= cmdparams->dest.bot->set_ulevel && !ircstrcasecmp(cmdparams->av[0], "SET") ) {
|
||||
bot_cmd_help_set (cmdparams, userlevel);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -688,14 +688,17 @@ int is_target_valid(char* bot_name, User* u, char* target_nick)
|
|||
static int
|
||||
bot_cmd_set_list (CmdParams * cmdparams)
|
||||
{
|
||||
hnode_t *setnode;
|
||||
hscan_t hs;
|
||||
bot_setting* set_ptr;
|
||||
int userlevel;
|
||||
|
||||
prefmsg(cmdparams->source.user->nick, cmdparams->dest.bot->nick, "Current %s settings:", cmdparams->dest.bot->nick);
|
||||
userlevel = getuserlevel (cmdparams);
|
||||
set_ptr = cmdparams->dest.bot->bot_settings;
|
||||
while(set_ptr->option)
|
||||
{
|
||||
|
||||
hash_scan_begin(&hs, cmdparams->dest.bot->botsettings);
|
||||
while ((setnode = hash_scan_next(&hs)) != NULL) {
|
||||
set_ptr = hnode_get(setnode);
|
||||
/* Only list authorised SETTINGS */
|
||||
if( userlevel >= set_ptr->ulevel) {
|
||||
switch(set_ptr->type) {
|
||||
|
@ -966,6 +969,7 @@ static bot_cmd_set_handler bot_cmd_set_handlers[] =
|
|||
static int
|
||||
bot_cmd_set (CmdParams * cmdparams)
|
||||
{
|
||||
hnode_t *setnode;
|
||||
bot_cmd_set_handler set_handler;
|
||||
bot_setting* set_ptr;
|
||||
int userlevel;
|
||||
|
@ -988,34 +992,29 @@ bot_cmd_set (CmdParams * cmdparams)
|
|||
msg_syntax_error (cmdparams);
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
set_ptr = cmdparams->dest.bot->bot_settings;
|
||||
while(set_ptr->option)
|
||||
{
|
||||
if(!ircstrcasecmp(cmdparams->av[0], set_ptr->option))
|
||||
break;
|
||||
set_ptr++;
|
||||
}
|
||||
if(!set_ptr->option) {
|
||||
prefmsg(cmdparams->source.user->nick, cmdparams->dest.bot->nick,
|
||||
"Unknown set option. /msg %s HELP SET for more info",
|
||||
cmdparams->dest.bot->nick);
|
||||
return NS_ERR_UNKNOWN_OPTION;
|
||||
}
|
||||
if( userlevel < set_ptr->ulevel) {
|
||||
msg_permission_denied(cmdparams, cmdparams->av[0]);
|
||||
return NS_ERR_NO_PERMISSION;
|
||||
}
|
||||
set_handler = bot_cmd_set_handlers[set_ptr->type];
|
||||
if(set_handler (cmdparams, set_ptr)!=NS_SUCCESS) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* Call back after SET so that a module can "react" to a change in a setting */
|
||||
if(set_ptr->type != SET_TYPE_CUSTOM) {
|
||||
if(set_ptr->handler) {
|
||||
set_ptr->handler(cmdparams);
|
||||
setnode = hash_lookup(cmdparams->dest.bot->botsettings, cmdparams->av[0]);
|
||||
if(setnode) {
|
||||
set_ptr = hnode_get(setnode);
|
||||
if( userlevel < set_ptr->ulevel) {
|
||||
msg_permission_denied(cmdparams, cmdparams->av[0]);
|
||||
return NS_ERR_NO_PERMISSION;
|
||||
}
|
||||
set_handler = bot_cmd_set_handlers[set_ptr->type];
|
||||
if(set_handler (cmdparams, set_ptr)!=NS_SUCCESS) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* Call back after SET so that a module can "react" to a change in a setting */
|
||||
if(set_ptr->type != SET_TYPE_CUSTOM) {
|
||||
if(set_ptr->handler) {
|
||||
set_ptr->handler(cmdparams);
|
||||
}
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
prefmsg(cmdparams->source.user->nick, cmdparams->dest.bot->nick,
|
||||
"Unknown set option. /msg %s HELP SET for more info",
|
||||
cmdparams->dest.bot->nick);
|
||||
return NS_ERR_UNKNOWN_OPTION;
|
||||
}
|
||||
|
||||
/** @brief bot_cmd_about process bot about command
|
||||
|
@ -1047,22 +1046,136 @@ static int bot_cmd_credits (CmdParams * cmdparams)
|
|||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
int add_bot_settings (Bot *bot_ptr, bot_setting *bot_setting_list)
|
||||
/** @brief add_bot_setting adds a single set option
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
static int
|
||||
add_bot_setting (hash_t* set_hash, bot_setting* set_ptr)
|
||||
{
|
||||
bot_ptr->bot_settings = bot_setting_list;
|
||||
hnode_t *setnode;
|
||||
|
||||
setnode = hnode_create(set_ptr);
|
||||
if (setnode) {
|
||||
hash_insert(set_hash, setnode, set_ptr->option);
|
||||
dlog(DEBUG3, "add_bot_setting: added a new set option %s", set_ptr->option);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief del_bot_setting delete a single set option
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
static int
|
||||
del_bot_setting (hash_t* set_hash, bot_setting* set_ptr)
|
||||
{
|
||||
hnode_t *setnode;
|
||||
|
||||
setnode = hash_lookup(set_hash, set_ptr->option);
|
||||
if (setnode) {
|
||||
hash_delete(set_hash, setnode);
|
||||
hnode_destroy(setnode);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief add_bot_setting_list adds a list of set options
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
int
|
||||
add_bot_setting_list (Bot* bot_ptr, bot_setting* set_ptr)
|
||||
{
|
||||
/* If no hash create */
|
||||
if(bot_ptr->botsettings == NULL) {
|
||||
bot_ptr->botsettings = hash_create(-1, 0, 0);
|
||||
}
|
||||
/* Default SET to ROOT only */
|
||||
bot_ptr->set_ulevel = NS_ULEVEL_ROOT;
|
||||
/* Now calculate minimum defined user level */
|
||||
while(bot_setting_list->option != NULL) {
|
||||
if(bot_setting_list->ulevel < bot_ptr->set_ulevel) {
|
||||
bot_ptr->set_ulevel = bot_setting_list->ulevel;
|
||||
while(set_ptr->option != NULL) {
|
||||
if(set_ptr->ulevel < bot_ptr->set_ulevel) {
|
||||
bot_ptr->set_ulevel = set_ptr->ulevel;
|
||||
}
|
||||
bot_setting_list++;
|
||||
add_bot_setting(bot_ptr->botsettings, set_ptr);
|
||||
set_ptr++;
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
int del_bot_settings (Bot *bot_ptr, bot_setting *bot_setting_list)
|
||||
/** @brief del_bot_setting_list delete a list of set options
|
||||
*
|
||||
* @return NS_SUCCESS if suceeds, NS_FAILURE if not
|
||||
*/
|
||||
int
|
||||
del_bot_setting_list (Bot* bot_ptr, bot_setting* set_ptr)
|
||||
{
|
||||
/* If no hash return failure */
|
||||
if(bot_ptr->botsettings == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* Cycle through command list and delete them */
|
||||
while(set_ptr->option) {
|
||||
del_bot_setting(bot_ptr->botsettings, set_ptr);
|
||||
set_ptr++;
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
int del_all_bot_settings (Bot *bot_ptr)
|
||||
{
|
||||
hnode_t *setnode;
|
||||
hscan_t hs;
|
||||
|
||||
/* Check we have a command hash */
|
||||
if(bot_ptr->botsettings == NULL) {
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* Cycle through command hash and delete each command */
|
||||
hash_scan_begin(&hs, bot_ptr->botsettings);
|
||||
while ((setnode = hash_scan_next(&hs)) != NULL) {
|
||||
hash_delete(bot_ptr->botsettings, setnode);
|
||||
hnode_destroy(setnode);
|
||||
}
|
||||
/* Destroy command */
|
||||
hash_destroy(bot_ptr->botsettings);
|
||||
bot_ptr->botsettings = NULL;
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
static bot_setting bot_info_settings[]=
|
||||
{
|
||||
{"NICK", NULL, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick, NULL, NULL },
|
||||
{"ALTNICK", NULL, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "AltNick", NULL, ns_help_set_altnick, NULL, NULL },
|
||||
{"USER", NULL, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user, NULL, NULL },
|
||||
{"HOST", NULL, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host, NULL, NULL },
|
||||
{"REALNAME",NULL, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname, NULL, NULL },
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
int add_bot_info_settings (Bot *bot_ptr, BotInfo* botinfo)
|
||||
{
|
||||
bot_ptr->bot_info_settings = smalloc(sizeof(bot_info_settings));
|
||||
if(bot_ptr->bot_info_settings) {
|
||||
memcpy(bot_ptr->bot_info_settings, bot_info_settings, sizeof(bot_info_settings));
|
||||
bot_ptr->bot_info_settings[0].varptr = &botinfo->nick;
|
||||
bot_ptr->bot_info_settings[1].varptr = &botinfo->altnick;
|
||||
bot_ptr->bot_info_settings[2].varptr = &botinfo->user;
|
||||
bot_ptr->bot_info_settings[3].varptr = &botinfo->host;
|
||||
bot_ptr->bot_info_settings[4].varptr = &botinfo->realname;
|
||||
ModuleConfig(bot_ptr->bot_info_settings);
|
||||
add_bot_setting_list (bot_ptr, bot_ptr->bot_info_settings);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
int del_bot_info_settings (Bot *bot_ptr)
|
||||
{
|
||||
if(bot_ptr->bot_info_settings) {
|
||||
sfree(bot_ptr->bot_info_settings);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,10 @@ int add_bot_cmd_list (Bot *bot_ptr, bot_cmd *bot_cmd_list);
|
|||
int del_bot_cmd_list (Bot *bot_ptr, bot_cmd *bot_cmd_list);
|
||||
int del_all_bot_cmds (Bot* bot_ptr);
|
||||
int run_bot_cmd (CmdParams * cmdparams);
|
||||
int add_bot_settings (Bot *bot_ptr, bot_setting *bot_setting_list);
|
||||
int del_bot_settings (Bot *bot_ptr, bot_setting *bot_setting_list);
|
||||
int add_bot_setting_list (Bot *bot_ptr, bot_setting *bot_setting_list);
|
||||
int del_bot_setting_list (Bot *bot_ptr, bot_setting *bot_setting_list);
|
||||
int add_bot_info_settings (Bot *bot_ptr, BotInfo* botinfo);
|
||||
int del_bot_info_settings (Bot *bot_ptr);
|
||||
int del_all_bot_settings (Bot* bot_ptr);
|
||||
|
||||
#endif /* _COMMANDS_H_ */
|
||||
|
|
|
@ -57,8 +57,6 @@ static config_option options[] = {
|
|||
{"SERVER_INFOLINE", ARG_STR, cb_Server, 4},
|
||||
{"STATSERV_NETNAME", ARG_STR, cb_Server, 5},
|
||||
{"RECONNECT_TIME", ARG_STR, cb_Server, 6},
|
||||
{"NEOSTAT_HOST", ARG_STR, cb_Server, 7},
|
||||
{"NEOSTAT_USER", ARG_STR, cb_Server, 8},
|
||||
{"WANT_PRIVMSG", ARG_STR, cb_Server, 9},
|
||||
{"SERVICES_CHAN", ARG_STR, cb_Server, 10},
|
||||
{"LOAD_MODULE", ARG_STR, cb_Module, 0},
|
||||
|
@ -272,12 +270,6 @@ cb_Server (char *arg, int configtype)
|
|||
} else if (configtype == 6) {
|
||||
/* Reconnect time */
|
||||
config.r_time = atoi (arg);
|
||||
} else if (configtype == 7) {
|
||||
/* NeoStat Host */
|
||||
strlcpy (ns_botinfo.host, arg, MAXHOST);
|
||||
} else if (configtype == 8) {
|
||||
/* NeoStat User */
|
||||
strlcpy (ns_botinfo.user, arg, MAXUSER);
|
||||
} else if (configtype == 9) {
|
||||
config.want_privmsg = 1;
|
||||
} else if (configtype == 10) {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
/* include/config.h. Generated by configure. */
|
||||
/* include/config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* 'Enable Bahamut Support' */
|
||||
/* #undef BAHAMUT */
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
|
|
6
src/dl.h
6
src/dl.h
|
@ -50,6 +50,12 @@
|
|||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define MOD_EXT "dll"
|
||||
#else
|
||||
#define MOD_EXT "so"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
|
|
@ -94,7 +94,7 @@ typedef enum Event {
|
|||
EVENT_SQUIT,
|
||||
|
||||
/* EVENT_NETINFO
|
||||
* Called when the connection to the network is synced.
|
||||
* Called when the connection to the network is synched.
|
||||
* parameters:
|
||||
* av[0] none
|
||||
*/
|
||||
|
|
69
src/ircd.c
69
src/ircd.c
|
@ -46,6 +46,8 @@ long service_umode_mask = 0;
|
|||
unsigned int ircd_supported_umodes = 0;
|
||||
unsigned int ircd_supported_smodes = 0;
|
||||
|
||||
unsigned char UmodeChRegNick = 'r';
|
||||
|
||||
ChanModes ircd_cmodes[MODE_TABLE_SIZE];
|
||||
UserModes ircd_umodes[MODE_TABLE_SIZE];
|
||||
UserModes ircd_smodes[MODE_TABLE_SIZE];
|
||||
|
@ -121,11 +123,7 @@ InitIrcdCalls (void)
|
|||
{
|
||||
static char protocol_name[MAXHOST];
|
||||
|
||||
#ifdef WIN32
|
||||
ircsnprintf (protocol_name, 255, "%s/%s.dll", MOD_PATH, me.protocol);
|
||||
#else
|
||||
ircsnprintf (protocol_name, 255, "%s/%s.so", MOD_PATH, me.protocol);
|
||||
#endif
|
||||
ircsnprintf (protocol_name, 255, "%s/%s.%s", MOD_PATH, me.protocol,MOD_EXT);
|
||||
protocol_module_handle= ns_dlopen(protocol_name, RTLD_NOW || RTLD_GLOBAL);
|
||||
protocol_info = ns_dlsym( protocol_module_handle, "protocol_info");
|
||||
services_umode = protocol_info->services_umode;
|
||||
|
@ -221,11 +219,14 @@ InitIrcdModes (void)
|
|||
memset(&ircd_umodes, 0, sizeof(ircd_umodes));
|
||||
umodes = user_umodes;
|
||||
while(umodes->modechar)
|
||||
{
|
||||
{
|
||||
dlog(DEBUG4, "Adding user mode %c", umodes->modechar);
|
||||
ircd_umodes[(int)umodes->modechar].umode = umodes->umode;
|
||||
/* Build supported modes mask */
|
||||
ircd_supported_umodes |= umodes->umode;
|
||||
if(umodes->umode&UMODE_REGNICK) {
|
||||
UmodeChRegNick = umodes->modechar;
|
||||
}
|
||||
umodes ++;
|
||||
}
|
||||
/* build smode lookup table */
|
||||
|
@ -1062,20 +1063,26 @@ privmsg_list (char *to, char *from, const char **text)
|
|||
void
|
||||
chanalert (char *from, char *fmt, ...)
|
||||
{
|
||||
char* source;
|
||||
va_list ap;
|
||||
|
||||
if (!me.onchan)
|
||||
return;
|
||||
|
||||
source = from;
|
||||
if(source == NULL) {
|
||||
source = ns_botptr->nick;
|
||||
}
|
||||
va_start (ap, fmt);
|
||||
ircvsnprintf (ircd_buf, BUFSIZE, fmt, ap);
|
||||
va_end (ap);
|
||||
irc_send_privmsg (from, me.serviceschan, ircd_buf);
|
||||
irc_send_privmsg (source, me.serviceschan, ircd_buf);
|
||||
}
|
||||
|
||||
void
|
||||
prefmsg (char *to, const char *from, char *fmt, ...)
|
||||
{
|
||||
char* source;
|
||||
va_list ap;
|
||||
|
||||
if (findbot (to)) {
|
||||
|
@ -1083,19 +1090,25 @@ prefmsg (char *to, const char *from, char *fmt, ...)
|
|||
return;
|
||||
}
|
||||
|
||||
source = (char*)from;
|
||||
if(source == NULL) {
|
||||
source = ns_botptr->nick;
|
||||
}
|
||||
|
||||
va_start (ap, fmt);
|
||||
ircvsnprintf (ircd_buf, BUFSIZE, fmt, ap);
|
||||
va_end (ap);
|
||||
if (config.want_privmsg) {
|
||||
irc_send_privmsg (from, to, ircd_buf);
|
||||
irc_send_privmsg (source, to, ircd_buf);
|
||||
} else {
|
||||
irc_send_notice (from, to, ircd_buf);
|
||||
irc_send_notice (source, to, ircd_buf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
privmsg (char *to, const char *from, char *fmt, ...)
|
||||
{
|
||||
char* source;
|
||||
va_list ap;
|
||||
|
||||
if (findbot (to)) {
|
||||
|
@ -1103,15 +1116,20 @@ privmsg (char *to, const char *from, char *fmt, ...)
|
|||
return;
|
||||
}
|
||||
|
||||
source = (char*)from;
|
||||
if(source == NULL) {
|
||||
source = ns_botptr->nick;
|
||||
}
|
||||
va_start (ap, fmt);
|
||||
ircvsnprintf (ircd_buf, BUFSIZE, fmt, ap);
|
||||
va_end (ap);
|
||||
irc_send_privmsg (from, to, ircd_buf);
|
||||
irc_send_privmsg (source, to, ircd_buf);
|
||||
}
|
||||
|
||||
void
|
||||
notice (char *to, const char *from, char *fmt, ...)
|
||||
{
|
||||
char* source;
|
||||
va_list ap;
|
||||
|
||||
if (findbot (to)) {
|
||||
|
@ -1119,23 +1137,32 @@ notice (char *to, const char *from, char *fmt, ...)
|
|||
return;
|
||||
}
|
||||
|
||||
source = (char*)from;
|
||||
if(source == NULL) {
|
||||
source = ns_botptr->nick;
|
||||
}
|
||||
va_start (ap, fmt);
|
||||
ircvsnprintf (ircd_buf, BUFSIZE, fmt, ap);
|
||||
va_end (ap);
|
||||
irc_send_notice (from, to, ircd_buf);
|
||||
irc_send_notice (source, to, ircd_buf);
|
||||
}
|
||||
|
||||
void
|
||||
globops (char *from, char *fmt, ...)
|
||||
{
|
||||
char* source;
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
ircvsnprintf (ircd_buf, BUFSIZE, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
source = from;
|
||||
if(source == NULL) {
|
||||
source = ns_botptr->nick;
|
||||
}
|
||||
if (me.onchan) {
|
||||
irc_send_globops(from, ircd_buf);
|
||||
irc_send_globops(source, ircd_buf);
|
||||
} else {
|
||||
nlog (LOG_NORMAL, ircd_buf);
|
||||
}
|
||||
|
@ -1144,12 +1171,17 @@ globops (char *from, char *fmt, ...)
|
|||
void
|
||||
wallops (const char *from, const char *fmt, ...)
|
||||
{
|
||||
char* source;
|
||||
va_list ap;
|
||||
|
||||
source = (char*)from;
|
||||
if(source == NULL) {
|
||||
source = ns_botptr->nick;
|
||||
}
|
||||
va_start (ap, fmt);
|
||||
ircvsnprintf (ircd_buf, BUFSIZE, fmt, ap);
|
||||
va_end (ap);
|
||||
irc_send_wallops ((char*)from, (char*)ircd_buf);
|
||||
irc_send_wallops ((char*)source, (char*)ircd_buf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1546,7 +1578,7 @@ do_netinfo(const char* maxglobalcnt, const char* tsendsync, const char* prot, co
|
|||
init_services_bot ();
|
||||
globops (me.name, "Link with Network \2Complete!\2");
|
||||
SendAllModuleEvent (EVENT_NETINFO, NULL);
|
||||
me.synced = 1;
|
||||
me.synched = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1559,7 +1591,7 @@ do_snetinfo(const char* maxglobalcnt, const char* tsendsync, const char* prot, c
|
|||
init_services_bot ();
|
||||
globops (me.name, "Link with Network \2Complete!\2");
|
||||
SendAllModuleEvent (EVENT_NETINFO, NULL);
|
||||
me.synced = 1;
|
||||
me.synched = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1767,7 +1799,7 @@ do_burst (char *origin, char **argv, int argc)
|
|||
if (ircd_srv.burst == 1) {
|
||||
irc_send_burst (0);
|
||||
ircd_srv.burst = 0;
|
||||
me.synced = 1;
|
||||
me.synched = 1;
|
||||
init_services_bot ();
|
||||
}
|
||||
} else {
|
||||
|
@ -1974,3 +2006,8 @@ static void m_numeric242 (char *origin, char **argv, int argc, int srv)
|
|||
}
|
||||
}
|
||||
|
||||
int HaveFeature (int mask)
|
||||
{
|
||||
return (protocol_info->features&mask);
|
||||
}
|
||||
|
||||
|
|
10
src/ircd.h
10
src/ircd.h
|
@ -191,7 +191,7 @@ MODULEFUNC void send_join (const char *sender, const char *who, const char *chan
|
|||
MODULEFUNC void send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts);
|
||||
MODULEFUNC void send_part (const char *who, const char *chan);
|
||||
MODULEFUNC void send_nickchange (const char *oldnick, const char *newnick, const unsigned long ts);
|
||||
MODULEFUNC void send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts);
|
||||
MODULEFUNC void send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts);
|
||||
MODULEFUNC void send_quit (const char *who, const char *quitmsg);
|
||||
MODULEFUNC void send_kill (const char *from, const char *target, const char *reason);
|
||||
MODULEFUNC void send_kick (const char *who, const char *chan, const char *target, const char *reason);
|
||||
|
@ -204,14 +204,14 @@ MODULEFUNC void send_svspart (const char *sender, const char *target, const char
|
|||
MODULEFUNC void send_svsnick (const char *sender, const char *target, const char *newnick, const unsigned long ts);
|
||||
MODULEFUNC void send_swhois (const char *sender, const char *target, const char *swhois);
|
||||
MODULEFUNC void send_smo (const char *from, const char *umodetarget, const char *msg);
|
||||
MODULEFUNC void send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, unsigned long ts);
|
||||
MODULEFUNC void send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts);
|
||||
MODULEFUNC void send_rakill (const char *sender, const char *host, const char *ident);
|
||||
MODULEFUNC void send_ping (const char *from, const char *reply, const char *to);
|
||||
MODULEFUNC void send_pong (const char *reply);
|
||||
MODULEFUNC void send_server (const char *sender, const char *name, const int numeric, const char *infoline);
|
||||
MODULEFUNC void send_squit (const char *server, const char *quitmsg);
|
||||
MODULEFUNC void send_nick (const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname);
|
||||
MODULEFUNC void send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink);
|
||||
MODULEFUNC void send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink);
|
||||
MODULEFUNC void send_netinfo (const char* from, const int prot, const char* cloak, const char* netname, const unsigned long ts);
|
||||
MODULEFUNC void send_snetinfo (const char* from, const int prot, const char* cloak, const char* netname, const unsigned long ts);
|
||||
MODULEFUNC void send_svinfo (const int tscurrent, const int tsmin, const unsigned long tsnow);
|
||||
|
@ -230,7 +230,7 @@ extern void (*irc_send_join) (const char *sender, const char *who, const char *c
|
|||
extern void (*irc_send_sjoin) (const char *sender, const char *who, const char *chan, const unsigned long ts);
|
||||
extern void (*irc_send_part) (const char *who, const char *chan);
|
||||
extern void (*irc_send_nickchange) (const char *oldnick, const char *newnick, const unsigned long ts);
|
||||
extern void (*irc_send_cmode) (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts);
|
||||
extern void (*irc_send_cmode) (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts);
|
||||
extern void (*irc_send_quit) (const char *who, const char *quitmsg);
|
||||
extern void (*irc_send_kill) (const char *from, const char *target, const char *reason);
|
||||
extern void (*irc_send_kick) (const char *who, const char *chan, const char *target, const char *reason);
|
||||
|
@ -250,7 +250,7 @@ extern void (*irc_send_pong) (const char *reply);
|
|||
extern void (*irc_send_server) (const char *sender, const char *name, const int numeric, const char *infoline);
|
||||
extern void (*irc_send_squit) (const char *server, const char *quitmsg);
|
||||
extern void (*irc_send_nick) (const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname);
|
||||
extern void (*irc_send_server_connect) (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink);
|
||||
extern void (*irc_send_server_connect) (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink);
|
||||
extern void (*irc_send_netinfo) (const char* from, const int prot, const char* cloak, const char* netname, const unsigned long ts);
|
||||
extern void (*irc_send_snetinfo) (const char* from, const int prot, const char* cloak, const char* netname, const unsigned long ts);
|
||||
extern void (*irc_send_svinfo) (const int tscurrent, const int tsmin, const unsigned long tsnow);
|
||||
|
|
14
src/main.c
14
src/main.c
|
@ -22,9 +22,6 @@
|
|||
*/
|
||||
|
||||
#include "neostats.h"
|
||||
#ifdef WIN32
|
||||
#include "win32/getopt.h"
|
||||
#endif
|
||||
#include "ircd.h"
|
||||
#include "conf.h"
|
||||
#include "keeper.h"
|
||||
|
@ -258,6 +255,11 @@ neostats ()
|
|||
static int
|
||||
get_options (int argc, char **argv)
|
||||
{
|
||||
#ifdef WIN32
|
||||
config.debug = 1;
|
||||
config.loglevel = LOG_INFO;
|
||||
config.debuglevel = DEBUG10;
|
||||
#else
|
||||
int c;
|
||||
int level;
|
||||
|
||||
|
@ -268,11 +270,6 @@ get_options (int argc, char **argv)
|
|||
config.loglevel = LOG_INFO;
|
||||
config.debuglevel = DEBUG10;
|
||||
config.foreground = 1;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
config.debug = 1;
|
||||
config.loglevel = LOG_INFO;
|
||||
config.debuglevel = DEBUG10;
|
||||
#endif
|
||||
/* default debugmodule to all */
|
||||
strlcpy(config.debugmodule, "all", MAX_MOD_NAME);
|
||||
|
@ -320,6 +317,7 @@ get_options (int argc, char **argv)
|
|||
printf ("Unknown command line switch %c\n", optopt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "modules.h"
|
||||
#include "bots.h"
|
||||
#include "dns.h"
|
||||
#include "ircd.h"
|
||||
#ifdef SQLSRV
|
||||
#include "sqlsrv/rta.h"
|
||||
#endif
|
||||
|
@ -329,11 +330,7 @@ load_module (const char *modfilename, User * u)
|
|||
}
|
||||
strlcpy (loadmodname, modfilename, 255);
|
||||
strlwr (loadmodname);
|
||||
#ifdef WIN32
|
||||
ircsnprintf (path, 255, "%s/%s.dll", MOD_PATH, loadmodname);
|
||||
#else
|
||||
ircsnprintf (path, 255, "%s/%s.so", MOD_PATH, loadmodname);
|
||||
#endif
|
||||
ircsnprintf (path, 255, "%s/%s.%s", MOD_PATH, loadmodname, MOD_EXT);
|
||||
dl_handle = ns_dlopen (path, RTLD_NOW || RTLD_GLOBAL);
|
||||
if (!dl_handle) {
|
||||
if (do_msg) {
|
||||
|
@ -367,6 +364,15 @@ load_module (const char *modfilename, User * u)
|
|||
nlog (LOG_WARNING, "Unable to load module: %s already loaded", info_ptr->name);
|
||||
return NULL;
|
||||
}
|
||||
/* Check we have require PROTOCOL/FEATURE support for module */
|
||||
if((info_ptr->features & protocol_info->features) != info_ptr->features) {
|
||||
nlog (LOG_WARNING, "Unable to load module: %s Required module features not available on this IRCd.", modfilename);
|
||||
if (do_msg) {
|
||||
prefmsg (u->nick, ns_botptr->nick, "Unable to load module: %s Required module features not available on this IRCd.", modfilename);
|
||||
}
|
||||
ns_dlclose (dl_handle);
|
||||
return NULL;
|
||||
}
|
||||
/* Extract pointer to event list */
|
||||
event_ptr = ns_dlsym (dl_handle, "module_events");
|
||||
/* Lookup ModInit (replacement for library __init() call */
|
||||
|
|
|
@ -85,16 +85,7 @@ struct cs_cfg {
|
|||
int use_exc;
|
||||
} cs_cfg;
|
||||
|
||||
static int cs_online = 0;
|
||||
static Bot *cs_bot;
|
||||
static BotInfo cs_botinfo =
|
||||
{
|
||||
"ConnectServ",
|
||||
"ConnectServ",
|
||||
"CS",
|
||||
"",
|
||||
"Connection monitoring service",
|
||||
};
|
||||
|
||||
static Module* cs_module;
|
||||
|
||||
|
@ -117,47 +108,8 @@ ModuleInfo module_info = {
|
|||
0,
|
||||
};
|
||||
|
||||
static bot_cmd cs_commands[]=
|
||||
{
|
||||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *cs_help_set_nick[] = {
|
||||
"\2NICK <newnick>\2 Change bot nickname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cs_help_set_altnick[] = {
|
||||
"\2ALTNICK <newnick>\2 Change bot alternate nickname",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cs_help_set_user[] = {
|
||||
"\2USER <username>\2 Change bot username",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cs_help_set_host[] = {
|
||||
"\2HOST <host>\2 Change bot host",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cs_help_set_realname[] = {
|
||||
"\2REALNAME <realname>\2 Change bot realname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
static bot_setting cs_settings[]=
|
||||
{
|
||||
{"NICK", &cs_botinfo.nick, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, cs_help_set_nick, NULL, (void*)"ConnectServ" },
|
||||
{"ALTNICK", &cs_botinfo.altnick,SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "AltNick", NULL, cs_help_set_altnick, NULL, (void*)"ConnectServ" },
|
||||
{"USER", &cs_botinfo.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, cs_help_set_user, NULL, (void*)"CS" },
|
||||
{"HOST", &cs_botinfo.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, cs_help_set_host, NULL, (void*)"" },
|
||||
{"REALNAME", &cs_botinfo.realname,SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, cs_help_set_realname, NULL, (void*)"Connection monitoring service" },
|
||||
{"SIGNWATCH", &cs_cfg.sign_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "SignWatch", NULL, cs_help_set_signwatch, NULL, (void*)1 },
|
||||
{"KILLWATCH", &cs_cfg.kill_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "KillWatch", NULL, cs_help_set_killwatch, NULL, (void*)1 },
|
||||
{"MODEWATCH", &cs_cfg.mode_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "ModeWatch", NULL, cs_help_set_modewatch, NULL, (void*)1 },
|
||||
|
@ -167,6 +119,18 @@ static bot_setting cs_settings[]=
|
|||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static BotInfo cs_botinfo =
|
||||
{
|
||||
"ConnectServ",
|
||||
"ConnectServ1",
|
||||
"CS",
|
||||
BOT_COMMON_HOST,
|
||||
"Connection monitoring service",
|
||||
BOT_FLAG_SERVICEBOT|BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF,
|
||||
NULL,
|
||||
cs_settings,
|
||||
};
|
||||
|
||||
ModuleEvent module_events[] = {
|
||||
{EVENT_ONLINE, cs_event_online},
|
||||
{EVENT_SIGNON, cs_event_signon},
|
||||
|
@ -194,9 +158,7 @@ void ModFini()
|
|||
|
||||
static int cs_event_online(CmdParams* cmdparams)
|
||||
{
|
||||
cs_bot = init_bot (&cs_botinfo, me.servicesumode,
|
||||
BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF, cs_commands, cs_settings);
|
||||
cs_online = 1;
|
||||
cs_bot = init_bot (&cs_botinfo);
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
@ -206,7 +168,7 @@ static int cs_event_online(CmdParams* cmdparams)
|
|||
static int cs_event_signon(CmdParams* cmdparams)
|
||||
{
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.sign_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.sign_watch) {
|
||||
return 1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.user)) {
|
||||
|
@ -236,7 +198,7 @@ static int cs_event_quit(CmdParams* cmdparams)
|
|||
int LocalCount = 0;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online) {
|
||||
if (!cs_module->synched) {
|
||||
return 1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.user)) {
|
||||
|
@ -312,7 +274,7 @@ static int cs_event_umode(CmdParams* cmdparams)
|
|||
char *modes;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.mode_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.mode_watch) {
|
||||
return -1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.user)) {
|
||||
|
@ -401,7 +363,7 @@ static int cs_event_smode(CmdParams* cmdparams)
|
|||
char *modes;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.mode_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.mode_watch) {
|
||||
return -1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.user)) {
|
||||
|
@ -473,7 +435,7 @@ static int cs_event_kill(CmdParams* cmdparams)
|
|||
int KillCount = 0;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.kill_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.kill_watch) {
|
||||
return 1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.user)) {
|
||||
|
@ -509,7 +471,7 @@ static int cs_event_kill(CmdParams* cmdparams)
|
|||
static int cs_event_nick(CmdParams* cmdparams)
|
||||
{
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.nick_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.nick_watch) {
|
||||
return 1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.user)) {
|
||||
|
@ -528,7 +490,7 @@ static int cs_event_nick(CmdParams* cmdparams)
|
|||
static int cs_event_server(CmdParams* cmdparams)
|
||||
{
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.serv_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.serv_watch) {
|
||||
return 1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.server)) {
|
||||
|
@ -542,7 +504,7 @@ static int cs_event_server(CmdParams* cmdparams)
|
|||
static int cs_event_squit(CmdParams* cmdparams)
|
||||
{
|
||||
SET_SEGV_LOCATION();
|
||||
if (!cs_online || !cs_cfg.serv_watch) {
|
||||
if (!cs_module->synched || !cs_cfg.serv_watch) {
|
||||
return 1;
|
||||
}
|
||||
if (cs_cfg.use_exc && IsExcluded(cmdparams->source.server)) {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include "neostats.h"
|
||||
#include "services.h"
|
||||
|
||||
const char *ns_copyright[] = {
|
||||
"Copyright (c) 1999-2004, NeoStats",
|
||||
|
@ -98,20 +97,19 @@ static int AccessAdd(CmdParams* cmdparams)
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
if (cmdparams->ac < 3) {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Invalid Syntax. /msg NeoStats help access");
|
||||
return NS_ERR_NEED_MORE_PARAMS;
|
||||
}
|
||||
if (hash_lookup(accesshash, cmdparams->av[0])) {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Entry for %s already exists", cmdparams->av[0]);
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Entry for %s already exists", cmdparams->av[0]);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
if (strstr(cmdparams->av[1], "!")&& !strstr(cmdparams->av[1], "@")) {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Invalid format for hostmask. Must be of the form nick!user@host.");
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Invalid format for hostmask. Must be of the form nick!user@host.");
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
level = atoi(cmdparams->av[2]);
|
||||
if(level < 0 || level > NS_ULEVEL_ROOT) {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Level our of range. Valid values range from 0 to 200.");
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Level out of range. Valid values range from 0 to 200.");
|
||||
return NS_ERR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
access = malloc(sizeof(NeoAccess));
|
||||
|
@ -125,7 +123,7 @@ static int AccessAdd(CmdParams* cmdparams)
|
|||
SetConf((void *)access->mask, CFGSTR, confpath);
|
||||
ircsnprintf(confpath, CONFBUFSIZE, "AccessList/%s/level", access->nick);
|
||||
SetConf((void *)access->level, CFGINT, confpath);
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Successfully added %s for host %s with level %d to access list", access->nick, access->mask, access->level);
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Successfully added %s for host %s with level %d to access list", access->nick, access->mask, access->level);
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -135,7 +133,6 @@ static int AccessDel(CmdParams* cmdparams)
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
if (cmdparams->ac < 1) {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Invalid Syntax. /msg %s help access for more info", ns_botptr->nick);
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
node = hash_lookup(accesshash, cmdparams->av[0]);
|
||||
|
@ -145,9 +142,9 @@ static int AccessDel(CmdParams* cmdparams)
|
|||
hnode_destroy(node);
|
||||
ircsnprintf(confpath, CONFBUFSIZE, "AccessList/%s", cmdparams->av[0]);
|
||||
DelConf(confpath);
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Deleted %s from Access List", cmdparams->av[0]);
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Deleted %s from Access List", cmdparams->av[0]);
|
||||
} else {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Error, Could not find %s in access list. /msg %s access list", cmdparams->av[0], ns_botptr->nick);
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Error, Could not find %s in access list.", cmdparams->av[0]);
|
||||
}
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
@ -159,13 +156,13 @@ static int AccessList(CmdParams* cmdparams)
|
|||
NeoAccess *access;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Access List (%d):", (int)hash_count(accesshash));
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Access List (%d):", (int)hash_count(accesshash));
|
||||
hash_scan_begin(&accessscan, accesshash);
|
||||
while ((node = hash_scan_next(&accessscan)) != NULL) {
|
||||
access = hnode_get(node);
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "%s %s (%d)", access->nick, access->mask, access->level);
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "%s %s (%d)", access->nick, access->mask, access->level);
|
||||
}
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "End of List.");
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "End of List.");
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -179,7 +176,7 @@ static int ea_cmd_access(CmdParams* cmdparams)
|
|||
} else if (!strcasecmp(cmdparams->av[2], "list")) {
|
||||
return AccessList(cmdparams);
|
||||
}
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Invalid Syntax. /msg %s help access for more info", ns_botptr->nick);
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "Invalid Syntax.");
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
|
@ -228,12 +225,14 @@ static int ea_event_mode(CmdParams* cmdparams)
|
|||
{
|
||||
int add = 0;
|
||||
char *modes;
|
||||
char vhost[MAXHOST];
|
||||
|
||||
/* bail if we are not synced */
|
||||
if (!is_synced)
|
||||
if (!is_synched)
|
||||
return 0;
|
||||
|
||||
if(!HaveUmodeRegNick())
|
||||
return -1;
|
||||
|
||||
/* first, find if its a regnick mode */
|
||||
modes = cmdparams->av[1];
|
||||
while (*modes) {
|
||||
|
@ -244,15 +243,15 @@ static int ea_event_mode(CmdParams* cmdparams)
|
|||
case '-':
|
||||
add = 0;
|
||||
break;
|
||||
case 'r':
|
||||
if (add) {
|
||||
cmdparams->source.user->ulevel = GetAccessLevel(cmdparams->source.user);
|
||||
dlog(DEBUG2, "SetAccessLevel for %s to %d", cmdparams->source.user->nick, cmdparams->source.user->ulevel);
|
||||
chanalert (ns_botptr->nick, "%s granted access level %d", cmdparams->source.user->nick, cmdparams->source.user->ulevel);
|
||||
nlog (LOG_NORMAL, "%s granted access level %d", cmdparams->source.user->nick, cmdparams->source.user->ulevel);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(*modes == UmodeChRegNick) {
|
||||
if (add) {
|
||||
cmdparams->source.user->ulevel = GetAccessLevel(cmdparams->source.user);
|
||||
dlog(DEBUG2, "SetAccessLevel for %s to %d", cmdparams->source.user->nick, cmdparams->source.user->ulevel);
|
||||
chanalert (NULL, "%s granted access level %d", cmdparams->source.user->nick, cmdparams->source.user->ulevel);
|
||||
nlog (LOG_NORMAL, "%s granted access level %d", cmdparams->source.user->nick, cmdparams->source.user->ulevel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
modes++;
|
||||
|
@ -276,14 +275,7 @@ void ModFini()
|
|||
{
|
||||
}
|
||||
|
||||
int ModAuthUser(User * u, int curlvl)
|
||||
int ModAuthUser(User * u)
|
||||
{
|
||||
int templevel = 0;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
templevel = GetAccessLevel(u);
|
||||
if(templevel > curlvl) {
|
||||
curlvl = templevel;
|
||||
}
|
||||
return curlvl;
|
||||
return GetAccessLevel(u);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ struct hs_cfg {
|
|||
int regnick;
|
||||
char vhostdom[MAXHOST];
|
||||
int modnum;
|
||||
int operhosts;
|
||||
} hs_cfg;
|
||||
|
||||
typedef struct hs_user {
|
||||
|
@ -82,27 +83,10 @@ int CleanupHosts(void);
|
|||
static void LoadHosts(void);
|
||||
static void LoadConfig(void);
|
||||
|
||||
int data_synch;
|
||||
int load_synch;
|
||||
|
||||
char **DelArry;
|
||||
char **ListArry;
|
||||
int LoadArryCount = 0;
|
||||
int DelArryCount = 0;
|
||||
int ListArryCount = 0;
|
||||
|
||||
Bot *hs_bot;
|
||||
static BotInfo hs_botinfo =
|
||||
{
|
||||
"HostServ",
|
||||
"HostServ",
|
||||
"HS",
|
||||
"",
|
||||
"Network virtual host service",
|
||||
};
|
||||
static Module* hs_module;
|
||||
|
||||
const char *ns_copyright[] = {
|
||||
const char *hs_copyright[] = {
|
||||
"Copyright (c) 1999-2004, NeoStats",
|
||||
"http://www.neostats.net/",
|
||||
NULL
|
||||
|
@ -111,7 +95,7 @@ const char *ns_copyright[] = {
|
|||
ModuleInfo module_info = {
|
||||
"HostServ",
|
||||
"Network virtual host service",
|
||||
ns_copyright,
|
||||
hs_copyright,
|
||||
hs_about,
|
||||
NEOSTATS_VERSION,
|
||||
CORE_MODULE_VERSION,
|
||||
|
@ -135,48 +119,27 @@ static bot_cmd hs_commands[]=
|
|||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *ns_help_set_nick[] = {
|
||||
"\2NICK <newnick>\2 Change bot nickname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_altnick[] = {
|
||||
"\2ALTNICK <newnick>\2 Change bot alternate nickname",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_user[] = {
|
||||
"\2USER <username>\2 Change bot username",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_host[] = {
|
||||
"\2HOST <host>\2 Change bot host",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_realname[] = {
|
||||
"\2REALNAME <realname>\2 Change bot realname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
static bot_setting hs_settings[]=
|
||||
{
|
||||
{"NICK", &hs_botinfo.nick, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick, NULL, (void*)"HostServ" },
|
||||
{"ALTNICK", &hs_botinfo.altnick,SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "AltNick", NULL, ns_help_set_altnick, NULL, (void*)"HostServ" },
|
||||
{"USER", &hs_botinfo.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user, NULL, (void*)"HS" },
|
||||
{"HOST", &hs_botinfo.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host, NULL, (void*)"" },
|
||||
{"REALNAME", &hs_botinfo.realname,SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname, NULL, (void*)"Network virtual host service" },
|
||||
{"EXPIRE", &hs_cfg.old, SET_TYPE_INT, 0, 99, NS_ULEVEL_ADMIN, "ExpireDays","days",hs_help_set_expire, NULL, (void*)60 },
|
||||
{"HIDDENHOST", &hs_cfg.regnick, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "UnetVhosts",NULL, hs_help_set_hiddenhost, NULL, (void*)0 },
|
||||
{"HOSTNAME", &hs_cfg.vhostdom, SET_TYPE_STRING, 0, MAXHOST, NS_ULEVEL_ADMIN, "UnetDomain",NULL, hs_help_set_hostname, NULL, (void*)"" },
|
||||
{"OPERHOSTS", &hs_cfg.operhosts, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "operhosts",NULL, hs_help_set_operhosts, NULL, (void*)0 },
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static BotInfo hs_botinfo =
|
||||
{
|
||||
"HostServ",
|
||||
"HostServ1",
|
||||
"HS",
|
||||
BOT_COMMON_HOST,
|
||||
"Network virtual host service",
|
||||
BOT_FLAG_SERVICEBOT|BOT_FLAG_DEAF,
|
||||
hs_commands,
|
||||
hs_settings,
|
||||
};
|
||||
|
||||
int findnick(const void *key1, const void *key2)
|
||||
{
|
||||
const hs_map *vhost = key1;
|
||||
|
@ -232,7 +195,7 @@ static int hs_event_signon(CmdParams* cmdparams)
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
|
||||
if (!is_synced)
|
||||
if (!is_synched)
|
||||
return 0;
|
||||
|
||||
if (IsMe(cmdparams->source.user))
|
||||
|
@ -242,11 +205,7 @@ static int hs_event_signon(CmdParams* cmdparams)
|
|||
if (IsExcluded(cmdparams->source.user))
|
||||
return 1;
|
||||
|
||||
if (!load_synch)
|
||||
return 1;
|
||||
|
||||
/* Check HostName Against Data Contained in vhosts.data */
|
||||
|
||||
hn = list_find(vhosts, cmdparams->source.user->nick, findnick);
|
||||
if (hn) {
|
||||
map = lnode_get(hn);
|
||||
|
@ -254,14 +213,12 @@ static int hs_event_signon(CmdParams* cmdparams)
|
|||
if (match(map->host, cmdparams->source.user->hostname)) {
|
||||
ssvshost_cmd(cmdparams->source.user->nick, map->vhost);
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
"Automatically setting your Virtual Host to %s",
|
||||
map->vhost);
|
||||
"Automatically setting your hidden host to %s", map->vhost);
|
||||
map->lused = me.now;
|
||||
save_vhost(map);
|
||||
if(HaveUmodeRegNick()) {
|
||||
set_moddata(cmdparams->source.user);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -269,10 +226,8 @@ static int hs_event_signon(CmdParams* cmdparams)
|
|||
|
||||
static int hs_event_online(CmdParams* cmdparams)
|
||||
{
|
||||
hs_bot = init_bot(&hs_botinfo, me.servicesumode, BOT_FLAG_DEAF,
|
||||
hs_commands, hs_settings);
|
||||
hs_bot = init_bot(&hs_botinfo);
|
||||
add_timer (CleanupHosts, "CleanupHosts", 7200);
|
||||
LoadHosts();
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
@ -296,6 +251,7 @@ int ModInit(Module* mod_ptr)
|
|||
}
|
||||
ModuleConfig(hs_settings);
|
||||
LoadConfig();
|
||||
LoadHosts();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -317,6 +273,10 @@ int hs_event_mode(CmdParams* cmdparams)
|
|||
char *modes;
|
||||
char vhost[MAXHOST];
|
||||
|
||||
/* bail if we are not synched */
|
||||
if (!is_synched)
|
||||
return 0;
|
||||
|
||||
if(!HaveUmodeRegNick())
|
||||
return -1;
|
||||
|
||||
|
@ -324,12 +284,7 @@ int hs_event_mode(CmdParams* cmdparams)
|
|||
if (hs_cfg.regnick != 1)
|
||||
return -1;
|
||||
|
||||
/* bail if we are not synced */
|
||||
if (!is_synced || !load_synch)
|
||||
return 0;
|
||||
|
||||
if (is_oper(cmdparams->source.user))
|
||||
/* don't set a opers vhost. Most likely already done */
|
||||
if (is_oper(cmdparams->source.user) && hs_cfg.operhosts == 0)
|
||||
return 1;
|
||||
|
||||
if (IsExcluded(cmdparams->source.user))
|
||||
|
@ -345,21 +300,21 @@ int hs_event_mode(CmdParams* cmdparams)
|
|||
case '-':
|
||||
add = 0;
|
||||
break;
|
||||
case 'r':
|
||||
if (add) {
|
||||
if (cmdparams->source.user->moddata[hs_module->modnum] != NULL) {
|
||||
dlog(DEBUG2, "not setting hidden host on %s", cmdparams->av[0]);
|
||||
return -1;
|
||||
}
|
||||
dlog(DEBUG2, "Regnick Mode on %s", cmdparams->av[0]);
|
||||
ircsnprintf(vhost, MAXHOST, "%s.%s", cmdparams->av[0], hs_cfg.vhostdom);
|
||||
ssvshost_cmd(cmdparams->av[0], vhost);
|
||||
prefmsg(cmdparams->av[0], hs_bot->nick,
|
||||
"Automatically setting your hidden host to %s", vhost);
|
||||
set_moddata(cmdparams->source.user);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(*modes == UmodeChRegNick) {
|
||||
if (add) {
|
||||
if (cmdparams->source.user->moddata[hs_module->modnum] != NULL) {
|
||||
dlog(DEBUG2, "not setting hidden host on %s", cmdparams->av[0]);
|
||||
return -1;
|
||||
}
|
||||
dlog(DEBUG2, "Regnick Mode on %s", cmdparams->av[0]);
|
||||
ircsnprintf(vhost, MAXHOST, "%s.%s", cmdparams->av[0], hs_cfg.vhostdom);
|
||||
ssvshost_cmd(cmdparams->source.user->nick, vhost);
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
"Automatically setting your hidden host to %s", vhost);
|
||||
set_moddata(cmdparams->source.user);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
modes++;
|
||||
|
@ -419,20 +374,16 @@ static int hs_levels(CmdParams* cmdparams)
|
|||
}
|
||||
if (!ircstrcasecmp(cmdparams->av[2], "ADD")) {
|
||||
hs_cfg.add = t;
|
||||
SetConf((void *) t, CFGINT,
|
||||
"AddLevel");
|
||||
SetConf((void *) t, CFGINT, "AddLevel");
|
||||
} else if (!ircstrcasecmp(cmdparams->av[2], "DEL")) {
|
||||
hs_cfg.del = t;
|
||||
SetConf((void *) t, CFGINT,
|
||||
"DelLevel");
|
||||
SetConf((void *) t, CFGINT, "DelLevel");
|
||||
} else if (!ircstrcasecmp(cmdparams->av[2], "LIST")) {
|
||||
hs_cfg.list = t;
|
||||
SetConf((void *) t, CFGINT,
|
||||
"ListLevel");
|
||||
SetConf((void *) t, CFGINT, "ListLevel");
|
||||
} else if (!ircstrcasecmp(cmdparams->av[2], "VIEW")) {
|
||||
hs_cfg.view = t;
|
||||
SetConf((void *) t, CFGINT,
|
||||
"ViewLevel");
|
||||
SetConf((void *) t, CFGINT, "ViewLevel");
|
||||
} else {
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
"Invalid Level. /msg %s help levels", hs_bot->nick);
|
||||
|
@ -512,7 +463,7 @@ static void hs_delban(User* u, char *ban)
|
|||
int j = 0;
|
||||
|
||||
i = atoi(ban);
|
||||
if ((i < 1) || (i > hash_count(bannedvhosts))) {
|
||||
if ((i < 1) || (i > (int)hash_count(bannedvhosts))) {
|
||||
prefmsg(u->nick, hs_bot->nick,
|
||||
"Invalid Entry. /msg %s bans for the list",
|
||||
hs_bot->nick);
|
||||
|
@ -644,21 +595,24 @@ static int hs_add(CmdParams* cmdparams)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!list_find(vhosts, cmd, findnick)) {
|
||||
hsdat(cmd, m, h, p, cmdparams->source.user->nick);
|
||||
nlog(LOG_NOTICE,
|
||||
"%s added a vhost for %s with realhost %s vhost %s and password %s",
|
||||
cmdparams->source.user->nick, cmd, m, h, p);
|
||||
if (list_find(vhosts, cmd, findnick)) {
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
"%s has sucessfully been registered under realhost: %s vhost: %s and password: %s",
|
||||
cmd, m, h, p);
|
||||
chanalert(hs_bot->nick,
|
||||
"%s added a vhost %s for %s with realhost %s",
|
||||
cmdparams->source.user->nick, h, cmd, m);
|
||||
/* Apply The New Hostname If The User Is Online */
|
||||
if ((nu = finduser(cmd)) != NULL) {
|
||||
if (IsMe(nu))
|
||||
return 1;
|
||||
"%s already has a vhost entry", cmd);
|
||||
return 1;
|
||||
}
|
||||
hsdat(cmd, m, h, p, cmdparams->source.user->nick);
|
||||
nlog(LOG_NOTICE,
|
||||
"%s added a vhost for %s with realhost %s vhost %s and password %s",
|
||||
cmdparams->source.user->nick, cmd, m, h, p);
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
"%s has sucessfully been registered under realhost: %s vhost: %s and password: %s",
|
||||
cmd, m, h, p);
|
||||
chanalert(hs_bot->nick,
|
||||
"%s added a vhost %s for %s with realhost %s",
|
||||
cmdparams->source.user->nick, h, cmd, m);
|
||||
/* Apply The New Hostname If The User Is Online */
|
||||
if ((nu = finduser(cmd)) != NULL) {
|
||||
if (!IsMe(nu)) {
|
||||
if (match(m, nu->hostname)) {
|
||||
ssvshost_cmd(nu->nick, h);
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
|
@ -672,12 +626,8 @@ static int hs_add(CmdParams* cmdparams)
|
|||
hs_bot->nick);
|
||||
if(HaveUmodeRegNick())
|
||||
set_moddata(nu);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick,
|
||||
"%s already has a vhost entry", cmd);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -690,6 +640,7 @@ static int hs_list(CmdParams* cmdparams)
|
|||
lnode_t *hn;
|
||||
hs_map *map;
|
||||
int start = 0;
|
||||
int vhostcount;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if (cmdparams->ac == 2) {
|
||||
|
@ -698,14 +649,16 @@ static int hs_list(CmdParams* cmdparams)
|
|||
start = atoi(cmdparams->av[2]);
|
||||
}
|
||||
|
||||
if (start >= list_count(vhosts)) {
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Value out of range. There are only %d entries", (int)list_count(vhosts));
|
||||
vhostcount = list_count(vhosts);
|
||||
|
||||
if (start >= vhostcount) {
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Value out of range. There are only %d entries", (int)vhostcount);
|
||||
return 1;
|
||||
}
|
||||
|
||||
i = 1;
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Current vhost list: ");
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Showing %d to %d entries of %d vhosts", start+1, start+20, (int)list_count(vhosts));
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Showing %d to %d entries of %d vhosts", start+1, start+20, (int)vhostcount);
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "%-5s %-12s %-30s", "Num", "Nick", "Vhost");
|
||||
hn = list_first(vhosts);
|
||||
while (hn != NULL) {
|
||||
|
@ -727,8 +680,8 @@ static int hs_list(CmdParams* cmdparams)
|
|||
"For more information on someone use /msg %s VIEW #",
|
||||
hs_bot->nick);
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "--- End of List ---");
|
||||
if (list_count(vhosts) >= i)
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Type \2/msg %s list %d\2 to see next page", hs_bot->nick, i-1);
|
||||
if (vhostcount >= i)
|
||||
prefmsg(cmdparams->source.user->nick, hs_bot->nick, "Type \2/msg %s list %d\2 to see next page", hs_bot->nick, i-1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -787,13 +740,12 @@ static void LoadHosts()
|
|||
lnode_t *hn;
|
||||
char *tmp;
|
||||
int count;
|
||||
char **LoadArry;
|
||||
char **LoadArray;
|
||||
|
||||
if (GetTableData("Vhosts", &LoadArry) > 0) {
|
||||
load_synch = 1;
|
||||
for (count = 0; LoadArry[count] != NULL; count++) {
|
||||
if (GetTableData("Vhosts", &LoadArray) > 0) {
|
||||
for (count = 0; LoadArray[count] != NULL; count++) {
|
||||
map = smalloc(sizeof(hs_map));
|
||||
strlcpy(map->nnick, LoadArry[count], MAXNICK);
|
||||
strlcpy(map->nnick, LoadArray[count], MAXNICK);
|
||||
if (GetData((void *)&tmp, CFGSTR, "Vhosts", map->nnick, "Host") > 0)
|
||||
strlcpy(map->host, tmp, MAXHOST);
|
||||
if (GetData((void *)&tmp, CFGSTR, "Vhosts", map->nnick, "Vhost") > 0)
|
||||
|
@ -809,7 +761,7 @@ static void LoadHosts()
|
|||
map->nnick, map->vhost);
|
||||
}
|
||||
}
|
||||
sfree(LoadArry);
|
||||
sfree(LoadArray);
|
||||
list_sort(vhosts, findnick);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,3 +44,4 @@ extern const char *hs_help_levels[];
|
|||
extern const char *hs_help_set_expire[];
|
||||
extern const char *hs_help_set_hiddenhost[];
|
||||
extern const char *hs_help_set_hostname[];
|
||||
extern const char *hs_help_set_operhosts[];
|
||||
|
|
|
@ -159,3 +159,10 @@ const char *hs_help_set_hostname[] = {
|
|||
"Users will then be set to nick.<hostname>.",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *hs_help_set_operhosts[] = {
|
||||
"\2SET OPERHOSTS <ON/OFF>\2",
|
||||
"Whether HostServ will set oper vhosts or not. If your IRCd does",
|
||||
"not provide oper hosts, you might want to use this option.",
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include "neostats.h"
|
||||
#include "services.h"
|
||||
|
||||
static int auth_cmd_authmodelist(CmdParams* cmdparams);
|
||||
|
||||
|
@ -143,10 +142,10 @@ static int auth_cmd_authmodelist(CmdParams* cmdparams)
|
|||
{
|
||||
int i;
|
||||
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick,
|
||||
prefmsg(cmdparams->source.user->nick, NULL,
|
||||
"User mode auth levels:");
|
||||
for (i = 0; i < user_auth_mode_count; i++) {
|
||||
prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "%s: %d",
|
||||
prefmsg(cmdparams->source.user->nick, NULL, "%s: %d",
|
||||
user_auth_modes[i].modename, user_auth_modes[i].level);
|
||||
}
|
||||
return 1;
|
||||
|
@ -179,38 +178,31 @@ void ModFini()
|
|||
del_services_cmd_list(auth_commands);
|
||||
}
|
||||
|
||||
int ModAuthUser(User * u, int curlvl)
|
||||
int ModAuthUser(User * u)
|
||||
{
|
||||
int i, tmplvl;
|
||||
int i, authlevel;
|
||||
|
||||
/* Check umodes */
|
||||
tmplvl = 0;
|
||||
authlevel = 0;
|
||||
for (i = 0; i < user_auth_mode_count; i++) {
|
||||
if(user_auth_modes[i].level == 0)
|
||||
break;
|
||||
if (u->Umode & user_auth_modes[i].umode) {
|
||||
tmplvl = user_auth_modes[i].level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dlog(DEBUG1, "UmodeAuth: umode level for %s is %d", u->nick, tmplvl);
|
||||
if(tmplvl > curlvl)
|
||||
curlvl = tmplvl;
|
||||
if (0){//protocol_info.features&FEATURE_USERSMODES) {
|
||||
/* Check smodes */
|
||||
tmplvl = 0;
|
||||
for (i = 0; i < user_auth_mode_count; i++) {
|
||||
if(user_auth_modes[i].level == 0)
|
||||
break;
|
||||
if (u->Smode & user_auth_modes[i].umode) {
|
||||
tmplvl = user_auth_modes[i].level;
|
||||
break;
|
||||
if(user_auth_modes[i].level > authlevel) {
|
||||
authlevel = user_auth_modes[i].level;
|
||||
}
|
||||
}
|
||||
dlog(DEBUG1, "UmodeAuth: smode level for %s is %d", u->nick, tmplvl);
|
||||
if(tmplvl > curlvl)
|
||||
curlvl = tmplvl;
|
||||
}
|
||||
dlog(DEBUG1, "UmodeAuth: umode level for %s is %d", u->nick, authlevel);
|
||||
if (HaveFeature (FEATURE_USERSMODES)) {
|
||||
/* Check smodes */
|
||||
for (i = 0; i < user_auth_mode_count; i++) {
|
||||
if (u->Smode & user_auth_modes[i].umode) {
|
||||
if(user_auth_modes[i].level > authlevel) {
|
||||
authlevel = user_auth_modes[i].level;
|
||||
}
|
||||
}
|
||||
}
|
||||
dlog(DEBUG1, "UmodeAuth: smode level for %s is %d", u->nick, authlevel);
|
||||
}
|
||||
/* Return new level */
|
||||
return curlvl;
|
||||
return authlevel;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ static int ls_thankyou(CmdParams* cmdparams);
|
|||
|
||||
static Bot *ls_bot;
|
||||
|
||||
const char *ns_copyright[] = {
|
||||
const char *ls_copyright[] = {
|
||||
"Copyright (c) 1999-2004, NeoStats",
|
||||
"http://www.neostats.net/",
|
||||
NULL
|
||||
|
@ -48,7 +48,7 @@ const char *ns_copyright[] = {
|
|||
ModuleInfo module_info = {
|
||||
"LoveServ",
|
||||
"Network love service",
|
||||
ns_copyright, //Shmad <shmad@neostats.net>"
|
||||
ls_copyright,
|
||||
ls_about,
|
||||
NEOSTATS_VERSION,
|
||||
CORE_MODULE_VERSION,
|
||||
|
@ -58,15 +58,6 @@ ModuleInfo module_info = {
|
|||
0,
|
||||
};
|
||||
|
||||
static BotInfo ls_botinfo =
|
||||
{
|
||||
"LoveServ",
|
||||
"LoveServ",
|
||||
"LS",
|
||||
"",
|
||||
"Network love service",
|
||||
};
|
||||
|
||||
static bot_cmd ls_commands[]=
|
||||
{
|
||||
{"ROSE", ls_rose, 1, 0, ls_help_rose, ls_help_rose_oneline },
|
||||
|
@ -82,48 +73,21 @@ static bot_cmd ls_commands[]=
|
|||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *ns_help_set_nick[] = {
|
||||
"\2NICK <newnick>\2 Change bot nickname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_altnick[] = {
|
||||
"\2ALTNICK <newnick>\2 Change bot alternate nickname",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_user[] = {
|
||||
"\2USER <username>\2 Change bot username",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_host[] = {
|
||||
"\2HOST <host>\2 Change bot host",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_realname[] = {
|
||||
"\2REALNAME <realname>\2 Change bot realname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
static bot_setting ls_settings[]=
|
||||
static BotInfo ls_botinfo =
|
||||
{
|
||||
{"NICK", &ls_botinfo.nick, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick, NULL, (void*)"LoveServ" },
|
||||
{"ALTNICK", &ls_botinfo.altnick,SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "AltNick", NULL, ns_help_set_altnick, NULL, (void*)"LoveServ" },
|
||||
{"USER", &ls_botinfo.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user, NULL, (void*)"LS" },
|
||||
{"HOST", &ls_botinfo.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host, NULL, (void*)"" },
|
||||
{"REALNAME",&ls_botinfo.realname,SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname, NULL, (void*)"Network love service" },
|
||||
"LoveServ",
|
||||
"LoveServ1",
|
||||
"LS",
|
||||
BOT_COMMON_HOST,
|
||||
"Network love service",
|
||||
BOT_FLAG_SERVICEBOT|BOT_FLAG_DEAF,
|
||||
ls_commands,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int ls_event_online(CmdParams* cmdparams)
|
||||
{
|
||||
ls_bot = init_bot(&ls_botinfo, me.servicesumode,
|
||||
BOT_FLAG_DEAF, ls_commands, ls_settings);
|
||||
ls_bot = init_bot(&ls_botinfo);
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
@ -134,7 +98,6 @@ ModuleEvent module_events[] = {
|
|||
|
||||
int ModInit(Module* mod_ptr)
|
||||
{
|
||||
ModuleConfig(ls_settings);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,16 +26,6 @@
|
|||
#include "neostats.h"
|
||||
#include "ms.h"
|
||||
|
||||
static Bot *ms_bot;
|
||||
static BotInfo ms_botinfo =
|
||||
{
|
||||
"MoraleServ",
|
||||
"MoraleServ",
|
||||
"MS",
|
||||
"",
|
||||
"Network morale service",
|
||||
};
|
||||
|
||||
static int ms_hail(CmdParams* cmdparams);
|
||||
static int ms_ode(CmdParams* cmdparams);
|
||||
static int ms_lapdance(CmdParams* cmdparams);
|
||||
|
@ -45,7 +35,9 @@ static int ms_cheerup(CmdParams* cmdparams);
|
|||
static int ms_behappy(CmdParams* cmdparams);
|
||||
static int ms_wonderful(CmdParams* cmdparams);
|
||||
|
||||
const char *ns_copyright[] = {
|
||||
static Bot *ms_bot;
|
||||
|
||||
const char *ms_copyright[] = {
|
||||
"Copyright (c) 1999-2004, NeoStats",
|
||||
"http://www.neostats.net/",
|
||||
NULL
|
||||
|
@ -54,7 +46,7 @@ const char *ns_copyright[] = {
|
|||
ModuleInfo module_info = {
|
||||
"MoraleServ",
|
||||
"Network morale service",
|
||||
ns_copyright, // Author: ^Enigma^ <enigma@neostats.net>
|
||||
ms_copyright, // Author: ^Enigma^ <enigma@neostats.net>
|
||||
ms_about,
|
||||
NEOSTATS_VERSION,
|
||||
CORE_MODULE_VERSION,
|
||||
|
@ -77,48 +69,21 @@ static bot_cmd ms_commands[]=
|
|||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *ns_help_set_nick[] = {
|
||||
"\2NICK <newnick>\2 Change bot nickname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_altnick[] = {
|
||||
"\2ALTNICK <newnick>\2 Change bot alternate nickname",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_user[] = {
|
||||
"\2USER <username>\2 Change bot username",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_host[] = {
|
||||
"\2HOST <host>\2 Change bot host",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *ns_help_set_realname[] = {
|
||||
"\2REALNAME <realname>\2 Change bot realname",
|
||||
"(requires restart to take effect).",
|
||||
NULL
|
||||
};
|
||||
|
||||
static bot_setting ms_settings[]=
|
||||
static BotInfo ms_botinfo =
|
||||
{
|
||||
{"NICK", &ms_botinfo.nick, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick, NULL, (void*)"MoraleServ" },
|
||||
{"ALTNICK", &ms_botinfo.altnick,SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "AltNick", NULL, ns_help_set_altnick, NULL, (void*)"MoraleServ" },
|
||||
{"USER", &ms_botinfo.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user, NULL, (void*)"MS" },
|
||||
{"HOST", &ms_botinfo.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host, NULL, (void*)"" },
|
||||
{"REALNAME",&ms_botinfo.realname,SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname, NULL, (void*)"Network morale service" },
|
||||
"MoraleServ",
|
||||
"MoraleServ1",
|
||||
"MS",
|
||||
BOT_COMMON_HOST,
|
||||
"Network morale service",
|
||||
BOT_FLAG_SERVICEBOT|BOT_FLAG_DEAF,
|
||||
ms_commands,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int ms_event_online(CmdParams* cmdparams)
|
||||
{
|
||||
ms_bot = init_bot (&ms_botinfo, me.servicesumode,
|
||||
BOT_FLAG_DEAF, ms_commands, ms_settings);
|
||||
ms_bot = init_bot (&ms_botinfo);
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
@ -129,7 +94,6 @@ ModuleEvent module_events[] = {
|
|||
|
||||
int ModInit(Module* mod_ptr)
|
||||
{
|
||||
ModuleConfig(ms_settings);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ EXPORTVAR extern unsigned int ircd_supported_smodes;
|
|||
#define MAX_TRANSFERS 10 /* number of curl transfers */
|
||||
|
||||
#define bzero(x, y) memset(x, '\0', y);
|
||||
#define is_synced me.synced
|
||||
#define is_synched me.synched
|
||||
|
||||
/* Early creation of unified return values and error system */
|
||||
/* These are program exit codes usually defined in stdlib.h but
|
||||
|
@ -445,7 +445,7 @@ typedef struct tme {
|
|||
char servicesumode[64];
|
||||
char serviceschan[MAXCHANLEN];
|
||||
unsigned int onchan:1;
|
||||
unsigned int synced:1;
|
||||
unsigned int synched:1;
|
||||
Server *s;
|
||||
int requests;
|
||||
long SendM;
|
||||
|
@ -630,7 +630,7 @@ typedef struct bot_cmd {
|
|||
const char *cmd; /* command string */
|
||||
bot_cmd_handler handler; /* handler */
|
||||
int minparams; /* min num params */
|
||||
unsigned int ulevel; /* min user level */
|
||||
int ulevel; /* min user level */
|
||||
const char** helptext; /* pointer to help text */
|
||||
const char* onelinehelp;/* single line help for generic help function */
|
||||
}bot_cmd;
|
||||
|
@ -661,6 +661,12 @@ typedef struct bot_cmd {
|
|||
*/
|
||||
#define BOT_FLAG_SERVICEBOT 0x00000008
|
||||
|
||||
/* This defines a "NULL" string for the purpose of BotInfo structures that
|
||||
* want to inherit the main host used by NeoStats and still make the info
|
||||
* readable
|
||||
*/
|
||||
#define BOT_COMMON_HOST ""
|
||||
|
||||
/* SET Comand handling */
|
||||
|
||||
typedef enum SET_TYPE {
|
||||
|
@ -694,9 +700,9 @@ typedef struct bot_setting {
|
|||
char *option; /* option string */
|
||||
void* varptr; /* pointer to var */
|
||||
SET_TYPE type; /* type of var */
|
||||
unsigned int min; /* min value */
|
||||
unsigned int max; /* max value */
|
||||
unsigned int ulevel; /* min user level */
|
||||
int min; /* min value */
|
||||
int max; /* max value */
|
||||
int ulevel; /* min user level */
|
||||
char *confitem; /* config string for kptool */
|
||||
const char *desc; /* description of setting for messages e.g. seconds, days*/
|
||||
const char** helptext; /* pointer to help text */
|
||||
|
@ -799,6 +805,7 @@ typedef struct Module {
|
|||
mod_auth mod_auth_cb;
|
||||
void *dl_handle;
|
||||
unsigned int modnum;
|
||||
unsigned int synched;
|
||||
}Module;
|
||||
|
||||
extern Module* RunModule[10];
|
||||
|
@ -880,6 +887,12 @@ typedef struct BotInfo {
|
|||
char host[MAXHOST];
|
||||
/* REQUIRED: realname */
|
||||
char realname[MAXREALNAME];
|
||||
/* OPTIONAL: flags */
|
||||
unsigned int flags;
|
||||
/* OPTIONAL: bot command list pointer */
|
||||
bot_cmd *bot_cmd_list;
|
||||
/* OPTIONAL: bot command setting pointer */
|
||||
bot_setting *bot_setting_list;
|
||||
} BotInfo;
|
||||
|
||||
/** @brief Bot structure
|
||||
|
@ -896,9 +909,11 @@ typedef struct _Bot {
|
|||
/* hash for command list */
|
||||
hash_t *botcmds;
|
||||
/* hash for settings */
|
||||
bot_setting *bot_settings;
|
||||
hash_t *botsettings;
|
||||
/* hash for bot_info settings */
|
||||
bot_setting *bot_info_settings;
|
||||
/* min ulevel for settings */
|
||||
unsigned int set_ulevel;
|
||||
int set_ulevel;
|
||||
/* Link back to user struct associated with this bot*/
|
||||
User* u;
|
||||
}_Bot;
|
||||
|
@ -915,7 +930,7 @@ EXPORTFUNC int add_sockpoll (before_poll_function beforepoll, after_poll_functio
|
|||
EXPORTFUNC int del_socket (const char *name);
|
||||
EXPORTFUNC Sock *findsock (const char *sock_name);
|
||||
|
||||
EXPORTFUNC Bot * init_bot (BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list);
|
||||
EXPORTFUNC Bot * init_bot (BotInfo* botinfo);
|
||||
EXPORTFUNC int del_bot (Bot *botptr, const char * reason);
|
||||
EXPORTFUNC Bot *findbot (const char * bot_name);
|
||||
EXPORTFUNC int bot_nick_change (const char * oldnick, const char *newnick);
|
||||
|
@ -1020,6 +1035,8 @@ EXPORTFUNC int test_chan_user_mode(char* chan, char* nick, int flag);
|
|||
#define is_chanprot(chan, nick) test_chan_user_mode(chan, nick, CUMODE_CHANPROT)
|
||||
#define is_chanadmin(chan, nick) test_chan_user_mode(chan, nick, CUMODE_CHANADMIN)
|
||||
|
||||
EXPORTVAR unsigned char UmodeChRegNick;
|
||||
|
||||
/* dns.c */
|
||||
EXPORTFUNC int dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answer * a), char *data);
|
||||
|
||||
|
@ -1045,13 +1062,6 @@ EXPORTFUNC int new_transfer(char *url, char *params, NS_TRANSFER savetofileormem
|
|||
/* Mark server as synched */
|
||||
#define SynchServer(x) (((x)->flags |= NS_FLAGS_SYNCHED))
|
||||
|
||||
/* Some standard text help messages */
|
||||
extern EXPORTVAR const char *ns_help_set_nick[];
|
||||
extern EXPORTVAR const char *ns_help_set_altnick[];
|
||||
extern EXPORTVAR const char *ns_help_set_user[];
|
||||
extern EXPORTVAR const char *ns_help_set_host[];
|
||||
extern EXPORTVAR const char *ns_help_set_realname[];
|
||||
|
||||
extern const char *ns_copyright[];
|
||||
|
||||
EXPORTFUNC int validate_nick (char* nick);
|
||||
|
@ -1133,13 +1143,15 @@ void GetUserList(UserListHandler handler);
|
|||
typedef void (*ServerListHandler) (Server * s);
|
||||
void GetServerList(ServerListHandler handler);
|
||||
|
||||
EXPORTFUNC int HaveFeature (int mask);
|
||||
|
||||
/*
|
||||
* Module Interface
|
||||
*/
|
||||
int MODULEFUNC ModInit(Module* mod_ptr);
|
||||
void MODULEFUNC ModFini(void);
|
||||
int MODULEFUNC ModAuth (User * u);
|
||||
int MODULEFUNC ModAuthUser(User * u, int curlvl);
|
||||
int MODULEFUNC ModAuthUser(User * u);
|
||||
int MODULEFUNC ModAuthList(User * u);
|
||||
extern MODULEVAR ModuleInfo module_info;
|
||||
extern MODULEVAR ModuleEvent module_events[];
|
||||
|
|
|
@ -45,6 +45,10 @@ const char ns_help_userdump_oneline[]="Dump user table";
|
|||
const char ns_help_chandump_oneline[]="Dump channel table";
|
||||
const char ns_help_serverdump_oneline[]="Dump server table";
|
||||
const char ns_help_bandump_oneline[]="Dump ban table";
|
||||
const char cmd_help_oneline[]="Online help";
|
||||
const char cmd_help_about_oneline[] = "Display About info";
|
||||
const char cmd_help_credits_oneline[] = "Display credits";
|
||||
const char cmd_help_version_oneline[] = "Display version";
|
||||
|
||||
const char *ns_help_level[] = {
|
||||
"Syntax: \2LEVEL [nick]\2",
|
||||
|
@ -332,3 +336,42 @@ const char *ns_copyright[] = {
|
|||
"http://www.neostats.net/",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cmd_help_help[] = {
|
||||
"Syntax: \2HELP [command]\2",
|
||||
"",
|
||||
"Provides help on the bot commands",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cmd_help_about[] = {
|
||||
"Syntax: \2ABOUT\2",
|
||||
"",
|
||||
"Provides information about the module",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cmd_help_credits[] = {
|
||||
"Syntax: \2CREDITS\2",
|
||||
"",
|
||||
"Show credits",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cmd_help_version[] = {
|
||||
"Syntax: \2VERSION\2",
|
||||
"",
|
||||
"Show version information",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *cmd_help_set[] = {
|
||||
"Syntax: \2SET LIST\2",
|
||||
" \2SET <option> [<value>]\2",
|
||||
"",
|
||||
"LIST display the current settings",
|
||||
"",
|
||||
"Available Options are:",
|
||||
"",
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -67,6 +67,11 @@ extern const char ns_help_chandump_oneline[];
|
|||
extern const char ns_help_serverdump_oneline[];
|
||||
extern const char ns_help_bandump_oneline[];
|
||||
|
||||
extern const char *ns_help_set_nick[];
|
||||
extern const char *ns_help_set_altnick[];
|
||||
extern const char *ns_help_set_user[];
|
||||
extern const char *ns_help_set_host[];
|
||||
extern const char *ns_help_set_realname[];
|
||||
extern const char *ns_help_set_pingtime[];
|
||||
extern const char *ns_help_set_versionscan[];
|
||||
extern const char *ns_help_set_servicecmode[];
|
||||
|
@ -78,4 +83,14 @@ extern const char *ns_help_set_debugchan[];
|
|||
extern const char *ns_help_set_debugtochan[];
|
||||
extern const char *ns_help_set_debugmodule[];
|
||||
|
||||
extern const char cmd_help_oneline[];
|
||||
extern const char cmd_help_about_oneline[];
|
||||
extern const char cmd_help_credits_oneline[];
|
||||
extern const char cmd_help_version_oneline[];
|
||||
extern const char *cmd_help_help[];
|
||||
extern const char *cmd_help_about[];
|
||||
extern const char *cmd_help_credits[];
|
||||
extern const char *cmd_help_version[];
|
||||
extern const char *cmd_help_set[];
|
||||
|
||||
#endif /* _NS_HELP_H_ */
|
||||
|
|
|
@ -170,7 +170,7 @@ send_server (const char* sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSG_PASS, pass);
|
||||
send_cmd ("CAPAB TS3 SSJOIN BURST NICKIP");
|
||||
|
|
|
@ -167,7 +167,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s", MSG_PASS, pass);
|
||||
send_cmd ("%s %s %d :%s", MSG_NICK, "NeoStats", numeric, infoline);
|
||||
|
@ -204,7 +204,7 @@ send_sjoin (const char *sender, const char *who, const char *chan, const unsigne
|
|||
}
|
||||
|
||||
void
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts)
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s %s %s %s %lu", who, MSG_MODE, chan, mode, args, ts);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ send_svskill (const char *sender, const char *target, const char *reason)
|
|||
|
||||
/* akill is gone in the latest Unreals, so we set Glines instead */
|
||||
void
|
||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, unsigned long ts)
|
||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s + G %s %s %s %lu %lu :%s", sender, MSG_TKL, ident, host, setby, (ts + length), ts, reason);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSG_PASS, pass);
|
||||
send_cmd ("CAPAB :TS EX CHW IE EOB KLN GLN KNOCK HOPS HUB AOPS MX");
|
||||
|
|
|
@ -331,7 +331,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
-1 <description of new server>
|
||||
*/
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
/* Reset our numeric buffer */
|
||||
memset(neonicknumerics, 0 , sizeof(neonicknumerics));
|
||||
|
@ -465,12 +465,12 @@ send_wallops (const char *who, const char *buf)
|
|||
void
|
||||
send_end_of_burst_ack(void)
|
||||
{
|
||||
if (!me.synced) {
|
||||
if (!me.synched) {
|
||||
init_services_bot ();
|
||||
send_end_of_burst ();
|
||||
}
|
||||
send_cmd ("%s %s", neostatsbase64, TOK_END_OF_BURST_ACK);
|
||||
me.synced = 1;
|
||||
me.synched = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -192,7 +192,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSG_PASS, pass);
|
||||
send_cmd ("CAPAB TS3 SSJOIN BURST NICKIP");
|
||||
|
|
|
@ -187,7 +187,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s", MSGTOK(PASS), pass);
|
||||
send_cmd ("%s %s %d :%s", MSGTOK(SERVER), name, numeric, infoline);
|
||||
|
|
|
@ -169,7 +169,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSG_PASS, pass);
|
||||
send_cmd ("CAPAB :TS EOB HUB PARA");
|
||||
|
|
|
@ -205,7 +205,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSGTOK(PASS), pass);
|
||||
send_cmd ("CAPAB TS5 BURST SSJ5 NICKIP CLIENT");
|
||||
|
|
|
@ -183,7 +183,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s", MSG_PASS, pass);
|
||||
send_cmd ("%s %s %d :%s", MSG_SERVER, name, numeric, infoline);
|
||||
|
@ -221,7 +221,7 @@ send_join (const char *sender, const char *who, const char *chan, const unsigned
|
|||
}
|
||||
|
||||
void
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts)
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s %s %s %s %lu", who, MSGTOK(MODE), chan, mode, args, ts);
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSG_PASS, pass);
|
||||
send_cmd ("CAPAB TS5 BURST SSJ5 NICKIP CLIENT");
|
||||
|
@ -247,7 +247,7 @@ send_join (const char *sender, const char *who, const char *chan, const unsigned
|
|||
}
|
||||
|
||||
void
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts)
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s %s %s %s %lu", who, MSGTOK(MODE), chan, mode, args, ts);
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
/* PROTOCTL NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS SJB64 */
|
||||
send_cmd ("%s TOKEN NICKv2 VHP SJOIN SJOIN2 SJ3 UMODE2", MSGTOK(PROTOCTL));
|
||||
|
@ -252,7 +252,7 @@ send_sjoin (const char *sender, const char *who, const char *chan, const unsigne
|
|||
}
|
||||
|
||||
void
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts)
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s %s %s %s %lu", who, MSGTOK(MODE), chan, mode, args, ts);
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ send_svskill (const char *sender, const char *target, const char *reason)
|
|||
|
||||
/* akill is gone in the latest Unreals, so we set Glines instead */
|
||||
void
|
||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, unsigned long ts)
|
||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s + G %s %s %s %lu %lu :%s", sender, MSGTOK(TKL), ident, host, setby, (ts + length), ts, reason);
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ static const char Base64[] =
|
|||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char Pad64 = '=';
|
||||
|
||||
int b64_decode(char const *src, unsigned char *target, size_t targsize)
|
||||
int b64_decode(char const *src, unsigned char *target, int targsize)
|
||||
{
|
||||
int tarindex, state, ch;
|
||||
char *pos;
|
||||
|
@ -234,18 +234,18 @@ int b64_decode(char const *src, unsigned char *target, size_t targsize)
|
|||
switch (state) {
|
||||
case 0:
|
||||
if (target) {
|
||||
if ((size_t)tarindex >= targsize)
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] = (pos - Base64) << 2;
|
||||
target[tarindex] = (unsigned char)(pos - Base64) << 2;
|
||||
}
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (target) {
|
||||
if ((size_t)tarindex + 1 >= targsize)
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 4;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x0f)
|
||||
target[tarindex+1] = (unsigned char)((pos - Base64) & 0x0f)
|
||||
<< 4 ;
|
||||
}
|
||||
tarindex++;
|
||||
|
@ -253,10 +253,10 @@ int b64_decode(char const *src, unsigned char *target, size_t targsize)
|
|||
break;
|
||||
case 2:
|
||||
if (target) {
|
||||
if ((size_t)tarindex + 1 >= targsize)
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 2;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x03)
|
||||
target[tarindex+1] = (unsigned char)((pos - Base64) & 0x03)
|
||||
<< 6;
|
||||
}
|
||||
tarindex++;
|
||||
|
@ -264,7 +264,7 @@ int b64_decode(char const *src, unsigned char *target, size_t targsize)
|
|||
break;
|
||||
case 3:
|
||||
if (target) {
|
||||
if ((size_t)tarindex >= targsize)
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64);
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
/* PROTOCTL NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS SJB64 TKLEXT NICKIP CHANMODES=be,kfL,l,psmntirRcOAQKVGCuzNSMT */
|
||||
send_cmd ("%s TOKEN NICKv2 VHP SJOIN SJOIN2 SJ3 UMODE2 NICKIP", MSGTOK(PROTOCTL));
|
||||
|
@ -376,7 +376,7 @@ send_sjoin (const char *sender, const char *who, const char *chan, const unsigne
|
|||
}
|
||||
|
||||
void
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts)
|
||||
send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s %s %s %s %lu", who, MSGTOK(MODE), chan, mode, args, ts);
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ send_svskill (const char *sender, const char *target, const char *reason)
|
|||
|
||||
/* akill is gone in the latest Unreals, so we set Glines instead */
|
||||
void
|
||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, unsigned long ts)
|
||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const unsigned long length, const char *reason, const unsigned long ts)
|
||||
{
|
||||
send_cmd (":%s %s + G %s %s %s %lu %lu :%s", sender, MSGTOK(TKL), ident, host, setby, (ts + length), ts, reason);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
|||
}
|
||||
|
||||
void
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, const unsigned long tsboot, const unsigned long tslink)
|
||||
{
|
||||
send_cmd ("%s %s :TS", MSG_PASS, pass);
|
||||
send_cmd ("CAPAB TS3 SSJOIN BURST NICKIP");
|
||||
|
|
|
@ -337,7 +337,7 @@ PingServers (void)
|
|||
hscan_t ss;
|
||||
hnode_t *sn;
|
||||
|
||||
if(!me.synced)
|
||||
if(!me.synched)
|
||||
return;
|
||||
dlog(DEBUG3, "Sending pings...");
|
||||
ping.ulag = 0;
|
||||
|
|
|
@ -122,12 +122,17 @@ static bot_setting ns_settings[]=
|
|||
};
|
||||
|
||||
Bot* ns_botptr = NULL;
|
||||
|
||||
BotInfo ns_botinfo = {
|
||||
"NeoStats",
|
||||
"NeoStats-",
|
||||
"",
|
||||
"",
|
||||
"NeoStats1",
|
||||
"Neo",
|
||||
BOT_COMMON_HOST,
|
||||
"",
|
||||
/* 0x80000000 is a "hidden" flag to identify the core bot */
|
||||
0x80000000|BOT_FLAG_SERVICEBOT|BOT_FLAG_DEAF,
|
||||
ns_commands,
|
||||
ns_settings,
|
||||
};
|
||||
|
||||
/** @brief InitServices
|
||||
|
@ -155,17 +160,15 @@ void InitServices(void)
|
|||
int
|
||||
init_services_bot (void)
|
||||
{
|
||||
unsigned int flags;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
ircsnprintf (ns_botinfo.realname, MAXREALNAME, "/msg %s \2HELP\2", ns_botinfo.nick);
|
||||
flags = config.onlyopers ? BOT_FLAG_ONLY_OPERS : 0;
|
||||
flags |= BOT_FLAG_DEAF;
|
||||
ns_botptr = init_bot (&ns_botinfo, me.servicesumode, flags, ns_commands, ns_settings);
|
||||
if(config.onlyopers)
|
||||
ns_botinfo.flags |= BOT_FLAG_ONLY_OPERS;
|
||||
ns_botinfo.flags |= BOT_FLAG_DEAF;
|
||||
ns_botptr = init_bot (&ns_botinfo);
|
||||
me.onchan = 1;
|
||||
SendAllModuleEvent (EVENT_ONLINE, NULL);
|
||||
RequestServerUptimes();
|
||||
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef struct neoroot {
|
|||
/* general configuration items */
|
||||
typedef struct tconfig {
|
||||
/* log level */
|
||||
unsigned int loglevel;
|
||||
LOG_LEVEL loglevel;
|
||||
/* debug level */
|
||||
unsigned int debuglevel;
|
||||
/* enable recv.log */
|
||||
|
|
|
@ -127,7 +127,7 @@ ConnectTo (char *host, int port)
|
|||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
if ((s = (int)socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
sfree(hp);
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ sock_connect (int socktype, unsigned long ipaddr, int port, const char *name, so
|
|||
|
||||
moduleptr = GET_CUR_MODULE();
|
||||
/* socktype = SOCK_STREAM */
|
||||
if ((s = socket (AF_INET, socktype, 0)) < 0)
|
||||
if ((s = (int)socket (AF_INET, socktype, 0)) < 0)
|
||||
return NS_FAILURE;
|
||||
|
||||
/* bind to an IP address */
|
||||
|
|
|
@ -67,7 +67,7 @@ CheckTimers (void)
|
|||
/* flush log files */
|
||||
fflush (NULL);
|
||||
}
|
||||
if (me.synced && config.setservertimes) {
|
||||
if (me.synched && config.setservertimes) {
|
||||
if((me.now - lastservertimesync) > config.setservertimes) {
|
||||
/* The above check does not need to be exact, but
|
||||
setting times ought to be so reset me.now */
|
||||
|
|
|
@ -143,7 +143,7 @@ AddUser (const char *nick, const char *user, const char *host, const char *realn
|
|||
}
|
||||
sfree (cmdparams);
|
||||
/* Send CTCP VERSION request if we are configured to do so */
|
||||
if(is_synced && config.versionscan && !IsExcluded(u) && !IsMe(u)) {
|
||||
if(is_synched && config.versionscan && !IsExcluded(u) && !IsMe(u)) {
|
||||
privmsg(u->nick, ns_botptr->nick, "\1VERSION\1");
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +647,11 @@ UserLevel (User * u)
|
|||
else
|
||||
#endif
|
||||
#endif
|
||||
ulevel = UserAuth(u);
|
||||
if(IsServiceRoot(u)) {
|
||||
ulevel = NS_ULEVEL_ROOT;
|
||||
} else {
|
||||
ulevel = UserAuth(u);
|
||||
}
|
||||
|
||||
/* Set user level so we no longer need to calculate */
|
||||
/* TODO: Under what circumstances do we reset this e.g. nick change? */
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
int opterr = 1;
|
||||
int optind = 1;
|
||||
int optopt;
|
||||
char* optarg;
|
||||
|
||||
#define BADCH (int)
|
||||
#define EMSG ""
|
||||
#define report(s) \
|
||||
{ \
|
||||
fputs(*argv,stderr); \
|
||||
fputs(s,stderr); \
|
||||
fputc(optopt,stderr); \
|
||||
fputc('\n',stderr); \
|
||||
return('?'); \
|
||||
}
|
||||
|
||||
int getopt(int argc, char * const *argv, const char *optstring)
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
register char *oli; /* option letter list index */
|
||||
|
||||
if(!*place) { /* update scanning pointer */
|
||||
if(optind >= argc || *(place = argv[optind]) != '-' || !*++place)
|
||||
return(EOF);
|
||||
if (*place == '-') { /* found "--" */
|
||||
++optind;
|
||||
return(EOF);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' || !(oli = strchr(optstring,optopt)))
|
||||
{
|
||||
if(!*place) ++optind;
|
||||
report(": illegal option -- ");
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place) ++optind;
|
||||
}
|
||||
else { /* need an argument */
|
||||
if (*place) optarg = place; /* no white space */
|
||||
else if (argc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
report(": option requires an argument -- ");
|
||||
}
|
||||
else optarg = argv[optind]; /* white space */
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return(optopt); /* dump back option letter */
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
#ifndef GETOPT_H
|
||||
#define GETOPT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int opterr; /* useless, never set or used */
|
||||
extern int optind; /* index into parent argv vector */
|
||||
extern int optopt; /* character checked for validity */
|
||||
extern char* optarg; /* argument associated with option */
|
||||
|
||||
int getopt(int argc, char * const *argv, const char *optstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GETOPT_H */
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\src;..\..\src\adnswin32;..\..\src\keeper;..\..\src\curl;..\..\src\pcre"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ADNS_MAP_UNIXAPI"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ADNS_MAP_UNIXAPI;NEOSTATSCORE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
@ -175,12 +175,6 @@
|
|||
<File
|
||||
RelativePath="..\..\src\conf.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\config.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\config.h.in">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\configwin32.h">
|
||||
</File>
|
||||
|
@ -331,23 +325,8 @@
|
|||
<File
|
||||
RelativePath="..\..\src\users.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\version.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="win32">
|
||||
<File
|
||||
RelativePath="..\..\src\win32\fnmatch.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\win32\fnmatch.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\win32\getopt.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\win32\getopt.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\win32\winmain.c">
|
||||
</File>
|
||||
|
@ -392,6 +371,9 @@
|
|||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\ChangeLog">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
Reference in a new issue