X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=bot_NeonServ.c;h=71f5942d20fd5376fbf9a5db4f8e5604b5b9859a;hb=795115bf680185ae01043bd1222b78bfed8c1d87;hp=8b4ba9c38991217f36e119bb780cb6f65a9b0388;hpb=3a62fa1ecbcd8f52981c9a5057412876ed0ee970;p=NeonServV5.git diff --git a/bot_NeonServ.c b/bot_NeonServ.c index 8b4ba9c..71f5942 100644 --- a/bot_NeonServ.c +++ b/bot_NeonServ.c @@ -18,6 +18,7 @@ #include "timeq.h" #include "version.h" #include "EventLogger.h" +#include "cmd_neonserv.h" #define BOTID 1 @@ -124,6 +125,45 @@ static const struct default_language_entry msgtab[] = { {"NS_SET_DEFAULTS_CODE", "To reset %s's settings to the defaults, you must use 'set defaults %s'."}, /* {ARGS: "#TestChan", "abc123"} */ {"NS_SET_DEFAULTS_DONE", "All settings for %s have been reset to default values."}, /* {ARGS: "#TestChan"} */ {"NS_SET_TRIGGER_OWNER", "You must have access 500 in %s to change the channel trigger."}, /* {ARGS: "#TestChan"} */ + {"NS_SET_HELP_USERINFO","(access to set the userinfo)"}, + {"NS_SET_HELP_WIPEINFO","(access to clear the userinfo of other users)"}, + {"NS_SET_HELP_INVITEME","(access to get invited by the bot)"}, + {"NS_SET_HELP_ENFVOICE","(access to give voice to other users)"}, + {"NS_SET_HELP_ENFOPS","(access to give op to their users)"}, + {"NS_SET_HELP_GIVEOPS","(access to get op by the bot)"}, + {"NS_SET_HELP_GIVEVOICE","(access to get voice by the bot)"}, + {"NS_SET_HELP_KICK","(access to kick other users from the channel)"}, + {"NS_SET_HELP_BAN","(access to ban other users from the channel)"}, + {"NS_SET_HELP_STATICBAN","(access to add static bans to the channel banlist e.g. +addban)"}, + {"NS_SET_HELP_PUBCMD","(access to do public commands in the channel e.g. +users)"}, + {"NS_SET_HELP_ENFMODES","(access to override the modelock)"}, + {"NS_SET_HELP_ENFTOPIC","(access to override the topicmask)"}, + {"NS_SET_HELP_TOPICSNARF","(access to set the default topic by changing the topic with /TOPIC)"}, + {"NS_SET_HELP_CHANGETOPIC","(access to change the topic)"}, + {"NS_SET_HELP_SETTERS","(access to change this settings)"}, + {"NS_SET_HELP_ADDUSER","(access to add an user to the userlist)"}, + {"NS_SET_HELP_DELUSER","(access to delete an user from the userlist)"}, + {"NS_SET_HELP_CLVL","(access to change the access of an user in the userlist)"}, + {"NS_SET_HELP_RESYNC","(access to synchronize the channelrights (@,+) with the userlist)"}, + {"NS_SET_HELP_SUSPEND","(access to suspend an user on the userlist)"}, + {"NS_SET_OPTION_CTCPREACTION_0","Kick on disallowed CTCPs"}, + {"NS_SET_OPTION_CTCPREACTION_1","Kickban on disallowed CTCPs"}, + {"NS_SET_OPTION_CTCPREACTION_2","Short timed ban on disallowed CTCPs"}, + {"NS_SET_OPTION_CTCPREACTION_3","Long timed ban on disallowed CTCPs"}, + {"NS_SET_OPTION_NOTICEREACTION_0","Kick on disallowed NOTICEs"}, + {"NS_SET_OPTION_NOTICEREACTION_1","Kickban on disallowed NOTICEs"}, + {"NS_SET_OPTION_NOTICEREACTION_2","Short timed ban on disallowed NOTICEs"}, + {"NS_SET_OPTION_NOTICEREACTION_3","Long timed ban on disallowed NOTICEs"}, + {"NS_SET_OPTION_PROTECT_0","All users will be protected from users with equal or lower access."}, + {"NS_SET_OPTION_PROTECT_1","All users with access will be protected from users with equal or lower access."}, + {"NS_SET_OPTION_PROTECT_2","All users with access will be protected from user with lower access."}, + {"NS_SET_OPTION_PROTECT_3","Nobody will be protected."}, + {"NS_SET_OPTION_TOYS_0","Funcommands can't be used."}, + {"NS_SET_OPTION_TOYS_1","Funcommands are possible but the reply will be sent as a notice."}, + {"NS_SET_OPTION_TOYS_2","Funcommands are possible and the reply will be sent to the channel."}, + {"NS_SET_OPTION_DYNLIMIT_0","off"}, + {"NS_SET_OPTION_NODELETE_0","off (only bot masters)"}, + {"NS_SET_OPTION_NODELETE_1","on (only bot masters)"}, {"NS_WIPEINFO_DONE", "Removed $b%s$b's infoline in $b%s$b."}, /* {ARGS: "TestUser", "#TestChan"} */ {"NS_TRACE_HEADER", "The following users were found:"}, {"NS_ADDBAN_DONE", "$b%s$b permantly added to the %s ban list. (matching %d users)"}, /* {ARGS: "*!*@Test.*", "#TestChan", 4} */ @@ -220,100 +260,31 @@ static const struct default_language_entry msgtab[] = { {"NS_SEARCH_HEADER", "The following channels were found:"}, {"NS_COMMAND_BINDING", "$b%s$b is a binding of %s %s"}, /* {ARGS: "TestCommand", "TestFunction", "TestParameters"} */ {"NS_COMMAND_ACCESS", "You need at least %d channel access and %d oper access to execute this command."}, /* {ARGS: 500, 100} */ + {"NS_TOPIC_ACCESS", "You lack sufficient access in %s to change the topic."}, /* {ARGS: "#TestChan"} */ + {"NS_BOTWAR_DETECTED", "$b$k4BOTWAR DETECTED!$k Please check the channel configuration!$b"}, + {"NS_BOTWAR_REPORTED", "A supporter has been informed to help you preventing botwars in the future."}, + {"NS_BOTWAR_ALERT", "$b$k4BOTWAR ALERT:$k$b Botwar in $b%s$b detected. (opponent: $b%s$b) Please join and help them preventing Botwars."}, /* {ARGS: "#TestChan", "OtherBot"} */ + {"NS_INVITE_FAIL", "$b%s$b is not registered with %s or suspended."}, /* {ARGS: "#TestChan", "NeonServ"} */ + {"NS_SETACCESS_DONE", "$b%s$b has now %d global access."}, {NULL, NULL} }; -//define some useful functions :D -static TIMEQ_CALLBACK(channel_ban_timeout); -static struct ClientSocket *getBotForChannel(struct ChanNode *chan); - -/* -INCLUDE ALL CMD's HERE +/* TODO: +trim bans +cmd_neonserv_open.c +cmd_neonserv_info.c +parse, check and set modelock +cmd_neonserv_modcmd.c +cmd_neonserv_allowregister.c +cmd_neonserv_noregister.c +cmd_neonserv_expire.c +cmd_neonserv_unvisited.c +cmd_neonserv_merge.c +cmd_neonserv_dnrsearch.c +cmd_neonserv_rename.c +cmd_neonserv_iplocate.c +cmd_neonserv_calc.c */ -//USER CMD's -#include "cmd_neonserv_access.c" -#include "cmd_neonserv_myaccess.c" -#include "cmd_neonserv_adduser.c" -#include "cmd_neonserv_clvl.c" -#include "cmd_neonserv_deluser.c" -#include "cmd_neonserv_delme.c" -#include "cmd_neonserv_mdeluser.c" -#include "cmd_neonserv_trim.c" /* TODO: trim bans */ -#include "cmd_neonserv_giveowner.c" -#include "cmd_neonserv_users.c" -#include "cmd_neonserv_up.c" -#include "cmd_neonserv_down.c" -#include "cmd_neonserv_upall.c" -#include "cmd_neonserv_downall.c" -#include "cmd_neonserv_op.c" -#include "cmd_neonserv_opall.c" -#include "cmd_neonserv_deop.c" -#include "cmd_neonserv_deopall.c" -#include "cmd_neonserv_voice.c" -#include "cmd_neonserv_voiceall.c" -#include "cmd_neonserv_devoice.c" -#include "cmd_neonserv_devoiceall.c" -#include "cmd_neonserv_uset.c" -#include "cmd_neonserv_kick.c" -#include "cmd_neonserv_kickban.c" -#include "cmd_neonserv_ban.c" -#include "cmd_neonserv_unban.c" -#include "cmd_neonserv_unbanall.c" -#include "cmd_neonserv_unbanme.c" -#include "cmd_neonserv_suspend.c" -#include "cmd_neonserv_unsuspend.c" -#include "cmd_neonserv_wipeinfo.c" -#include "cmd_neonserv_addban.c" -#include "cmd_neonserv_addtimeban.c" -#include "cmd_neonserv_delban.c" -#include "cmd_neonserv_bans.c" -//#include "cmd_neonserv_open.c" -#include "cmd_neonserv_topic.c" -#include "cmd_neonserv_mode.c" -#include "cmd_neonserv_invite.c" -#include "cmd_neonserv_inviteme.c" -//#include "cmd_neonserv_info.c" -#include "cmd_neonserv_netinfo.c" -#include "cmd_neonserv_peek.c" -#include "cmd_neonserv_set.c" /* TODO: parse, check and set modelock */ -//#include "cmd_neonserv_events.c" -#include "cmd_neonserv_resync.c" -#include "cmd_neonserv_help.c" -#include "cmd_neonserv_version.c" -#include "cmd_neonserv_chanservsync.c" -#include "cmd_neonserv_events.c" -#include "cmd_neonserv_command.c" - -//OPER CMD's -#include "cmd_neonserv_bind.c" -#include "cmd_neonserv_unbind.c" -//#include "cmd_neonserv_modcmd.c" -#include "cmd_neonserv_register.c" -#include "cmd_neonserv_unregister.c" -#include "cmd_neonserv_recover.c" -//#include "cmd_neonserv_allowregister.c" -//#include "cmd_neonserv_noregister.c" -#include "cmd_neonserv_god.c" -//#include "cmd_neonserv_expire.c" -#include "cmd_neonserv_csuspend.c" -#include "cmd_neonserv_cunsuspend.c" -//#include "cmd_neonserv_unvisited.c" -//#include "cmd_neonserv_merge.c" -#include "cmd_neonserv_move.c" -//#include "cmd_neonserv_dnrsearch.c" -#include "cmd_neonserv_search.c" -#include "cmd_neonserv_trace.c" -#include "cmd_neonserv_say.c" -#include "cmd_neonserv_emote.c" -#include "cmd_neonserv_notice.c" -#include "cmd_neonserv_raw.c" -#include "cmd_neonserv_reloadlang.c" -#include "cmd_neonserv_oplog.c" - -//HARDCODED FUN CMD's -//#include "cmd_neonserv_iplocate.c" -//#include "cmd_neonserv_calc.c" - //EVENTS #include "event_neonserv_join.c" #include "event_neonserv_part.c" @@ -322,9 +293,10 @@ INCLUDE ALL CMD's HERE //#include "event_neonserv_mode.c" #include "event_neonserv_ctcp.c" #include "event_neonserv_notice.c" -//#include "event_neonserv_invite.c" +#include "event_neonserv_invite.c" +#include "event_neonserv_topic.c" -static struct ClientSocket *getBotForChannel(struct ChanNode *chan) { +struct ClientSocket *getBotForChannel(struct ChanNode *chan) { struct ClientSocket *bot, *use_bot = NULL, *second_bot = NULL, *third_bot = NULL; struct ChanUser *chanuser; for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { @@ -418,7 +390,7 @@ static void start_bots() { } } -static TIMEQ_CALLBACK(channel_ban_timeout) { +TIMEQ_CALLBACK(channel_ban_timeout) { char *str_banid = data; MYSQL_RES *res; MYSQL_ROW row; @@ -509,6 +481,7 @@ void init_NeonServ() { OPER_COMMAND("unbind", neonserv_cmd_unbind, 1, 900, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH | CMDFLAG_OPLOG); OPER_COMMAND("oplog", neonserv_cmd_oplog, 0, 1, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH | CMDFLAG_OPLOG); OPER_COMMAND("search", neonserv_cmd_search, 1, 400, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH); + OPER_COMMAND("setaccess", neonserv_cmd_setaccess, 2, 1000, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH | CMDFLAG_OPLOG); #undef OPER_COMMAND start_bots(); @@ -521,6 +494,8 @@ void init_NeonServ() { bind_chanctcp(neonserv_event_chanctcp); bind_privctcp(neonserv_event_privctcp); bind_channotice(neonserv_event_channotice); + bind_topic(neonserv_event_topic); + bind_invite(neonserv_event_invite); set_trigger_callback(BOTID, neonserv_trigger_callback);