1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 12:06:38 +02:00

Get rid of the remaining references in the core to specific services. Move more stuff out of the core to the proper modules.

This commit is contained in:
Adam
2013-05-26 17:13:11 -04:00
parent f2dee1e1d6
commit 22658d63bd
164 changed files with 835 additions and 2137 deletions
+2 -1
View File
@@ -298,7 +298,8 @@ command { service = "BotServ"; name = "SET GREET"; command = "botserv/set/greet"
command { service = "BotServ"; name = "SET NOBOT"; command = "botserv/set/nobot"; permission = "botserv/set/nobot"; }
command { service = "BotServ"; name = "SET PRIVATE"; command = "botserv/set/private"; permission = "botserv/set/private"; }
/* Fantasy commands
/*
* Fantasy commands
*
* Fantasy commands can be executed in channels that have a BotServ bot by prefixing the
* command with one of the fantasy characters configured in botserv's fantasycharacter
+1 -1
View File
@@ -533,7 +533,7 @@ module { name = "help" }
*
* Provides the regex engine regex/pcre, which uses the Perl Compatible Regular Expressions library.
*/
module { name = "m_regex_pcre" }
#module { name = "m_regex_pcre" }
/*
* m_regex_posix
+7
View File
@@ -468,6 +468,13 @@ module
{
name = "os_news"
/*
* The service bot names to use to send news to users on connection
* and to opers when they oper.
*/
announcer = "Global"
oper_announcer = "OperServ"
/*
* The number of LOGON/OPER news items to display when a user logs on.
*
+1 -1
View File
@@ -173,7 +173,7 @@ Table of Contents
* Bahamut 1.4.27 or later (including 1.8)
* Charybdis 3.4 or later
* Hybrid 8.1 or later
* InspIRCd 1.1, 1.2, or 2.0
* InspIRCd 1.2 or 2.0
* ngIRCd 19.2 or later
* Plexus 3 or later
* Ratbox 2.0.6 or later
+1 -13
View File
@@ -65,18 +65,6 @@ class CoreExport NickAlias : public Serializable, public Extensible
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Release a nick
* See the comment in users.cpp
*/
void Release();
/** This function is called when a user on this nick either disconnects or changes nick.
* Note that the user isnt necessarially identified to this nick
* See the comment in users.cpp
* @param u The user
*/
void OnCancel(User *u);
/** Set a vhost for the user
* @param ident The ident
* @param host The host
@@ -306,7 +294,7 @@ class CoreExport NickCore : public Serializable, public Extensible
};
/* A request to check if an account/password is valid. These can exist for
* extended periods of time due to some authentication modules take.
* extended periods due to the time some authentication modules take.
*/
class CoreExport IdentifyRequest
{
-2
View File
@@ -131,6 +131,4 @@ class CoreExport BotInfo : public User, public Serializable
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
};
extern CoreExport BotInfo *BotServ, *ChanServ, *Global, *HostServ, *MemoServ, *NickServ, *OperServ;
#endif // BOTS_H
+3 -8
View File
@@ -30,12 +30,6 @@ struct ChanUserContainer : public Extensible
ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { }
};
/* Possible flags:
*
* INHABIT - ChanServ is currently holding the channel
* PERSIST - Channel still exists when emptied (IRCd enforced)
* SYNCING - Channel is syncing users (channel was just created) and it should not be deleted
*/
class CoreExport Channel : public Base, public Extensible
{
public:
@@ -52,6 +46,8 @@ class CoreExport Channel : public Base, public Extensible
Serialize::Reference<ChannelInfo> ci;
/* When the channel was created */
time_t creation_time;
/* If the channel has just been created in a netjoin */
bool syncing;
/* Users in the channel */
typedef std::map<User *, ChanUserContainer *> ChanUserList;
@@ -272,9 +268,8 @@ class CoreExport Channel : public Base, public Extensible
* for the specified user.
* @param user The user to give/remove modes to/from
* @param give_modes if true modes may be given to the user
* @param check_noop if true, CI_NOAUTOOP is checked before giving modes
*/
void SetCorrectModes(User *u, bool give_mode, bool check_noop);
void SetCorrectModes(User *u, bool give_modes);
/** Unbans a user from this channel.
* @param u The user to unban
+3
View File
@@ -124,6 +124,7 @@ namespace Configuration
/* module configuration blocks */
std::map<Anope::string, Block *> modules;
Anope::map<Anope::string> bots;
Conf();
@@ -131,6 +132,8 @@ namespace Configuration
Block *GetModule(Module *);
Block *GetModule(const Anope::string &name);
BotInfo *GetClient(const Anope::string &name);
};
struct Uplink
-28
View File
@@ -262,24 +262,6 @@ class CoreExport ChannelModeRegistered : public ChannelMode
bool CanSet(User *u) const anope_override;
};
class StackerInfo
{
public:
/* Modes to be added */
std::list<std::pair<Mode *, Anope::string> > AddModes;
/* Modes to be deleted */
std::list<std::pair<Mode *, Anope::string> > DelModes;
/* Bot this is sent from */
const BotInfo *bi;
/** Add a mode to this object
* @param mode The mode
* @param set true if setting, false if unsetting
* @param param The param for the mode
*/
void AddMode(Mode *mode, bool set, const Anope::string &param);
};
/** This is the mode manager
* It contains functions for adding modes to Anope so Anope can track them
* and do things such as MLOCK.
@@ -289,16 +271,6 @@ class StackerInfo
class CoreExport ModeManager
{
protected:
/* List of pairs of user/channels and their stacker info */
static std::map<User *, StackerInfo *> UserStackerObjects;
static std::map<Channel *, StackerInfo *> ChannelStackerObjects;
/** Build a list of mode strings to send to the IRCd from the mode stacker
* @param info The stacker info for a channel or user
* @return a list of strings
*/
static std::list<Anope::string> BuildModeStrings(StackerInfo *info);
/* Array of all modes Anope knows about. Modes are in this array at position
* modechar. Additionally, status modes are in this array (again) at statuschar.
*/
+4 -4
View File
@@ -46,9 +46,9 @@
#include "users.h"
#include "xline.h"
#include "modules/chanserv.h"
#include "modules/global.h"
#include "modules/memoserv.h"
#include "modules/nickserv.h"
#include "modules/pseudoclients/chanserv.h"
#include "modules/pseudoclients/global.h"
#include "modules/pseudoclients/memoserv.h"
#include "modules/pseudoclients/nickserv.h"
#endif // MODULE_H
+24 -9
View File
@@ -363,9 +363,8 @@ class CoreExport Module : public Extensible
virtual void OnPostCommand(CommandSource &source, Command *command, const std::vector<Anope::string> &params) { }
/** Called when the databases are saved
* @return EVENT_CONTINUE to let other modules continue saving, EVENT_STOP to stop
*/
virtual EventReturn OnSaveDatabase() { return EVENT_CONTINUE; }
virtual void OnSaveDatabase() { }
/** Called when the databases are loaded
* @return EVENT_CONTINUE to let other modules continue loading, EVENT_STOP to stop
@@ -714,11 +713,16 @@ class CoreExport Module : public Extensible
*/
virtual void OnNickGroup(User *u, NickAlias *target) { }
/** Called when a user identifies
/** Called when a user identifies to a nick
* @param u The user
*/
virtual void OnNickIdentify(User *u) { }
/** Called when a user is logged into an account
* @param u The user
*/
virtual void OnUserLogin(User *u) { }
/** Called when a nick logs out
* @param u The nick
*/
@@ -985,8 +989,9 @@ class CoreExport Module : public Extensible
* @param chan The channel
* @param access The user's access on the channel
* @param give_modes If giving modes is desired
* @param take_modes If taking modes is desired
*/
virtual void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool give_modes) { }
virtual void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) { }
virtual void OnSerializeCheck(Serialize::Type *) { }
virtual void OnSerializableConstruct(Serializable *) { }
@@ -1025,6 +1030,13 @@ class CoreExport Module : public Extensible
* @param cm The mode
*/
virtual EventReturn OnCanSet(User *u, const ChannelMode *cm) { return EVENT_CONTINUE; }
virtual EventReturn OnCheckDelete(Channel *) { return EVENT_CONTINUE; }
/** Called every options:expiretimeout seconds. Should be used to expire nicks,
* channels, etc.
*/
virtual void OnExpireTick() { }
};
/** Implementation-specific flags which may be set in ModuleManager::Attach()
@@ -1036,13 +1048,13 @@ enum Implementation
I_OnPreNickExpire, I_OnNickExpire, I_OnNickForbidden, I_OnNickGroup, I_OnNickLogout, I_OnNickIdentify, I_OnNickDrop,
I_OnNickRegister, I_OnNickSuspended, I_OnNickUnsuspended, I_OnDelNick, I_OnNickCoreCreate, I_OnDelCore, I_OnChangeCoreDisplay,
I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert, I_OnNickAddCert, I_OnNickEraseCert,
I_OnNickInfo, I_OnCheckAuthentication, I_OnNickUpdate, I_OnSetNickOption,
I_OnNickInfo, I_OnCheckAuthentication, I_OnNickUpdate, I_OnSetNickOption, I_OnUserLogin,
/* ChanServ */
I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd,
I_OnAccessDel, I_OnAccessClear, I_OnLevelChange, I_OnChanRegistered, I_OnChanUnsuspend, I_OnCreateChan, I_OnDelChan, I_OnChannelCreate,
I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick, I_OnCheckModes,
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnSetChannelOption, I_OnChannelSync, I_OnSetCorrectModes,
I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick, I_OnCheckModes,
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnSetChannelOption, I_OnSetCorrectModes,
/* BotServ */
I_OnCreateBot, I_OnDelBot,
@@ -1055,6 +1067,9 @@ enum Implementation
/* MemoServ */
I_OnMemoSend, I_OnMemoDel,
/* Channels */
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnChannelDelete, I_OnChannelSync, I_OnCheckDelete,
/* Users */
I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnPreUserLogoff, I_OnPostUserLogoff,
I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnLeaveChannel, I_OnFingerprint, I_OnUserAway, I_OnInvite,
@@ -1074,9 +1089,9 @@ enum Implementation
I_OnPreHelp, I_OnPostHelp, I_OnPreCommand, I_OnPostCommand, I_OnRestart, I_OnShutdown,
I_OnServerQuit, I_OnTopicUpdated,
I_OnEncrypt, I_OnDecrypt,
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg, I_OnLog, I_OnDnsRequest,
I_OnMessage, I_OnCanSet,
I_OnMessage, I_OnCanSet, I_OnExpireTick,
I_OnSerializeCheck, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate, I_OnSerializeTypeCreate,
I_END
@@ -9,7 +9,8 @@ class NickServService : public Service
}
virtual void Validate(User *u) = 0;
virtual void Login(User *u, NickAlias *na) = 0;
virtual void Collide(User *u, NickAlias *na) = 0;
virtual void Release(NickAlias *na) = 0;
};
#endif // NICKSERV_H
-11
View File
@@ -399,17 +399,6 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
*/
bool CheckKick(User *user);
/** Check the channel topic
* If topic lock is enabled will change the topic back, else it records
* the new topic in the ChannelInfo
*/
void CheckTopic();
/** Restore the channel topic, used on channel creation when not syncing with the uplink
* and after uplink sync
*/
void RestoreTopic();
/** Get the level for a privilege
* @param priv The privilege name
* @return the level
-6
View File
@@ -187,12 +187,6 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
void SendMessage(const BotInfo *source, const char *fmt, ...);
void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override;
/** Collide a nick
* See the comment in users.cpp
* @param na The nick
*/
void Collide(NickAlias *na);
/** Identify the user to the Nick
* updates last_seen, logs the user in,
* send messages, checks for mails, set vhost and more
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSAssign : public Command
-1
View File
@@ -215,7 +215,6 @@ class CommandBSBadwords : public Command
ci->ClearBadWords();
source.Reply(_("Bad words list is now empty."));
return;
}
public:
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSBot : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSBotList : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSay : public Command
-2
View File
@@ -10,8 +10,6 @@
*
*
*/
/*************************************************************************/
#include "module.h"
class CommandBSInfo : public Command
+1 -1
View File
@@ -74,7 +74,7 @@ class CommandBSKickBase : public Command
virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override = 0;
protected:
bool CheckArguments(CommandSource &source, const std::vector<Anope::string> &params, ChannelInfo* &ci) anope_override
bool CheckArguments(CommandSource &source, const std::vector<Anope::string> &params, ChannelInfo* &ci)
{
const Anope::string &chan = params[0];
const Anope::string &option = params[1];
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static std::map<Anope::string, int16_t, ci::less> defaultLevels;
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSAKick : public Command
-1
View File
@@ -9,7 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
+1 -10
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSClone : public Command
@@ -75,14 +73,7 @@ public:
target_ci->c->CheckModes();
target_ci->c->SetCorrectModes(u, true, true);
/* Mark the channel as persistent */
if (target_ci->c->HasMode("PERM"))
target_ci->ExtendMetadata("PERSIST");
/* Persist may be in def cflags, set it here */
else if (target_ci->HasExt("PERSIST"))
target_ci->c->SetMode(NULL, "PERM");
target_ci->c->SetCorrectModes(u, true);
}
if (target_ci->c && !target_ci->c->topic.empty())
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSDrop : public Command
+1 -1
View File
@@ -33,7 +33,7 @@ class CommandCSEnforce : public Command
{
ChanUserContainer *uc = it->second;
ci->c->SetCorrectModes(uc->user, false, false);
ci->c->SetCorrectModes(uc->user, false);
}
if (!hadsecureops)
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
struct EntryMsg : Serializable
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "modules/sql.h"
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "modules/sql.h"
-3
View File
@@ -9,11 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
static std::map<Anope::string, char> defaultFlags;
class FlagsChanAccess : public ChanAccess
-3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSGetKey : public Command
@@ -50,7 +48,6 @@ class CommandCSGetKey : public Command
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
source.Reply(_("Key for channel \002%s\002 is \002%s\002."), chan.c_str(), key.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
-6
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
class CommandCSInfo : public Command
{
void CheckOptStr(Anope::string &buf, const Anope::string &opt, const char *str, const ChannelInfo *ci, const NickCore *nc)
@@ -116,8 +112,6 @@ class CommandCSInfo : public Command
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
-3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSInvite : public Command
@@ -83,7 +81,6 @@ class CommandCSInvite : public Command
}
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str());
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
-4
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
class CommandCSKick : public Command
{
public:
-3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSList : public Command
@@ -117,7 +115,6 @@ class CommandCSList : public Command
source.Reply(replies[i]);
source.Reply(_("End of list - %d/%d matches shown."), nchans > listmax ? listmax : nchans, nchans);
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSLog : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSMode : public Command
+3 -12
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSRegister : public Command
@@ -74,19 +72,11 @@ class CommandCSRegister : public Command
{
c->CheckModes();
if (u)
c->SetCorrectModes(u, true, true);
/* Mark the channel as persistent */
if (c->HasMode("PERM"))
ci->Extend("PERSIST");
/* Persist may be in def cflags, set it here */
else if (ci->HasExt("PERSIST"))
c->SetMode(NULL, "PERM");
c->SetCorrectModes(u, true);
}
FOREACH_MOD(I_OnChanRegistered, OnChanRegistered(ci));
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
@@ -103,7 +93,8 @@ class CommandCSRegister : public Command
"\"founder\" of the channel. The channel founder is allowed\n"
"to change all of the channel settings for the channel;\n"
"%s will also automatically give the founder\n"
"channel-operator privileges when s/he enters the channel."));
"channel-operator privileges when s/he enters the channel."),
source.service->nick.c_str(), source.service->nick.c_str());
BotInfo *bi;
Anope::string cmd;
if (Command::FindCommandFromService("chanserv/access", bi, cmd))
+19 -38
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
@@ -290,14 +288,28 @@ class CommandSeen : public Command
}
};
class DataBasePurger : public Timer
class CSSeen : public Module
{
Serialize::Type seeninfo_type;
CommandSeen commandseen;
CommandOSSeen commandosseen;
public:
DataBasePurger(Module *o) : Timer(o, 300, Anope::CurTime, true) { }
void Tick(time_t) anope_override
CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), seeninfo_type("SeenInfo", SeenInfo::Unserialize), commandseen(this), commandosseen(this)
{
size_t previous_size = database.size(), purgetime = Config->GetModule(this->GetOwner())->Get<time_t>("purgetime");
Implementation eventlist[] = { I_OnExpireTick,
I_OnUserConnect,
I_OnUserNickChange,
I_OnUserQuit,
I_OnJoinChannel,
I_OnPartChannel,
I_OnPreUserKicked };
ModuleManager::Attach(eventlist, this, sizeof(eventlist) / sizeof(Implementation));
}
void OnExpireTick() anope_override
{
size_t previous_size = database.size(), purgetime = Config->GetModule(this)->Get<time_t>("purgetime");
if (!purgetime)
purgetime = Anope::DoTime("30d");
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
@@ -314,37 +326,6 @@ class DataBasePurger : public Timer
}
Log(LOG_DEBUG) << "cs_seen: Purged database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries.";
}
};
class CSSeen : public Module
{
Serialize::Type seeninfo_type;
CommandSeen commandseen;
CommandOSSeen commandosseen;
DataBasePurger purger;
public:
CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), seeninfo_type("SeenInfo", SeenInfo::Unserialize), commandseen(this), commandosseen(this), purger(this)
{
Implementation eventlist[] = { I_OnReload,
I_OnUserConnect,
I_OnUserNickChange,
I_OnUserQuit,
I_OnJoinChannel,
I_OnPartChannel,
I_OnPreUserKicked };
ModuleManager::Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
void OnReload(Configuration::Conf *conf) anope_override
{
time_t expiretimeout = conf->GetModule(this)->Get<time_t>("expiretimeout");
if (!expiretimeout)
expiretimeout = Anope::DoTime("1d");
if (purger.GetSecs() != expiretimeout)
purger.SetSecs(expiretimeout);
}
void OnUserConnect(User *u, bool &exempt) anope_override
{
+63 -6
View File
@@ -23,7 +23,6 @@ class CommandCSSet : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->OnSyntaxError(source, "");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
@@ -515,11 +514,13 @@ class CommandCSSetPersist : public Command
*/
if (!ci->bi && !cm)
{
BotInfo *ChanServ = Config->GetClient("ChanServ");
if (!ChanServ)
{
source.Reply(_("ChanServ is required to enable persist on this network."));
return;
}
ChanServ->Assign(NULL, ci);
if (!ci->c->FindUser(ChanServ))
{
@@ -559,6 +560,8 @@ class CommandCSSetPersist : public Command
/* No channel mode, no BotServ, but using ChanServ as the botserv bot
* which was assigned when persist was set on
*/
BotInfo *ChanServ = Config->GetClient("ChanServ"),
*BotServ = Config->GetClient("BotServ");
if (!cm && !BotServ && ci->bi)
{
if (!ChanServ)
@@ -576,8 +579,6 @@ class CommandCSSetPersist : public Command
}
else
this->OnSyntaxError(source, "PERSIST");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -1105,7 +1106,6 @@ class CSSet : public Module
CommandCSSetAutoOp commandcssetautoop;
CommandCSSetBanType commandcssetbantype;
CommandCSSetChanstats commandcssetchanstats;
bool CSDefChanstats;
CommandCSSetDescription commandcssetdescription;
CommandCSSetFounder commandcssetfounder;
CommandCSSetKeepTopic commandcssetkeeptopic;
@@ -1123,13 +1123,14 @@ class CSSet : public Module
public:
CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandcsset(this), commandcssetautoop(this), commandcssetbantype(this), commandcssetchanstats(this),
CSDefChanstats(false), commandcssetdescription(this), commandcssetfounder(this), commandcssetkeeptopic(this),
commandcssetdescription(this), commandcssetfounder(this), commandcssetkeeptopic(this),
commandcssetpeace(this), commandcssetpersist(this), commandcssetprivate(this), commandcssetrestricted(this),
commandcssetsecure(this), commandcssetsecurefounder(this), commandcssetsecureops(this), commandcssetsignkick(this),
commandcssetsuccessor(this), commandcssetnoexpire(this)
{
Implementation i[] = { I_OnCheckKick, I_OnDelChan };
Implementation i[] = { I_OnCheckKick, I_OnDelChan, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnCheckDelete, I_OnJoinChannel,
I_OnSetCorrectModes };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
@@ -1148,6 +1149,62 @@ class CSSet : public Module
{
if (ci->c && ci->HasExt("PERSIST"))
ci->c->RemoveMode(ci->WhoSends(), "PERM", "", false);
ci->Shrink("PERSIST");
}
EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) anope_override
{
/* Channel mode +P or so was set, mark this channel as persistent */
if (mname == "PERM" && c->ci)
{
c->ci->ExtendMetadata("PERSIST");
}
return EVENT_CONTINUE;
}
EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) anope_override
{
if (mname == "PERM")
{
if (c->ci)
c->ci->Shrink("PERSIST");
if (c->users.empty() && !c->syncing && c->CheckDelete())
{
delete c;
return EVENT_STOP;
}
}
return EVENT_CONTINUE;
}
EventReturn OnCheckDelete(Channel *c) anope_override
{
if (c->ci && c->ci->HasExt("PERSIST"))
return EVENT_STOP;
return EVENT_CONTINUE;
}
void OnJoinChannel(User *u, Channel *c) anope_override
{
if (c->ci && c->ci->HasExt("PERSIST") && c->creation_time > c->ci->time_registered)
{
Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->time_registered;
c->creation_time = c->ci->time_registered;
IRCD->SendChannel(c);
c->Reset();
}
}
void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
{
if (chan->ci)
{
give_modes &= !chan->ci->HasExt("NOAUTOOP");
take_modes |= chan->ci->HasExt("SECUREOPS");
}
}
};
-2
View File
@@ -8,8 +8,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static std::map<Anope::string, Anope::string> descriptions;
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSStatus : public Command
+1 -3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSuspend : public Command
@@ -205,7 +203,7 @@ class CSSuspend : public Module
ci->Shrink("suspend:reason");
ci->Shrink("suspend:time");
Log(LOG_NORMAL, "expire", ChanServ) << "Expiring suspend for " << ci->name;
Log(this) << "Expiring suspend for " << ci->name;
}
}
catch (const ConvertException &) { }
+1 -1
View File
@@ -35,7 +35,7 @@ class CommandCSSync : public Command
Log(LOG_COMMAND, source, this, ci);
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
ci->c->SetCorrectModes(it->second->user, true, false);
ci->c->SetCorrectModes(it->second->user, true);
source.Reply(_("All user modes on \002%s\002 have been synced."), ci->name.c_str());
}
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSUnban : public Command
+12 -4
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSUp : public Command
@@ -31,7 +29,7 @@ class CommandCSUp : public Command
for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
{
Channel *c = it->second->chan;
c->SetCorrectModes(source.GetUser(), true, false);
c->SetCorrectModes(source.GetUser(), true);
}
}
else
@@ -58,6 +56,11 @@ class CommandCSUp : public Command
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
return;
}
else if (!u->FindChannel(c))
{
source.Reply(NICK_X_NOT_ON_CHAN, nick.c_str(), channel.c_str());
return;
}
else if (source.GetUser() && u != source.GetUser() && c->ci->HasExt("PEACE"))
{
if (c->ci->AccessFor(u) > c->ci->AccessFor(source.GetUser()))
@@ -67,7 +70,7 @@ class CommandCSUp : public Command
}
}
c->SetCorrectModes(u, true, false);
c->SetCorrectModes(u, true);
}
}
@@ -136,6 +139,11 @@ class CommandCSDown : public Command
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
return;
}
else if (!u->FindChannel(c))
{
source.Reply(NICK_X_NOT_ON_CHAN, nick.c_str(), channel.c_str());
return;
}
else if (source.GetUser() && u != source.GetUser() && c->ci->HasExt("PEACE"))
{
if (c->ci->AccessFor(u) > c->ci->AccessFor(source.GetUser()))
+1 -3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandGLGlobal : public Command
@@ -33,7 +31,7 @@ class CommandGLGlobal : public Command
else
{
Log(LOG_ADMIN, source, this);
GService->SendGlobal(Global, source.GetNick(), msg);
GService->SendGlobal(NULL, source.GetNick(), msg);
}
}
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHelp : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSDel : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSGroup : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSList : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSOff : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSOn : public Command
+3 -3
View File
@@ -193,7 +193,7 @@ class CommandHSActivate : public Command
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv)
memoserv->Send(HostServ->nick, na->nick, _("[auto memo] Your requested vHost has been approved."), true);
memoserv->Send(source.service->nick, na->nick, _("[auto memo] Your requested vHost has been approved."), true);
source.Reply(_("vHost for %s has been activated."), na->nick.c_str());
Log(LOG_COMMAND, source, this) << "for " << na->nick << " for vhost " << (!req->ident.empty() ? req->ident + "@" : "") << req->host;
@@ -244,7 +244,7 @@ class CommandHSReject : public Command
else
message = _("[auto memo] Your requested vHost has been rejected.");
memoserv->Send(HostServ->nick, nick, message, true);
memoserv->Send(source.service->nick, nick, message, true);
}
source.Reply(_("vHost for %s has been rejected."), nick.c_str());
@@ -380,7 +380,7 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin
Anope::string message = Anope::printf(_("[auto memo] vHost \002%s\002 has been requested by %s."), host.c_str(), source.GetNick().c_str());
memoserv->Send(HostServ->nick, na->nick, message, true);
memoserv->Send(source.service->nick, na->nick, message, true);
}
}
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandHSSet : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandMSCancel : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandMSCheck : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class MemoDelCallback : public NumberList
-12
View File
@@ -9,13 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<MemoServService> MemoServService("MemoServService", "MemoServ");
class CommandMSIgnore : public Command
{
public:
@@ -29,10 +24,6 @@ class CommandMSIgnore : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
if (!MemoServService)
return;
Anope::string channel = params[0];
Anope::string command = (params.size() > 1 ? params[1] : "");
Anope::string param = (params.size() > 2 ? params[2] : "");
@@ -123,9 +114,6 @@ class MSIgnore : public Module
MSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandmsignore(this)
{
if (!MemoServService)
throw ModuleException("No MemoServ!");
}
};
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandMSInfo : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandMSList : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<MemoServService> MemoServService("MemoServService", "MemoServ");
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
namespace
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
namespace
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
namespace
+4 -2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandMSSet : public Command
@@ -20,6 +18,10 @@ class CommandMSSet : public Command
{
const Anope::string &param = params[1];
NickCore *nc = source.nc;
BotInfo *MemoServ = Config->GetClient("MemoServ");
if (!MemoServ)
return;
if (param.equals_ci("ON"))
{
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
namespace
-4
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class CommandNSAccess : public Command
{
private:
+1 -2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
struct AJoinEntry;
@@ -250,6 +248,7 @@ class NSAJoin : public Module
void OnNickIdentify(User *u) anope_override
{
BotInfo *NickServ = Config->GetClient("NickServ");
if (!NickServ)
return;
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSAList : public Command
+3 -6
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static unsigned accessmax;
@@ -169,8 +167,6 @@ class CommandNSCert : public Command
return this->DoList(source, nc);
else
this->OnSyntaxError(source, cmd);
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
@@ -180,8 +176,8 @@ class CommandNSCert : public Command
source.Reply(_("Modifies or displays the certificate list for your nick.\n"
"If you connect to IRC and provide a client certificate with a\n"
"matching fingerprint in the cert list, your nick will be\n"
"automatically identified to %s.\n"
" \n"), NickServ ? NickServ->nick.c_str() : source.service->nick.c_str());
"automatically identified to services.\n"
" \n"));
source.Reply(_("Examples:\n"
" \n"
" \002CERT ADD <fingerprint>\002\n"
@@ -205,6 +201,7 @@ class NSCert : public Module
void DoAutoIdentify(User *u)
{
NickAlias *na = NickAlias::Find(u->nick);
BotInfo *NickServ = Config->GetClient("NickServ");
if (!NickServ || !na)
return;
if (u->IsIdentified() && u->Account() == na->nc)
-4
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class CommandNSDrop : public Command
{
public:
-2
View File
@@ -13,8 +13,6 @@
* Cards are not excepted. Must use user@email-host.
*/
/*************************************************************************/
#include "module.h"
class CommandNSGetEMail : public Command
-4
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class CommandNSGetPass : public Command
{
public:
+1 -9
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class NSGroupRequest : public IdentifyRequest
{
CommandSource source;
@@ -48,8 +44,6 @@ class NSGroupRequest : public IdentifyRequest
u->Login(target->nc);
IRCD->SendLogin(u);
if (!Config->GetBlock("options")->Get<bool>("nonicknameownership") && na->nc == u->Account() && na->nc->HasExt("UNCONFIRMED") == false)
u->SetMode(NickServ, "REGISTERED");
FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target));
Log(LOG_COMMAND, source, cmd) << "makes " << nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
@@ -251,10 +245,8 @@ class CommandNSUngroup : public Command
User *user = User::Find(na->nick);
if (user)
/* The user on the nick who was ungrouped may be identified to the old group, set -r */
user->RemoveMode(NickServ, "REGISTERED");
user->RemoveMode(source.service, "REGISTERED");
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
-3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class NSIdentifyRequest : public IdentifyRequest
@@ -39,7 +37,6 @@ class NSIdentifyRequest : public IdentifyRequest
Log(LOG_COMMAND, source, cmd) << "and identified for account " << na->nc->display;
source.Reply(_("Password accepted - you are now recognized."));
u->Identify(na);
na->Release();
}
}
-4
View File
@@ -9,12 +9,8 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class CommandNSInfo : public Command
{
private:
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSList : public Command
+1 -3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> NickServService("NickServService", "NickServ");
@@ -52,7 +50,7 @@ class CommandNSLogout : public Command
source.Reply(_("Your nick has been logged out."));
IRCD->SendLogout(u2);
u2->RemoveMode(NickServ, "REGISTERED");
u2->RemoveMode(source.service, "REGISTERED");
u2->Logout();
/* Send out an event */
+11 -9
View File
@@ -9,10 +9,10 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
struct NSRecoverExtensibleInfo : ExtensibleItem, std::map<Anope::string, ChannelStatus> { };
class NSRecoverRequest : public IdentifyRequest
@@ -39,7 +39,7 @@ class NSRecoverRequest : public IdentifyRequest
/* Nick is being held by us, release it */
if (na->HasExt("HELD"))
{
na->Release();
nickserv->Release(na);
source.Reply(_("Service's hold on \002%s\002 has been released."), na->nick.c_str());
}
else if (!u)
@@ -68,7 +68,7 @@ class NSRecoverRequest : public IdentifyRequest
}
}
u->SendMessage(NickServ, _("This nickname has been recovered by %s. If you did not do\n"
u->SendMessage(source.service, _("This nickname has been recovered by %s. If you did not do\n"
"this then %s may have your password, and you should change it.\n"),
source.GetNick().c_str(), source.GetNick().c_str());
@@ -89,13 +89,14 @@ class NSRecoverRequest : public IdentifyRequest
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->nick << " (" << na->nc->display << ")";
}
u->SendMessage(NickServ, _("This nickname has been recovered by %s."), source.GetNick().c_str());
u->Collide(na);
u->SendMessage(source.service, _("This nickname has been recovered by %s."), source.GetNick().c_str());
if (nickserv)
nickserv->Collide(u, na);
if (IRCD->CanSVSNick)
{
/* If we can svsnick then release our hold and svsnick the user using the command */
na->Release();
nickserv->Release(na);
IRCD->SendForceNickChange(source.GetUser(), GetAccount(), Anope::CurTime);
}
else
@@ -226,7 +227,7 @@ class NSRecover : public Module
* because some IRCds do not allow us to have these automatically expire
*/
for (nickalias_map::const_iterator it = NickAliasList->begin(); it != NickAliasList->end(); ++it)
it->second->Release();
nickserv->Release(it->second);
}
void OnRestart() anope_override { OnShutdown(); }
@@ -236,8 +237,9 @@ class NSRecover : public Module
if (Config->GetModule(this)->Get<bool>("restoreonrecover"))
{
NSRecoverExtensibleInfo *ei = u->GetExt<NSRecoverExtensibleInfo *>("ns_recover_info");
BotInfo *NickServ = Config->GetClient("NickServ");
if (ei != NULL)
if (ei != NULL && NickServ != NULL)
for (std::map<Anope::string, ChannelStatus>::iterator it = ei->begin(), it_end = ei->end(); it != it_end;)
{
Channel *c = Channel::Find(it->first);
+6 -14
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static bool SendRegmail(User *u, const NickAlias *na, const BotInfo *bi);
@@ -59,7 +57,7 @@ class CommandNSConfirm : public Command
IRCD->SendLogin(source.GetUser());
const NickAlias *na = NickAlias::Find(source.GetNick());
if (!Config->GetBlock("options")->Get<bool>("nonicknameownership") && na != NULL && na->nc == source.GetAccount() && na->nc->HasExt("UNCONFIRMED") == false)
source.GetUser()->SetMode(NickServ, "REGISTERED");
source.GetUser()->SetMode(source.service, "REGISTERED");
}
}
else
@@ -192,8 +190,6 @@ class CommandNSRegister : public Command
{
na->last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost();
na->last_realname = u->realname;
u->Login(nc);
}
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
@@ -227,18 +223,14 @@ class CommandNSRegister : public Command
source.Reply(_("If you do not confirm your email address within %s your account will expire."), Anope::Duration(unconfirmed_expire).c_str());
}
}
else if (nsregister.equals_ci("none"))
{
if (u)
{
IRCD->SendLogin(u);
if (!Config->GetBlock("options")->Get<bool>("nonicknameownership") && na->nc == u->Account() && na->nc->HasExt("UNCONFIRMED") == false)
u->SetMode(NickServ, "REGISTERED");
}
}
if (u)
{
u->Login(nc);
if (!nc->HasExt("UNCONFIRMED"))
IRCD->SendLogin(u);
u->lastnickreg = Anope::CurTime;
}
}
}
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi);
+11 -5
View File
@@ -11,8 +11,6 @@
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class CommandNSSet : public Command
{
public:
@@ -1350,7 +1348,6 @@ class NSSet : public Module
CommandNSSetChanstats commandnssetchanstats;
CommandNSSASetChanstats commandnssasetchanstats;
bool NSDefChanstats;
CommandNSSetDisplay commandnssetdisplay;
CommandNSSASetDisplay commandnssasetdisplay;
@@ -1388,7 +1385,7 @@ class NSSet : public Module
NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandnsset(this), commandnssaset(this),
commandnssetautoop(this), commandnssasetautoop(this),
commandnssetchanstats(this), commandnssasetchanstats(this), NSDefChanstats(false),
commandnssetchanstats(this), commandnssasetchanstats(this),
commandnssetdisplay(this), commandnssasetdisplay(this),
commandnssetemail(this), commandnssasetemail(this),
commandnssetgreet(this), commandnssasetgreet(this),
@@ -1402,7 +1399,7 @@ class NSSet : public Module
commandnssasetnoexpire(this)
{
Implementation i[] = { I_OnPreCommand };
Implementation i[] = { I_OnPreCommand, I_OnSetCorrectModes };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
@@ -1429,6 +1426,15 @@ class NSSet : public Module
return EVENT_CONTINUE;
}
void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
{
if (chan->ci)
{
/* Only give modes if autoop is set */
give_modes &= !user->Account() || user->Account()->HasExt("AUTOOP");
}
}
};
MODULE_INIT(NSSet)
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static std::map<Anope::string, Anope::string> descriptions;
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSStatus : public Command
+3 -6
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
@@ -87,7 +85,8 @@ class CommandNSSuspend : public Command
if (u2)
{
u2->Logout();
u2->Collide(na2);
if (nickserv)
nickserv->Collide(u2, na2);
}
}
}
@@ -96,8 +95,6 @@ class CommandNSSuspend : public Command
source.Reply(_("Nick %s is now suspended."), nick.c_str());
FOREACH_MOD(I_OnNickSuspended, OnNickSuspend(na));
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
@@ -218,7 +215,7 @@ class NSSuspend : public Module
na->nc->Shrink("suspend:reason");
na->nc->Shrink("suspend:time");
Log(LOG_NORMAL, "expire", NickServ) << "Expiring suspend for " << na->nick;
Log(LOG_NORMAL, "expire", Config->GetClient("NickServ")) << "Expiring suspend for " << na->nick;
}
}
catch (const ConvertException &) { }
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSUpdate : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sgline");
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sgline");
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSConfig : public Command
+13 -13
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "modules/os_session.h"
@@ -128,17 +126,17 @@ class DefConTimeout : public Timer
{
DConfig.defaultlevel = level;
FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(level));
Log(OperServ, "operserv/defcon") << "Defcon level timeout, returning to level " << level;
Log(Config->GetClient("OperServ"), "operserv/defcon") << "Defcon level timeout, returning to level " << level;
if (DConfig.globalondefcon)
{
if (!DConfig.offmessage.empty())
GlobalService->SendGlobal(Global, "", DConfig.offmessage);
GlobalService->SendGlobal(NULL, "", DConfig.offmessage);
else
GlobalService->SendGlobal(Global, "", Anope::printf(Language::Translate(_("The Defcon Level is now at Level: \002%d\002")), DConfig.defaultlevel));
GlobalService->SendGlobal(NULL, "", Anope::printf(Language::Translate(_("The Defcon Level is now at Level: \002%d\002")), DConfig.defaultlevel));
if (!DConfig.message.empty())
GlobalService->SendGlobal(Global, "", DConfig.message);
GlobalService->SendGlobal(NULL, "", DConfig.message);
}
runDefCon();
@@ -221,12 +219,12 @@ class CommandOSDefcon : public Command
if (DConfig.globalondefcon)
{
if (DConfig.defaultlevel == 5 && !DConfig.offmessage.empty())
GlobalService->SendGlobal(Global, "", DConfig.offmessage);
GlobalService->SendGlobal(NULL, "", DConfig.offmessage);
else if (DConfig.defaultlevel != 5)
{
GlobalService->SendGlobal(Global, "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel));
GlobalService->SendGlobal(NULL, "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel));
if (!DConfig.message.empty())
GlobalService->SendGlobal(Global, "", DConfig.message);
GlobalService->SendGlobal(NULL, "", DConfig.message);
}
}
@@ -417,7 +415,7 @@ class OSDefcon : public Module
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOff.count(mname))
{
c->RemoveMode(OperServ, cm, param);
c->RemoveMode(Config->GetClient("OperServ"), cm, param);
return EVENT_STOP;
}
@@ -434,9 +432,9 @@ class OSDefcon : public Module
Anope::string param;
if (DConfig.GetDefConParam(mname, param))
c->SetMode(OperServ, cm, param);
c->SetMode(Config->GetClient("OperServ"), cm, param);
else
c->SetMode(OperServ, cm);
c->SetMode(Config->GetClient("OperServ"), cm);
return EVENT_STOP;
@@ -488,6 +486,7 @@ class OSDefcon : public Module
if (exempt || u->Quitting() || !u->server->IsSynced() || u->server->IsULined())
return;
BotInfo *OperServ = Config->GetClient("OperServ");
if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills)
{
Log(OperServ, "operserv/defcon") << "DEFCON: adding akill for *@" << u->host;
@@ -548,12 +547,13 @@ class OSDefcon : public Module
void OnChannelSync(Channel *c) anope_override
{
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES))
c->SetModes(OperServ, false, "%s", DConfig.chanmodes.c_str());
c->SetModes(Config->GetClient("OperServ"), false, "%s", DConfig.chanmodes.c_str());
}
};
static void runDefCon()
{
BotInfo *OperServ = Config->GetClient("OperServ");
if (DConfig.Check(DEFCON_FORCE_CHAN_MODES))
{
if (!DConfig.chanmodes.empty() && !DefConModesSet)
+6 -3
View File
@@ -9,11 +9,11 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "modules/os_forbid.h"
static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
class MyForbidService : public ForbidService
{
Serialize::Checker<std::vector<ForbidData *>[FT_SIZE - 1]> forbid_data;
@@ -271,6 +271,7 @@ class OSForbid : public Module
ForbidData *d = this->forbidService.FindForbid(u->nick, FT_NICK);
if (d != NULL)
{
BotInfo *OperServ = Config->GetClient("OperServ");
if (OperServ)
{
if (d->reason.empty())
@@ -278,12 +279,14 @@ class OSForbid : public Module
else
u->SendMessage(OperServ, _("This nickname has been forbidden: %s"), d->reason.c_str());
}
u->Collide(NULL);
if (nickserv)
nickserv->Collide(u, NULL);
}
}
void OnJoinChannel(User *u, Channel *c) anope_override
{
BotInfo *OperServ = Config->GetClient("OperServ");
if (u->HasMode("OPER") || !OperServ)
return;
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
#include "modules/os_ignore.h"
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSJupe : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSKick : public Command
-2
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandOSKill : public Command

Some files were not shown because too many files have changed in this diff Show More