mirror of
https://github.com/anope/anope.git
synced 2026-06-28 13:05:44 +02:00
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each other
This commit is contained in:
+67
-13
File diff suppressed because it is too large
Load Diff
+113
-67
File diff suppressed because it is too large
Load Diff
+190
-34
File diff suppressed because it is too large
Load Diff
+24
-14
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2008-2012 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BASE_H
|
||||
@@ -16,48 +17,57 @@
|
||||
class CoreExport Base
|
||||
{
|
||||
/* References to this base class */
|
||||
std::set<dynamic_reference_base *> References;
|
||||
std::set<ReferenceBase *> references;
|
||||
public:
|
||||
Base();
|
||||
virtual ~Base();
|
||||
void AddReference(dynamic_reference_base *r);
|
||||
void DelReference(dynamic_reference_base *r);
|
||||
|
||||
/** Adds a reference to this object. Eg, when a Reference
|
||||
* is created referring to this object this is called. It is used to
|
||||
* cleanup references when this object is destructed.
|
||||
*/
|
||||
void AddReference(ReferenceBase *r);
|
||||
|
||||
void DelReference(ReferenceBase *r);
|
||||
};
|
||||
|
||||
class dynamic_reference_base
|
||||
class ReferenceBase
|
||||
{
|
||||
protected:
|
||||
bool invalid;
|
||||
public:
|
||||
dynamic_reference_base() : invalid(false) { }
|
||||
dynamic_reference_base(const dynamic_reference_base &other) : invalid(other.invalid) { }
|
||||
virtual ~dynamic_reference_base() { }
|
||||
ReferenceBase() : invalid(false) { }
|
||||
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
|
||||
virtual ~ReferenceBase() { }
|
||||
inline void Invalidate() { this->invalid = true; }
|
||||
};
|
||||
|
||||
/** Used to hold pointers to objects that may be deleted. A Reference will
|
||||
* no longer be valid once the object it refers is destructed.
|
||||
*/
|
||||
template<typename T>
|
||||
class dynamic_reference : public dynamic_reference_base
|
||||
class Reference : public ReferenceBase
|
||||
{
|
||||
protected:
|
||||
T *ref;
|
||||
public:
|
||||
dynamic_reference() : ref(NULL)
|
||||
Reference() : ref(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
dynamic_reference(T *obj) : ref(obj)
|
||||
Reference(T *obj) : ref(obj)
|
||||
{
|
||||
if (ref)
|
||||
ref->AddReference(this);
|
||||
}
|
||||
|
||||
dynamic_reference(const dynamic_reference<T> &other) : dynamic_reference_base(other), ref(other.ref)
|
||||
Reference(const Reference<T> &other) : ReferenceBase(other), ref(other.ref)
|
||||
{
|
||||
if (operator bool())
|
||||
ref->AddReference(this);
|
||||
}
|
||||
|
||||
virtual ~dynamic_reference()
|
||||
virtual ~Reference()
|
||||
{
|
||||
if (operator bool())
|
||||
ref->DelReference(this);
|
||||
@@ -105,12 +115,12 @@ class dynamic_reference : public dynamic_reference_base
|
||||
this->ref->AddReference(this);
|
||||
}
|
||||
|
||||
inline bool operator<(const dynamic_reference<T> &other) const
|
||||
inline bool operator<(const Reference<T> &other) const
|
||||
{
|
||||
return this < &other;
|
||||
}
|
||||
|
||||
inline bool operator==(const dynamic_reference<T> &other)
|
||||
inline bool operator==(const Reference<T> &other)
|
||||
{
|
||||
if (!this->invalid)
|
||||
return this->ref == other;
|
||||
|
||||
+25
-19
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2012 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOTS_H
|
||||
@@ -16,7 +18,7 @@
|
||||
|
||||
typedef Anope::map<BotInfo *> botinfo_map;
|
||||
|
||||
extern CoreExport serialize_checker<botinfo_map> BotListByNick, BotListByUID;
|
||||
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
|
||||
|
||||
/** Flags settable on a bot
|
||||
*/
|
||||
@@ -24,8 +26,6 @@ enum BotFlag
|
||||
{
|
||||
BI_BEGIN,
|
||||
|
||||
/* This bot is a core bot. NickServ, ChanServ, etc */
|
||||
BI_CORE,
|
||||
/* This bot can only be assigned by IRCops */
|
||||
BI_PRIVATE,
|
||||
/* This bot is defined in the config */
|
||||
@@ -34,17 +34,21 @@ enum BotFlag
|
||||
BI_END
|
||||
};
|
||||
|
||||
static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "CONF", "" };
|
||||
|
||||
class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Serializable
|
||||
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
|
||||
class CoreExport BotInfo : public User, public Flags<BotFlag>, public Serializable
|
||||
{
|
||||
public:
|
||||
time_t created; /* Birth date ;) */
|
||||
time_t lastmsg; /* Last time we said something */
|
||||
CommandInfo::map commands; /* Commands, actual name to service name */
|
||||
Anope::string botmodes; /* Modes the bot should have as configured in service:modes */
|
||||
std::vector<Anope::string> botchannels; /* Channels the bot should be in as configured in service:channels */
|
||||
bool introduced; /* Whether or not this bot is introduced */
|
||||
time_t created;
|
||||
/* Last time this bot said something (via privmsg) */
|
||||
time_t lastmsg;
|
||||
/* Map of actual command names -> service name/permission required */
|
||||
CommandInfo::map commands;
|
||||
/* Modes the bot should have as configured in service:modes */
|
||||
Anope::string botmodes;
|
||||
/* Channels the bot should be in as configured in service:channels */
|
||||
std::vector<Anope::string> botchannels;
|
||||
/* Whether or not this bot is introduced to the network */
|
||||
bool introduced;
|
||||
|
||||
/** Create a new bot.
|
||||
* @param nick The nickname to assign to the bot.
|
||||
@@ -59,8 +63,8 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Se
|
||||
*/
|
||||
virtual ~BotInfo();
|
||||
|
||||
Serialize::Data serialize() const;
|
||||
static Serializable* unserialize(Serializable *obj, Serialize::Data &);
|
||||
Serialize::Data Serialize() const;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
void GenerateUID();
|
||||
|
||||
@@ -126,11 +130,13 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Se
|
||||
* @return A struct containing service name and permission
|
||||
*/
|
||||
CommandInfo *GetCommand(const Anope::string &cname);
|
||||
|
||||
/** Find a bot by nick
|
||||
* @param nick The nick
|
||||
* @param nick_only True to only look by nick, and not by UID
|
||||
* @return The bot, if it exists
|
||||
*/
|
||||
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
|
||||
};
|
||||
|
||||
extern CoreExport BotInfo *findbot(const Anope::string &nick);
|
||||
|
||||
extern CoreExport void bot_raw_ban(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
|
||||
extern CoreExport void bot_raw_kick(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
|
||||
|
||||
#endif // BOTS_H
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2012 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOTSERV_H
|
||||
#define BOTSERV_H
|
||||
|
||||
#include "anope.h"
|
||||
|
||||
/* BotServ SET flags */
|
||||
enum BotServFlag
|
||||
{
|
||||
BS_BEGIN,
|
||||
/* BotServ won't kick ops */
|
||||
BS_DONTKICKOPS,
|
||||
/* BotServ won't kick voices */
|
||||
BS_DONTKICKVOICES,
|
||||
/* BotServ bot accepts fantasy commands */
|
||||
BS_FANTASY,
|
||||
/* BotServ should show greets */
|
||||
BS_GREET,
|
||||
/* BotServ bots are not allowed to be in this channel */
|
||||
BS_NOBOT,
|
||||
/* BotServ kicks for bolds */
|
||||
BS_KICK_BOLDS,
|
||||
/* BotServ kicks for colors */
|
||||
BS_KICK_COLORS,
|
||||
/* BOtServ kicks for reverses */
|
||||
BS_KICK_REVERSES,
|
||||
/* BotServ kicks for underlines */
|
||||
BS_KICK_UNDERLINES,
|
||||
/* BotServ kicks for badwords */
|
||||
BS_KICK_BADWORDS,
|
||||
/* BotServ kicks for caps */
|
||||
BS_KICK_CAPS,
|
||||
/* BotServ kicks for flood */
|
||||
BS_KICK_FLOOD,
|
||||
/* BotServ kicks for repeating */
|
||||
BS_KICK_REPEAT,
|
||||
/* BotServ kicks for italics */
|
||||
BS_KICK_ITALICS,
|
||||
/* BotServ kicks for amsgs */
|
||||
BS_KICK_AMSGS,
|
||||
BS_END
|
||||
};
|
||||
|
||||
const Anope::string BotServFlagStrings[] = {
|
||||
"BEGIN", "DONTKICKOPS", "DONTKICKVOICES", "FANTASY", "GREET", "NOBOT",
|
||||
"KICK_BOLDs", "KICK_COLORS", "KICK_REVERSES", "KICK_UNDERLINES", "KICK_BADWORDS", "KICK_CAPS",
|
||||
"KICK_FLOOD", "KICK_REPEAT", "KICK_ITALICS", "KICK_AMSGS", "MSG_PRIVMSG", "MSG_NOTICE",
|
||||
"MSG_NOTICEOPS", ""
|
||||
};
|
||||
|
||||
/* Indices for TTB (Times To Ban) */
|
||||
enum
|
||||
{
|
||||
TTB_BOLDS,
|
||||
TTB_COLORS,
|
||||
TTB_REVERSES,
|
||||
TTB_UNDERLINES,
|
||||
TTB_BADWORDS,
|
||||
TTB_CAPS,
|
||||
TTB_FLOOD,
|
||||
TTB_REPEAT,
|
||||
TTB_ITALICS,
|
||||
TTB_AMSGS,
|
||||
TTB_SIZE
|
||||
};
|
||||
|
||||
#endif // BOTSERV_H
|
||||
+91
-58
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -22,20 +22,20 @@ enum CommandFlag
|
||||
CFLAG_STRIP_CHANNEL
|
||||
};
|
||||
|
||||
const Anope::string CommandFlagStrings[] = {
|
||||
"CFLAG_ALLOW_UNREGISTERED",
|
||||
"CFLAG_STRIP_CHANNEL",
|
||||
""
|
||||
};
|
||||
|
||||
/* Used in BotInfo::commands */
|
||||
struct CommandInfo
|
||||
{
|
||||
typedef Anope::map<CommandInfo> map;
|
||||
|
||||
/* Service name of the command */
|
||||
Anope::string name;
|
||||
/* Permission required to execute the command */
|
||||
Anope::string permission;
|
||||
};
|
||||
|
||||
/* Where the replies from commands go to. User inheits from this and is the normal
|
||||
* source of a CommandReply
|
||||
*/
|
||||
struct CommandReply
|
||||
{
|
||||
virtual void SendMessage(const BotInfo *source, const Anope::string &msg) = 0;
|
||||
@@ -47,16 +47,16 @@ class CoreExport CommandSource
|
||||
/* The nick executing the command */
|
||||
Anope::string nick;
|
||||
/* User executing the command, may be NULL */
|
||||
dynamic_reference<User> u;
|
||||
Reference<User> u;
|
||||
public:
|
||||
/* The account executing the command */
|
||||
dynamic_reference<NickCore> nc;
|
||||
Reference<NickCore> nc;
|
||||
/* Where the reply should go */
|
||||
CommandReply *reply;
|
||||
/* Channel the command was executed on (fantasy) */
|
||||
dynamic_reference<Channel> c;
|
||||
Reference<Channel> c;
|
||||
/* The service this command is on */
|
||||
dynamic_reference<BotInfo> service;
|
||||
Reference<BotInfo> service;
|
||||
/* The actual name of the command being executed */
|
||||
Anope::string command;
|
||||
/* The permission of the command being executed */
|
||||
@@ -88,9 +88,9 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
|
||||
|
||||
public:
|
||||
/* Maximum paramaters accepted by this command */
|
||||
size_t MaxParams;
|
||||
size_t max_params;
|
||||
/* Minimum parameters required to use this command */
|
||||
size_t MinParams;
|
||||
size_t min_params;
|
||||
|
||||
/* Module which owns us */
|
||||
Module *module;
|
||||
|
||||
+4
-24
@@ -8,7 +8,6 @@
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
@@ -207,23 +206,6 @@ typedef bool (*MultiValidator)(ServerConfig *, const Anope::string &, const Anop
|
||||
*/
|
||||
typedef bool (*MultiNotify)(ServerConfig *, const Anope::string &);
|
||||
|
||||
bool ValidateNotEmpty(ServerConfig *, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateNotZero(ServerConfig *, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateEmailReg(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidatePort(ServerConfig *, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateGuestPrefix(ServerConfig *conf, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateBantype(ServerConfig *, const Anope::string &, const Anope::string &, ValueItem &data);
|
||||
bool ValidateChanServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateMemoServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateBotServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateHostServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateLimitSessions(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateOperServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateGlobal(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateNickLen(ServerConfig *, const Anope::string &, const Anope::string &, ValueItem &data);
|
||||
bool ValidateMail(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
bool ValidateGlobalOnCycle(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
|
||||
|
||||
/** Represents a configuration file
|
||||
*/
|
||||
class ConfigurationFile
|
||||
@@ -463,8 +445,6 @@ class CoreExport ServerConfig
|
||||
bool UseServerSideTopicLock;
|
||||
/* Default botmodes on channels, defaults to ao */
|
||||
Anope::string BotModes;
|
||||
/* THe actual modes */
|
||||
ChannelStatus BotModeList;
|
||||
/* How long to wait between connection attempts */
|
||||
int RetryWait;
|
||||
/* If services should hide unprivileged commands */
|
||||
@@ -517,7 +497,7 @@ class CoreExport ServerConfig
|
||||
/* Don't allow nicks to use /ns group to regroup nicks */
|
||||
bool NSNoGroupChange;
|
||||
/* Default flags for newly registered nicks */
|
||||
Flags<NickCoreFlag, NI_END> NSDefFlags;
|
||||
Flags<NickCoreFlag> NSDefFlags;
|
||||
/* All languages Anope is aware about */
|
||||
Anope::string Languages;
|
||||
/* Default language used by services */
|
||||
@@ -578,7 +558,7 @@ class CoreExport ServerConfig
|
||||
/* Core ChanServ modules */
|
||||
Anope::string ChanCoreModules;
|
||||
/* Default flags for newly registered channels */
|
||||
Flags<ChannelInfoFlag, CI_END> CSDefFlags;
|
||||
Flags<ChannelInfoFlag> CSDefFlags;
|
||||
/* Max number of channels a user can own */
|
||||
unsigned CSMaxReg;
|
||||
/* Time before a channel expires */
|
||||
@@ -741,7 +721,7 @@ class ConfigException : public CoreException
|
||||
#define CONF_FILE_NOT_FOUND 0x000200
|
||||
|
||||
/** Allows reading of values from configuration files
|
||||
* This class allows a module to read from either the main configuration file (inspircd.conf) or from
|
||||
* This class allows a module to read from either the main configuration file (services.conf) or from
|
||||
* a module-specified configuration file. It may either be instantiated with one parameter or none.
|
||||
* Constructing the class using one parameter allows you to specify a path to your own configuration
|
||||
* file, otherwise, inspircd.conf is read.
|
||||
@@ -836,7 +816,7 @@ class CoreExport ConfigReader
|
||||
int EnumerateValues(const Anope::string &, int);
|
||||
};
|
||||
|
||||
extern ConfigurationFile services_conf;
|
||||
extern ConfigurationFile ServicesConf;
|
||||
extern CoreExport ServerConfig *Config;
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
+4
-4
@@ -23,21 +23,21 @@ class ClientSocket;
|
||||
class Command;
|
||||
class CommandSource;
|
||||
class ConnectionSocket;
|
||||
class DNSPacket;
|
||||
class dynamic_reference_base;
|
||||
namespace DNS { class Packet; }
|
||||
class Entry;
|
||||
class IdentifyRequest;
|
||||
class InfoFormatter;
|
||||
class IRCDProto;
|
||||
class ListenSocket;
|
||||
class Log;
|
||||
class LogInfo;
|
||||
class Memo;
|
||||
class Message;
|
||||
class MessageSource;
|
||||
class Module;
|
||||
class NickAlias;
|
||||
class NickCore;
|
||||
class OperType;
|
||||
class ReferenceBase;
|
||||
class Regex;
|
||||
class Serializable;
|
||||
class Server;
|
||||
@@ -48,7 +48,7 @@ class User;
|
||||
class XLine;
|
||||
class XLineManager;
|
||||
struct BadWord;
|
||||
struct DNSQuery;
|
||||
namespace DNS { struct Query; }
|
||||
struct Exception;
|
||||
struct MemoInfo;
|
||||
struct ModeLock;
|
||||
|
||||
+247
-236
File diff suppressed because it is too large
Load Diff
+17
-5
@@ -1,7 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 Anope Team <team@anope.org>
|
||||
*
|
||||
* (C) 2003-2012 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EXTENSIBLE_H
|
||||
@@ -9,19 +12,28 @@
|
||||
|
||||
#include "anope.h"
|
||||
|
||||
/* All items added to Extensible must inherit from this.
|
||||
*/
|
||||
class CoreExport ExtensibleItem
|
||||
{
|
||||
public:
|
||||
ExtensibleItem();
|
||||
virtual ~ExtensibleItem();
|
||||
virtual void OnDelete();
|
||||
virtual ~ExtensibleItem() { }
|
||||
|
||||
/* Called when this ExtensibleItem is being deleted. This should
|
||||
* clean up things (eg, delete this;) if necessary.
|
||||
*/
|
||||
virtual void OnDelete() { delete this; }
|
||||
};
|
||||
|
||||
/** Common class used to Extensible::Extend non-pointers from, as it doesn't delete
|
||||
* itself when removed. Eg, obj->Extend(key, new ExtensibleItemClass<Anope::string>(value));
|
||||
*/
|
||||
template<typename T> struct CoreExport ExtensibleItemClass : T, ExtensibleItem
|
||||
{
|
||||
ExtensibleItemClass(const T& t) : T(t) { }
|
||||
};
|
||||
|
||||
/* Used to attach arbitrary objects to this object using unique keys */
|
||||
class CoreExport Extensible
|
||||
{
|
||||
private:
|
||||
@@ -33,7 +45,7 @@ class CoreExport Extensible
|
||||
*/
|
||||
Extensible() { }
|
||||
|
||||
/** Default destructor, deletes all of the extensible items in this object
|
||||
/** Destructor, deletes all of the extensible items in this object
|
||||
* then clears the map
|
||||
*/
|
||||
virtual ~Extensible()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+15
-15
@@ -1,13 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2002-2011 InspIRCd Development Team
|
||||
* Copyright (C) 2009-2012 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* These classes have been copied from InspIRCd and modified
|
||||
* for use in Anope.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HASHCOMP_H
|
||||
@@ -28,13 +25,15 @@ namespace Anope
|
||||
{
|
||||
class string;
|
||||
|
||||
/* Casemap in use by Anope. ci::string's comparation functions use this (and thus Anope::string) */
|
||||
extern std::locale casemap;
|
||||
|
||||
template<typename charT>
|
||||
class ascii_ctype : public std::ctype<charT>
|
||||
/* ASCII case insensitive ctype. */
|
||||
template<typename char_type>
|
||||
class ascii_ctype : public std::ctype<char_type>
|
||||
{
|
||||
public:
|
||||
charT do_toupper(charT c) const anope_override
|
||||
char_type do_toupper(char_type c) const anope_override
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
return c - 32;
|
||||
@@ -42,7 +41,7 @@ namespace Anope
|
||||
return c;
|
||||
}
|
||||
|
||||
charT do_tolower(charT c) const anope_override
|
||||
char_type do_tolower(char_type c) const anope_override
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return c + 32;
|
||||
@@ -51,29 +50,30 @@ namespace Anope
|
||||
}
|
||||
};
|
||||
|
||||
template<typename charT>
|
||||
class rfc1459_ctype : public ascii_ctype<charT>
|
||||
/* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */
|
||||
template<typename char_type>
|
||||
class rfc1459_ctype : public ascii_ctype<char_type>
|
||||
{
|
||||
public:
|
||||
charT do_toupper(charT c) const anope_override
|
||||
char_type do_toupper(char_type c) const anope_override
|
||||
{
|
||||
if (c == '{' || c == '}' || c == '|')
|
||||
return c - 32;
|
||||
else
|
||||
return ascii_ctype<charT>::do_toupper(c);
|
||||
return ascii_ctype<char_type>::do_toupper(c);
|
||||
}
|
||||
|
||||
charT do_tolower(charT c) const anope_override
|
||||
char_type do_tolower(char_type c) const anope_override
|
||||
{
|
||||
if (c == '[' || c == ']' || c == '\\')
|
||||
return c + 32;
|
||||
else
|
||||
return ascii_ctype<charT>::do_tolower(c);
|
||||
return ascii_ctype<char_type>::do_tolower(c);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** The ci namespace contains a number of helper classes.
|
||||
/** The ci namespace contains a number of helper classes relevant to case insensitive strings.
|
||||
*/
|
||||
namespace ci
|
||||
{
|
||||
|
||||
+57
-1
@@ -1,11 +1,67 @@
|
||||
/* Commonly used language strings
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2012 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Language
|
||||
{
|
||||
|
||||
/* Languages we support as configured in services.conf. They are
|
||||
* added to this list if we detect a language exists in the correct
|
||||
* location for each language.
|
||||
*/
|
||||
extern std::vector<Anope::string> Languages;
|
||||
|
||||
/* Domains to search when looking for translations other than the
|
||||
* default "anope domain. This is used by modules who add their own
|
||||
* language files (and thus domains) to Anope. If a module is loaded
|
||||
* and we detect a language file exists for at least one of the supported
|
||||
* languages for the module, then we add the module's domain (its name)
|
||||
* here.
|
||||
*
|
||||
* When strings are translated they are checked against all domains.
|
||||
*/
|
||||
extern std::vector<Anope::string> Domains;
|
||||
|
||||
/** Initialize the language system. Finds valid language files and
|
||||
* populates the Languages list.
|
||||
*/
|
||||
extern void InitLanguages();
|
||||
|
||||
/** Translates a string to the default language.
|
||||
* @param string A string to translate
|
||||
* @return The translated string if found, else the original string.
|
||||
*/
|
||||
extern const char *Translate(const char *string);
|
||||
|
||||
/** Translates a string to the language of the given user.
|
||||
* @param u The user to transate the string for
|
||||
* @param string A string to translate
|
||||
* @return The translated string if found, else the original string.
|
||||
*/
|
||||
extern const char *Translate(User *u, const char *string);
|
||||
|
||||
/** Translates a string to the language of the given account.
|
||||
* @param nc The account to translate the string for
|
||||
* @param string A string to translate
|
||||
* @return The translated string if count, else the original string
|
||||
*/
|
||||
extern const char *Translate(const NickCore *nc, const char *string);
|
||||
|
||||
/** Translatesa string to the given language.
|
||||
* @param lang The language to trnalsate to
|
||||
* @param string The string to translate
|
||||
* @return The translated string if found, else the original string.
|
||||
*/
|
||||
extern const char *Translate(const char *lang, const char *string);
|
||||
|
||||
} // namespace Language
|
||||
|
||||
/* Commonly used language strings */
|
||||
#define MORE_INFO _("\002%s%s HELP %s\002 for more information.")
|
||||
#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.")
|
||||
#define BAD_EXPIRY_TIME _("Invalid expiry time.")
|
||||
|
||||
+5
-6
@@ -8,7 +8,6 @@
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LISTS_H
|
||||
@@ -48,9 +47,9 @@ class CoreExport NumberList
|
||||
void Process();
|
||||
|
||||
/** Called with a number from the list
|
||||
* @param Number The number
|
||||
* @param number The number
|
||||
*/
|
||||
virtual void HandleNumber(unsigned Number);
|
||||
virtual void HandleNumber(unsigned number);
|
||||
|
||||
/** Called when there is an error with the numbered list
|
||||
* Return false to immediatly stop processing the list and return
|
||||
@@ -71,9 +70,9 @@ class CoreExport ListFormatter
|
||||
std::vector<Anope::string> columns;
|
||||
std::vector<ListEntry> entries;
|
||||
public:
|
||||
ListFormatter &addColumn(const Anope::string &name);
|
||||
void addEntry(const ListEntry &entry);
|
||||
bool isEmpty() const;
|
||||
ListFormatter &AddColumn(const Anope::string &name);
|
||||
void AddEntry(const ListEntry &entry);
|
||||
bool IsEmpty() const;
|
||||
void Process(std::vector<Anope::string> &);
|
||||
};
|
||||
|
||||
|
||||
+33
-19
@@ -18,8 +18,13 @@
|
||||
|
||||
enum LogType
|
||||
{
|
||||
/* Used whenever an administrator uses an administrative comand */
|
||||
LOG_ADMIN,
|
||||
/* Used whenever an administrator overides something, such as adding
|
||||
* access to a channel where they don't have permission to.
|
||||
*/
|
||||
LOG_OVERRIDE,
|
||||
/* Any other command usage */
|
||||
LOG_COMMAND,
|
||||
LOG_SERVER,
|
||||
LOG_CHANNEL,
|
||||
@@ -37,30 +42,37 @@ enum LogType
|
||||
struct LogFile
|
||||
{
|
||||
Anope::string filename;
|
||||
|
||||
public:
|
||||
std::ofstream stream;
|
||||
|
||||
LogFile(const Anope::string &name);
|
||||
Anope::string GetName() const;
|
||||
};
|
||||
|
||||
|
||||
/* Represents a single log message */
|
||||
class CoreExport Log
|
||||
{
|
||||
public:
|
||||
/* Bot that should log this message */
|
||||
const BotInfo *bi;
|
||||
/* For commands, the user executing the command */
|
||||
Anope::string nick;
|
||||
/* For commands, the user executing the command, but might not always exist */
|
||||
const User *u;
|
||||
/* For commands, the account executing teh command, but will not always exist */
|
||||
const NickCore *nc;
|
||||
/* For commands, the command being executed */
|
||||
Command *c;
|
||||
/* Used for LOG_CHANNEL */
|
||||
Channel *chan;
|
||||
/* For commands, the channel the command was executed on, will not always exist */
|
||||
const ChannelInfo *ci;
|
||||
/* For LOG_SERVER */
|
||||
Server *s;
|
||||
/* For LOG_MODULE */
|
||||
Module *m;
|
||||
LogType Type;
|
||||
Anope::string Category;
|
||||
std::list<Anope::string> Sources;
|
||||
LogType type;
|
||||
Anope::string category;
|
||||
std::list<Anope::string> sources;
|
||||
|
||||
std::stringstream buf;
|
||||
|
||||
@@ -93,22 +105,23 @@ class CoreExport Log
|
||||
}
|
||||
};
|
||||
|
||||
/* Configured in the configuration file, actually does the message logging */
|
||||
class CoreExport LogInfo
|
||||
{
|
||||
public:
|
||||
std::list<Anope::string> Targets;
|
||||
std::map<Anope::string, LogFile *> Logfiles;
|
||||
std::list<Anope::string> Sources;
|
||||
int LogAge;
|
||||
std::list<Anope::string> Admin;
|
||||
std::list<Anope::string> Override;
|
||||
std::list<Anope::string> Commands;
|
||||
std::list<Anope::string> Servers;
|
||||
std::list<Anope::string> Users;
|
||||
std::list<Anope::string> Channels;
|
||||
std::list<Anope::string> Normal;
|
||||
bool RawIO;
|
||||
bool Debug;
|
||||
std::list<Anope::string> targets;
|
||||
std::map<Anope::string, LogFile *> logfiles;
|
||||
std::list<Anope::string> sources;
|
||||
int log_age;
|
||||
std::list<Anope::string> admin;
|
||||
std::list<Anope::string> override;
|
||||
std::list<Anope::string> commands;
|
||||
std::list<Anope::string> servers;
|
||||
std::list<Anope::string> users;
|
||||
std::list<Anope::string> channels;
|
||||
std::list<Anope::string> normal;
|
||||
bool raw_io;
|
||||
bool debug;
|
||||
|
||||
LogInfo(int logage, bool rawio, bool debug);
|
||||
|
||||
@@ -118,6 +131,7 @@ class CoreExport LogInfo
|
||||
|
||||
bool HasType(LogType ltype, const Anope::string &type) const;
|
||||
|
||||
/* Logs the message l if configured to */
|
||||
void ProcessMessage(const Log *l);
|
||||
};
|
||||
|
||||
|
||||
+32
-19
@@ -18,28 +18,41 @@
|
||||
#include "threadengine.h"
|
||||
#include "serialize.h"
|
||||
|
||||
extern CoreExport bool Mail(User *u, NickCore *nc, const BotInfo *service, const Anope::string &subject, const Anope::string &message);
|
||||
extern CoreExport bool Mail(NickCore *nc, const Anope::string &subject, const Anope::string &message);
|
||||
extern CoreExport bool MailValidate(const Anope::string &email);
|
||||
|
||||
class MailThread : public Thread
|
||||
namespace Mail
|
||||
{
|
||||
private:
|
||||
Anope::string SendMailPath;
|
||||
Anope::string SendFrom;
|
||||
Anope::string MailTo;
|
||||
Anope::string Addr;
|
||||
Anope::string Subject;
|
||||
Anope::string Message;
|
||||
bool DontQuoteAddresses;
|
||||
extern CoreExport bool Send(User *from, NickCore *to, const BotInfo *service, const Anope::string &subject, const Anope::string &message);
|
||||
extern CoreExport bool Send(NickCore *to, const Anope::string &subject, const Anope::string &message);
|
||||
extern CoreExport bool Validate(const Anope::string &email);
|
||||
|
||||
bool Success;
|
||||
public:
|
||||
MailThread(const Anope::string &smpath, const Anope::string &sf, const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
|
||||
/* A email message being sent */
|
||||
class Message : public Thread
|
||||
{
|
||||
private:
|
||||
Anope::string sendmail_path;
|
||||
Anope::string send_from;
|
||||
Anope::string mail_to;
|
||||
Anope::string addr;
|
||||
Anope::string subject;
|
||||
Anope::string message;
|
||||
bool dont_quote_addresses;
|
||||
|
||||
~MailThread();
|
||||
bool success;
|
||||
public:
|
||||
/** Construct this message. Once constructed call Thread::Start to launch the mail sending.
|
||||
* @param sf Config->SendFrom
|
||||
* @param mailto Name of person being mailed (u->nick, nc->display, etc)
|
||||
* @param addr Destination address to mail
|
||||
* @param subject Message subject
|
||||
* @param message The actual message
|
||||
*/
|
||||
Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
|
||||
|
||||
void Run();
|
||||
};
|
||||
~Message();
|
||||
|
||||
/* Called from within the thread to actually send the mail */
|
||||
void Run() anope_override;
|
||||
};
|
||||
|
||||
} // namespace Mail
|
||||
|
||||
#endif // MAIL_H
|
||||
|
||||
+8
-11
@@ -8,7 +8,6 @@
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MEMO_H
|
||||
@@ -27,30 +26,28 @@ enum MemoFlag
|
||||
MF_RECEIPT
|
||||
};
|
||||
|
||||
const Anope::string MemoFlagStrings[] = {
|
||||
"MF_UNREAD", "MF_RECEIPT", ""
|
||||
};
|
||||
|
||||
/* Memo info structures. Since both nicknames and channels can have memos,
|
||||
* we encapsulate memo data in a MemoList to make it easier to handle. */
|
||||
class CoreExport Memo : public Flags<MemoFlag>, public Serializable
|
||||
{
|
||||
public:
|
||||
Memo();
|
||||
|
||||
Serialize::Data serialize() const anope_override;
|
||||
static Serializable* unserialize(Serializable *obj, Serialize::Data &);
|
||||
Serialize::Data Serialize() const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
Anope::string owner;
|
||||
time_t time; /* When it was sent */
|
||||
/* When it was sent */
|
||||
time_t time;
|
||||
Anope::string sender;
|
||||
Anope::string text;
|
||||
};
|
||||
|
||||
/* Memo info structures. Since both nicknames and channels can have memos,
|
||||
* we encapsulate memo data in a MemoInfo to make it easier to handle.
|
||||
*/
|
||||
struct CoreExport MemoInfo
|
||||
{
|
||||
int16_t memomax;
|
||||
serialize_checker<std::vector<Memo *> > memos;
|
||||
Serialize::Checker<std::vector<Memo *> > memos;
|
||||
std::vector<Anope::string> ignores;
|
||||
|
||||
MemoInfo();
|
||||
|
||||
+150
-115
File diff suppressed because it is too large
Load Diff
+104
-118
File diff suppressed because it is too large
Load Diff
+5
-3
@@ -18,13 +18,11 @@
|
||||
#include "anope.h"
|
||||
#include "base.h"
|
||||
#include "bots.h"
|
||||
#include "botserv.h"
|
||||
#include "channels.h"
|
||||
#include "commands.h"
|
||||
#include "config.h"
|
||||
#include "dns.h"
|
||||
#include "extensible.h"
|
||||
#include "extern.h"
|
||||
#include "hashcomp.h"
|
||||
#include "language.h"
|
||||
#include "lists.h"
|
||||
@@ -34,7 +32,6 @@
|
||||
#include "messages.h"
|
||||
#include "modes.h"
|
||||
#include "modules.h"
|
||||
#include "oper.h"
|
||||
#include "opertype.h"
|
||||
#include "protocol.h"
|
||||
#include "regexpr.h"
|
||||
@@ -50,9 +47,14 @@
|
||||
#include "timers.h"
|
||||
#include "uplink.h"
|
||||
#include "users.h"
|
||||
#include "xline.h"
|
||||
|
||||
#include "chanserv.h"
|
||||
#include "botserv.h"
|
||||
#include "global.h"
|
||||
#include "hostserv.h"
|
||||
#include "memoserv.h"
|
||||
#include "nickserv.h"
|
||||
#include "operserv.h"
|
||||
|
||||
#endif // MODULE_H
|
||||
|
||||
+42
-32
File diff suppressed because it is too large
Load Diff
+9
-1
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2008-2012 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OPERTYPE_H
|
||||
@@ -11,15 +12,22 @@
|
||||
#include "services.h"
|
||||
#include "account.h"
|
||||
|
||||
/* A services operator. Usually made by the configuration file, but not always.
|
||||
* NickAlias::Find(name)->nc->o == this
|
||||
*/
|
||||
struct CoreExport Oper
|
||||
{
|
||||
/* The oper's nick */
|
||||
Anope::string name;
|
||||
/* The type of operator this operator is */
|
||||
OperType *ot;
|
||||
/* Whether the user must be an IRC operator (umode +o) to be considered a services operator */
|
||||
bool require_oper;
|
||||
Anope::string password;
|
||||
Anope::string certfp;
|
||||
/* True if this operator is set in the config */
|
||||
bool config;
|
||||
|
||||
/* Hosts allowed to use this operator block */
|
||||
std::vector<Anope::string> hosts;
|
||||
Anope::string vhost;
|
||||
|
||||
|
||||
+114
-32
File diff suppressed because it is too large
Load Diff
+124
-64
File diff suppressed because it is too large
Load Diff
+119
-57
File diff suppressed because it is too large
Load Diff
+37
-15
@@ -1,3 +1,15 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2012 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SERVERS_H
|
||||
#define SERVERS_H
|
||||
|
||||
@@ -5,13 +17,25 @@
|
||||
#include "anope.h"
|
||||
#include "extensible.h"
|
||||
|
||||
/* Anope */
|
||||
/* Anope. We are at the top of the server tree, our uplink is
|
||||
* almost always me->GetLinks()[0]. We never have an uplink. */
|
||||
extern CoreExport Server *Me;
|
||||
|
||||
extern CoreExport const Anope::string ts6_uid_retrieve();
|
||||
extern CoreExport const Anope::string ts6_sid_retrieve();
|
||||
namespace Servers
|
||||
{
|
||||
/* Retrieves the next free TS6 UID or SID */
|
||||
extern CoreExport const Anope::string TS6_UID_Retrieve();
|
||||
extern CoreExport const Anope::string TS6_SID_Retrieve();
|
||||
|
||||
extern CoreExport std::set<Anope::string> Capab;
|
||||
/* Gets our uplink. Note we don't actually have an "uplink", this is just
|
||||
* the only server whose uplink *is* Me that is not a juped server.
|
||||
* @return Our uplink, or NULL if not uplinked to anything
|
||||
*/
|
||||
extern CoreExport Server* GetUplink();
|
||||
|
||||
/* CAPAB/PROTOCTL given by the uplink */
|
||||
extern CoreExport std::set<Anope::string> Capab;
|
||||
}
|
||||
|
||||
/** Flags set on servers
|
||||
*/
|
||||
@@ -24,28 +48,26 @@ enum ServerFlag
|
||||
SERVER_JUPED
|
||||
};
|
||||
|
||||
const Anope::string ServerFlagStrings[] = { "SERVER_NONE", "SERVER_SYNCING", "SERVER_JUPED", "" };
|
||||
|
||||
/** Class representing a server
|
||||
*/
|
||||
class CoreExport Server : public Flags<ServerFlag>, public Extensible
|
||||
{
|
||||
private:
|
||||
/* Server name */
|
||||
Anope::string Name;
|
||||
Anope::string name;
|
||||
/* Hops between services and server */
|
||||
unsigned int Hops;
|
||||
unsigned int hops;
|
||||
/* Server description */
|
||||
Anope::string Description;
|
||||
Anope::string description;
|
||||
/* Server ID */
|
||||
Anope::string SID;
|
||||
Anope::string sid;
|
||||
/* Links for this server */
|
||||
std::vector<Server *> Links;
|
||||
std::vector<Server *> links;
|
||||
/* Uplink for this server */
|
||||
Server *UplinkServer;
|
||||
Server *uplink;
|
||||
|
||||
/* Reason this server was quit */
|
||||
Anope::string QReason;
|
||||
Anope::string quit_reason;
|
||||
|
||||
public:
|
||||
/** Constructor
|
||||
@@ -65,7 +87,7 @@ class CoreExport Server : public Flags<ServerFlag>, public Extensible
|
||||
|
||||
public:
|
||||
/* Number of users on the server */
|
||||
unsigned Users;
|
||||
unsigned users;
|
||||
|
||||
/** Delete this server with a reason
|
||||
* @param reason The reason
|
||||
@@ -125,7 +147,7 @@ class CoreExport Server : public Flags<ServerFlag>, public Extensible
|
||||
/** Finish syncing this server and optionally all links to it
|
||||
* @param SyncLinks True to sync the links for this server too (if any)
|
||||
*/
|
||||
void Sync(bool SyncLinks);
|
||||
void Sync(bool sync_links);
|
||||
|
||||
/** Check if this server is synced
|
||||
* @return true or false
|
||||
|
||||
+70
-14
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SERVICES_H
|
||||
@@ -66,13 +65,4 @@
|
||||
# include "anope_windows.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* RFC: defination of a valid nick
|
||||
* nickname = ( letter / special ) *8( letter / digit / special / "-" )
|
||||
* letter = %x41-5A / %x61-7A ; A-Z / a-z
|
||||
* digit = %x30-39 ; 0-9
|
||||
* special = %x5B-60 / %x7B-7D ; "[", "]", "\", "`", "_", "^", "{", "|", "}"
|
||||
**/
|
||||
#define isvalidnick(c) (isalnum(c) || ((c) >= '\x5B' && (c) <= '\x60') || ((c) >= '\x7B' && (c) <= '\x7D') || (c) == '-')
|
||||
|
||||
#endif // SERVICES_H
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SIGNAL_H
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SOCKETENGINE_H
|
||||
@@ -17,7 +18,7 @@
|
||||
|
||||
class CoreExport SocketEngine
|
||||
{
|
||||
static const int DefaultSize = 4; // Uplink, DNS, Signal handler, Mode stacker
|
||||
static const int DefaultSize = 8; // Uplink, DNS, Signal handlers, Mode stacker
|
||||
public:
|
||||
/* Map of sockets */
|
||||
static std::map<int, Socket *> Sockets;
|
||||
|
||||
+21
-40
File diff suppressed because it is too large
Load Diff
+13
-1
@@ -1,3 +1,15 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2012 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef THREADENGINE_H
|
||||
#define THREADENGINE_H
|
||||
|
||||
@@ -12,7 +24,7 @@ class CoreExport Thread : public Pipe, public Extensible
|
||||
|
||||
public:
|
||||
/* Handle for this thread */
|
||||
pthread_t Handle;
|
||||
pthread_t handle;
|
||||
|
||||
/** Threads constructor
|
||||
*/
|
||||
|
||||
+8
-6
@@ -4,8 +4,10 @@
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TIMERS_H
|
||||
@@ -33,14 +35,14 @@ class CoreExport Timer
|
||||
bool repeat;
|
||||
|
||||
public:
|
||||
/** Default constructor, initializes the triggering time
|
||||
/** Constructor, initializes the triggering time
|
||||
* @param time_from_now The number of seconds from now to trigger the timer
|
||||
* @param now The time now
|
||||
* @param repeating Repeat this timer every time_from_now if this is true
|
||||
*/
|
||||
Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
|
||||
|
||||
/** Default destructor, removes the timer from the list
|
||||
/** Destructor, removes the timer from the list
|
||||
*/
|
||||
virtual ~Timer();
|
||||
|
||||
@@ -91,14 +93,14 @@ class CoreExport TimerManager
|
||||
static std::vector<Timer *> Timers;
|
||||
public:
|
||||
/** Add a timer to the list
|
||||
* @param T A Timer derived class to add
|
||||
* @param t A Timer derived class to add
|
||||
*/
|
||||
static void AddTimer(Timer *T);
|
||||
static void AddTimer(Timer *t);
|
||||
|
||||
/** Deletes a timer
|
||||
* @param T A Timer derived class to delete
|
||||
* @param t A Timer derived class to delete
|
||||
*/
|
||||
static void DelTimer(Timer *T);
|
||||
static void DelTimer(Timer *t);
|
||||
|
||||
/** Tick all pending timers
|
||||
* @param ctime The current time
|
||||
|
||||
+10
-1
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UPLINK_H
|
||||
@@ -14,6 +15,12 @@
|
||||
|
||||
#include "sockets.h"
|
||||
|
||||
namespace Uplink
|
||||
{
|
||||
extern void Connect();
|
||||
}
|
||||
|
||||
/* This is the socket to our uplink */
|
||||
class UplinkSocket : public ConnectionSocket, public BufferedSocket
|
||||
{
|
||||
public:
|
||||
@@ -22,10 +29,12 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket
|
||||
bool Read(const Anope::string &);
|
||||
void OnConnect();
|
||||
void OnError(const Anope::string &);
|
||||
|
||||
|
||||
/* A message sent over the uplink socket */
|
||||
class CoreExport Message
|
||||
{
|
||||
private:
|
||||
/* The source of the message, can be a server (Me), or any user (one of our bots) */
|
||||
const Server *server;
|
||||
const User *user;
|
||||
std::stringstream buffer;
|
||||
|
||||
+88
-55
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,31 @@
|
||||
/* OperServ support
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2012 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OPER_H
|
||||
#define OPER_H
|
||||
#ifndef XLINE_H
|
||||
#define XLINE_H
|
||||
|
||||
#include "serialize.h"
|
||||
#include "service.h"
|
||||
|
||||
/* An Xline, eg, anything added with operserv/akill, or any of the operserv/sxline commands */
|
||||
class CoreExport XLine : public Serializable
|
||||
{
|
||||
void InitRegex();
|
||||
public:
|
||||
Anope::string Mask;
|
||||
Anope::string mask;
|
||||
Regex *regex;
|
||||
Anope::string By;
|
||||
time_t Created;
|
||||
time_t Expires;
|
||||
Anope::string Reason;
|
||||
Anope::string by;
|
||||
time_t created;
|
||||
time_t expires;
|
||||
Anope::string reason;
|
||||
XLineManager *manager;
|
||||
Anope::string UID;
|
||||
Anope::string id;
|
||||
|
||||
XLine(const Anope::string &mask, const Anope::string &reason = "", const Anope::string &uid = "");
|
||||
|
||||
@@ -40,17 +42,18 @@ class CoreExport XLine : public Serializable
|
||||
bool HasNickOrReal() const;
|
||||
bool IsRegex() const;
|
||||
|
||||
Serialize::Data serialize() const anope_override;
|
||||
static Serializable* unserialize(Serializable *obj, Serialize::Data &data);
|
||||
Serialize::Data Serialize() const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
/* Managers XLines. There is one XLineManager per type of XLine. */
|
||||
class CoreExport XLineManager : public Service
|
||||
{
|
||||
char type;
|
||||
/* List of XLines in this XLineManager */
|
||||
serialize_checker<std::vector<XLine *> > XLines;
|
||||
Serialize::Checker<std::vector<XLine *> > xlines;
|
||||
/* Akills can have the same IDs, sometimes */
|
||||
static serialize_checker<std::multimap<Anope::string, XLine *, ci::less> > XLinesByUID;
|
||||
static Serialize::Checker<std::multimap<Anope::string, XLine *, ci::less> > XLinesByUID;
|
||||
public:
|
||||
/* List of XLine managers we check users against in XLineManager::CheckAll */
|
||||
static std::list<XLineManager *> XLineManagers;
|
||||
@@ -174,4 +177,4 @@ class CoreExport XLineManager : public Service
|
||||
virtual void SendDel(XLine *x) = 0;
|
||||
};
|
||||
|
||||
#endif // OPER_H
|
||||
#endif // XLINE_H
|
||||
@@ -27,20 +27,20 @@ class CommandBSAssign : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
const Anope::string &nick = params[1];
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(BOT_ASSIGN_READONLY);
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
BotInfo *bi = findbot(nick);
|
||||
BotInfo *bi = BotInfo::Find(nick, true);
|
||||
if (!bi)
|
||||
{
|
||||
source.Reply(BOT_DOES_NOT_EXIST, nick.c_str());
|
||||
@@ -95,13 +95,13 @@ class CommandBSUnassign : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(BOT_ASSIGN_READONLY);
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -19,10 +19,10 @@ class BadwordsDelCallback : public NumberList
|
||||
CommandSource &source;
|
||||
ChannelInfo *ci;
|
||||
Command *c;
|
||||
unsigned Deleted;
|
||||
unsigned deleted;
|
||||
bool override;
|
||||
public:
|
||||
BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), Deleted(0), override(false)
|
||||
BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false)
|
||||
{
|
||||
if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration"))
|
||||
this->override = true;
|
||||
@@ -30,12 +30,12 @@ class BadwordsDelCallback : public NumberList
|
||||
|
||||
~BadwordsDelCallback()
|
||||
{
|
||||
if (!Deleted)
|
||||
if (!deleted)
|
||||
source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str());
|
||||
else if (Deleted == 1)
|
||||
else if (deleted == 1)
|
||||
source.Reply(_("Deleted 1 entry from %s bad words list."), ci->name.c_str());
|
||||
else
|
||||
source.Reply(_("Deleted %d entries from %s bad words list."), Deleted, ci->name.c_str());
|
||||
source.Reply(_("Deleted %d entries from %s bad words list."), deleted, ci->name.c_str());
|
||||
}
|
||||
|
||||
void HandleNumber(unsigned Number) anope_override
|
||||
@@ -44,7 +44,7 @@ class BadwordsDelCallback : public NumberList
|
||||
return;
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "DEL " << ci->GetBadWord(Number - 1)->word;
|
||||
++Deleted;
|
||||
++deleted;
|
||||
ci->EraseBadWord(Number - 1);
|
||||
}
|
||||
};
|
||||
@@ -58,7 +58,7 @@ class CommandBSBadwords : public Command
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST";
|
||||
ListFormatter list;
|
||||
|
||||
list.addColumn("Number").addColumn("Word").addColumn("Type");
|
||||
list.AddColumn("Number").AddColumn("Word").AddColumn("Type");
|
||||
|
||||
if (!ci->GetBadWordCount())
|
||||
{
|
||||
@@ -86,7 +86,7 @@ class CommandBSBadwords : public Command
|
||||
entry["Number"] = stringify(Number);
|
||||
entry["Word"] = bw->word;
|
||||
entry["Type"] = bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : ""));
|
||||
this->list.addEntry(entry);
|
||||
this->list.AddEntry(entry);
|
||||
}
|
||||
}
|
||||
nl_list(list, ci, word);
|
||||
@@ -105,11 +105,11 @@ class CommandBSBadwords : public Command
|
||||
entry["Number"] = stringify(i + 1);
|
||||
entry["Word"] = bw->word;
|
||||
entry["Type"] = bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : ""));
|
||||
list.addEntry(entry);
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
if (list.isEmpty())
|
||||
if (list.IsEmpty())
|
||||
source.Reply(_("No matching entries on %s badword list."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
@@ -241,7 +241,7 @@ class CommandBSBadwords : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -254,7 +254,7 @@ class CommandBSBadwords : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(_("Sorry, channel bad words list modification is temporarily disabled."));
|
||||
return;
|
||||
|
||||
+31
-72
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ class CommandBSBotList : public Command
|
||||
unsigned count = 0;
|
||||
ListFormatter list;
|
||||
|
||||
list.addColumn("Nick").addColumn("Mask");
|
||||
list.AddColumn("Nick").AddColumn("Mask");
|
||||
|
||||
for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ class CommandBSBotList : public Command
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Nick"] = (bi->HasFlag(BI_PRIVATE) ? "* " : "") + bi->nick;
|
||||
entry["Mask"] = bi->GetIdent() + "@" + bi->host;
|
||||
list.addEntry(entry);
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class CommandBSSay : public Command
|
||||
{
|
||||
const Anope::string &text = params[1];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -57,7 +57,7 @@ class CommandBSSay : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
|
||||
IRCD->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
|
||||
ci->bi->lastmsg = Anope::CurTime;
|
||||
|
||||
// XXX need a way to find if someone is overriding this
|
||||
@@ -88,7 +88,7 @@ class CommandBSAct : public Command
|
||||
{
|
||||
Anope::string message = params[1];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -117,7 +117,7 @@ class CommandBSAct : public Command
|
||||
while ((i = message.find(1)) && i != Anope::string::npos)
|
||||
message.erase(i, 1);
|
||||
|
||||
ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str());
|
||||
IRCD->SendAction(ci->bi, ci->name, "%s", message.c_str());
|
||||
ci->bi->lastmsg = Anope::CurTime;
|
||||
|
||||
// XXX Need to be able to find if someone is overriding this.
|
||||
|
||||
@@ -44,7 +44,7 @@ class CommandBSInfo : public Command
|
||||
{
|
||||
if (!buf.empty())
|
||||
buf += ", ";
|
||||
buf += translate(nc, option);
|
||||
buf += Language::Translate(nc, option);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class CommandBSInfo : public Command
|
||||
{
|
||||
const Anope::string &query = params[0];
|
||||
|
||||
const BotInfo *bi = findbot(query);
|
||||
const BotInfo *bi = BotInfo::Find(query, true);
|
||||
ChannelInfo *ci;
|
||||
InfoFormatter info(source.nc);
|
||||
|
||||
@@ -68,7 +68,7 @@ class CommandBSInfo : public Command
|
||||
source.Reply(_("Information for bot \002%s\002:"), bi->nick.c_str());
|
||||
info[_("Mask")] = bi->GetIdent() + "@" + bi->host;
|
||||
info[_("Real name")] = bi->realname;
|
||||
info[_("Created")] = do_strftime(bi->created);
|
||||
info[_("Created")] = Anope::strftime(bi->created);
|
||||
info[_("Options")] = bi->HasFlag(BI_PRIVATE) ? _("Private") : _("None");
|
||||
info[_("Used on")] = stringify(bi->GetChannelCount()) + " channel(s)";
|
||||
|
||||
@@ -87,7 +87,7 @@ class CommandBSInfo : public Command
|
||||
}
|
||||
|
||||
}
|
||||
else if ((ci = cs_findchan(query)))
|
||||
else if ((ci = ChannelInfo::Find(query)))
|
||||
{
|
||||
if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("botserv/administration"))
|
||||
{
|
||||
@@ -98,8 +98,8 @@ class CommandBSInfo : public Command
|
||||
source.Reply(CHAN_INFO_HEADER, ci->name.c_str());
|
||||
info[_("Bot nick")] = ci->bi ? ci->bi->nick : "not assigned yet";
|
||||
|
||||
Anope::string enabled = translate(source.nc, _("Enabled"));
|
||||
Anope::string disabled = translate(source.nc, _("Disabled"));
|
||||
Anope::string enabled = Language::Translate(source.nc, _("Enabled"));
|
||||
Anope::string disabled = Language::Translate(source.nc, _("Disabled"));
|
||||
|
||||
if (ci->botflags.HasFlag(BS_KICK_BADWORDS))
|
||||
{
|
||||
|
||||
@@ -30,9 +30,9 @@ class CommandBSKick : public Command
|
||||
const Anope::string &value = params[2];
|
||||
const Anope::string &ttb = params.size() > 3 ? params[3] : "";
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
source.Reply(_("Sorry, kicker configuration is temporarily disabled."));
|
||||
else if (ci == NULL)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -736,14 +736,12 @@ class BSKick : public Module
|
||||
/* Should not use == here because bd.ttb[ttbtype] could possibly be > ci->ttb[ttbtype]
|
||||
* if the TTB was changed after it was not set (0) before and the user had already been
|
||||
* kicked a few times. Bug #1056 - Adam */
|
||||
Anope::string mask;
|
||||
|
||||
bd.ttb[ttbtype] = 0;
|
||||
|
||||
get_idealban(ci, u, mask);
|
||||
Anope::string mask = ci->GetIdealBan(u);
|
||||
|
||||
if (ci->c)
|
||||
ci->c->SetMode(NULL, CMODE_BAN, mask);
|
||||
ci->c->SetMode(NULL, CMODE_BAN, mask);
|
||||
FOREACH_MOD(I_OnBotBan, OnBotBan(u, ci, mask));
|
||||
}
|
||||
}
|
||||
@@ -756,7 +754,7 @@ class BSKick : public Module
|
||||
if (!ci || !ci->bi || !ci->c || !u || u->server->IsULined() || !ci->c->FindUser(u))
|
||||
return;
|
||||
|
||||
Anope::string fmt = translate(u, message);
|
||||
Anope::string fmt = Language::Translate(u, message);
|
||||
va_start(args, message);
|
||||
vsnprintf(buf, sizeof(buf), fmt.c_str(), args);
|
||||
va_end(args);
|
||||
@@ -895,7 +893,7 @@ class BSKick : public Module
|
||||
bool mustkick = false;
|
||||
|
||||
/* Normalize the buffer */
|
||||
Anope::string nbuf = normalizeBuffer(realbuf);
|
||||
Anope::string nbuf = Anope::NormalizeBuffer(realbuf);
|
||||
|
||||
for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ class CommandBSSet : public Command
|
||||
const CommandInfo &info = it->second;
|
||||
if (c_name.find_ci(this_name + " ") == 0)
|
||||
{
|
||||
service_reference<Command> command("Command", info.name);
|
||||
ServiceReference<Command> command("Command", info.name);
|
||||
if (command)
|
||||
{
|
||||
source.command = it->first;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandBSSetDontKickOps : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -38,7 +38,7 @@ class CommandBSSetDontKickOps : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandBSSetDontKickVoices : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -38,7 +38,7 @@ class CommandBSSetDontKickVoices : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandBSSetFantasy : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
if (ci == NULL)
|
||||
@@ -39,7 +39,7 @@ class CommandBSSetFantasy : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandBSSetGreet : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
if (ci == NULL)
|
||||
@@ -39,7 +39,7 @@ class CommandBSSetGreet : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandBSSetNoBot : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
if (ci == NULL)
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandBSSetPrivate : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
BotInfo *bi = findbot(params[0]);
|
||||
BotInfo *bi = BotInfo::Find(params[0], true);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
if (bi == NULL)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -52,7 +52,7 @@ class CommandCSAppendTopic : public Command
|
||||
{
|
||||
const Anope::string &newtopic = params[1];
|
||||
|
||||
Channel *c = findchan(params[0]);;
|
||||
Channel *c = Channel::Find(params[0]);;
|
||||
|
||||
if (!c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
|
||||
@@ -29,7 +29,7 @@ class CommandCSBan : public Command
|
||||
const Anope::string &target = params[1];
|
||||
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -38,7 +38,7 @@ class CommandCSBan : public Command
|
||||
|
||||
Channel *c = ci->c;
|
||||
User *u = source.GetUser();
|
||||
User *u2 = finduser(target);
|
||||
User *u2 = User::Find(target, true);
|
||||
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
@@ -56,14 +56,13 @@ class CommandCSBan : public Command
|
||||
|
||||
if (u != u2 && ci->HasFlag(CI_PEACE) && u2_access >= u_access)
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (matches_list(ci->c, u2, CMODE_EXCEPT))
|
||||
else if (ci->c->MatchesList(u2, CMODE_EXCEPT))
|
||||
source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str());
|
||||
else if (u2->IsProtected())
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
Anope::string mask;
|
||||
get_idealban(ci, u2, mask);
|
||||
Anope::string mask = ci->GetIdealBan(u2);
|
||||
|
||||
// XXX need a way to detect if someone is overriding
|
||||
Log(LOG_COMMAND, source, this, ci) << "for " << mask;
|
||||
@@ -99,7 +98,7 @@ class CommandCSBan : public Command
|
||||
|
||||
if (u != uc->user && ci->HasFlag(CI_PEACE) && u2_access >= u_access)
|
||||
continue;
|
||||
else if (matches_list(ci->c, uc->user, CMODE_EXCEPT))
|
||||
else if (ci->c->MatchesList(uc->user, CMODE_EXCEPT))
|
||||
continue;
|
||||
else if (uc->user->IsProtected())
|
||||
continue;
|
||||
|
||||
@@ -26,7 +26,7 @@ class CommandCSClearUsers : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
Channel *c = findchan(chan);
|
||||
Channel *c = Channel::Find(chan);
|
||||
Anope::string modebuf;
|
||||
|
||||
if (!c)
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
Anope::string what = params.size() > 2 ? params[2] : "";
|
||||
|
||||
User *u = source.GetUser();
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelInfo *target_ci = cs_findchan(target);
|
||||
ChannelInfo *target_ci = ChannelInfo::Find(target);
|
||||
if (!target_ci)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, target.c_str());
|
||||
@@ -59,11 +59,11 @@ public:
|
||||
|
||||
if (what.empty())
|
||||
{
|
||||
target_ci->destroy();
|
||||
target_ci->Destroy();
|
||||
target_ci = new ChannelInfo(*ci);
|
||||
target_ci->name = target;
|
||||
(*RegisteredChannelList)[target_ci->name] = target_ci;
|
||||
target_ci->c = findchan(target_ci->name);
|
||||
target_ci->c = Channel::Find(target_ci->name);
|
||||
if (target_ci->c)
|
||||
{
|
||||
target_ci->c->ci = target_ci;
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
target_ci->c->SetMode(NULL, CMODE_PERM);
|
||||
|
||||
if (target_ci->bi && target_ci->c->FindUser(target_ci->bi) == NULL)
|
||||
target_ci->bi->Join(target_ci->c, &Config->BotModeList);
|
||||
target_ci->bi->Join(target_ci->c, &ModeManager::DefaultBotModes);
|
||||
}
|
||||
|
||||
if (target_ci->c && !target_ci->c->topic.empty())
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
newaccess->creator = taccess->creator;
|
||||
newaccess->last_seen = taccess->last_seen;
|
||||
newaccess->created = taccess->created;
|
||||
newaccess->Unserialize(taccess->Serialize());
|
||||
newaccess->AccessUnserialize(taccess->AccessSerialize());
|
||||
|
||||
target_ci->AddAccess(newaccess);
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ class CommandCSDrop : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); // XXX: READ_ONLY_MODE?
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelInfo *ci = cs_findchan(chan);
|
||||
ChannelInfo *ci = ChannelInfo::Find(chan);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -57,7 +57,7 @@ class CommandCSDrop : public Command
|
||||
FOREACH_MOD(I_OnChanDrop, OnChanDrop(ci));
|
||||
|
||||
Channel *c = ci->c;
|
||||
ci->destroy();
|
||||
ci->Destroy();
|
||||
|
||||
source.Reply(_("Channel \002%s\002 has been dropped."), chan.c_str());
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class CommandCSEnforce : public Command
|
||||
|
||||
Log(LOG_COMMAND, source, this) << "to enforce secureops";
|
||||
|
||||
/* Dirty hack to allow chan_set_correct_modes to work ok.
|
||||
/* Dirty hack to allow Channel::SetCorrectModes to work ok.
|
||||
* We pretend like SECUREOPS is on so it doesn't ignore that
|
||||
* part of the code. This way we can enforce SECUREOPS even
|
||||
* if it's off.
|
||||
@@ -66,7 +66,7 @@ class CommandCSEnforce : public Command
|
||||
{
|
||||
UserContainer *uc = *it;
|
||||
|
||||
chan_set_correct_modes(uc->user, c, 0, false);
|
||||
c->SetCorrectModes(uc->user, false, false);
|
||||
}
|
||||
|
||||
if (hadsecureops)
|
||||
@@ -95,9 +95,8 @@ class CommandCSEnforce : public Command
|
||||
{
|
||||
User *user = users[i];
|
||||
|
||||
Anope::string mask;
|
||||
get_idealban(ci, user, mask);
|
||||
Anope::string reason = translate(user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
Anope::string mask = ci->GetIdealBan(user);
|
||||
Anope::string reason = Language::Translate(user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
c->SetMode(NULL, CMODE_BAN, mask);
|
||||
c->Kick(NULL, user, "%s", reason.c_str());
|
||||
}
|
||||
@@ -106,7 +105,6 @@ class CommandCSEnforce : public Command
|
||||
void DoCModeR(CommandSource &source, Channel *c)
|
||||
{
|
||||
ChannelInfo *ci = c->ci;
|
||||
Anope::string mask;
|
||||
|
||||
if (!ci)
|
||||
return;
|
||||
@@ -127,8 +125,8 @@ class CommandCSEnforce : public Command
|
||||
{
|
||||
User *user = users[i];
|
||||
|
||||
get_idealban(ci, user, mask);
|
||||
Anope::string reason = translate(user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
Anope::string mask = ci->GetIdealBan(user);
|
||||
Anope::string reason = Language::Translate(user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
if (!c->HasMode(CMODE_REGISTEREDONLY))
|
||||
c->SetMode(NULL, CMODE_BAN, mask);
|
||||
c->Kick(NULL, user, "%s", reason.c_str());
|
||||
@@ -145,7 +143,7 @@ class CommandCSEnforce : public Command
|
||||
{
|
||||
const Anope::string &what = params.size() > 1 ? params[1] : "";
|
||||
|
||||
Channel *c = findchan(params[0]);
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
|
||||
if (!c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,7 +66,7 @@ class CSStats : public Module
|
||||
{
|
||||
CommandCSStats commandcsstats;
|
||||
CommandCSGStats commandcsgstats;
|
||||
service_reference<SQLProvider> sql;
|
||||
ServiceReference<SQLProvider> sql;
|
||||
MySQLInterface sqlinterface;
|
||||
Anope::string prefix;
|
||||
public:
|
||||
@@ -86,7 +86,7 @@ class CSStats : public Module
|
||||
ConfigReader config;
|
||||
prefix = config.ReadValue("chanstats", "prefix", "anope_", 0);
|
||||
Anope::string engine = config.ReadValue("chanstats", "engine", "", 0);
|
||||
this->sql = service_reference<SQLProvider>("SQLProvider", engine);
|
||||
this->sql = ServiceReference<SQLProvider>("SQLProvider", engine);
|
||||
}
|
||||
|
||||
SQLResult RunQuery(const SQLQuery &query)
|
||||
@@ -108,7 +108,7 @@ class CSStats : public Module
|
||||
Anope::string display;
|
||||
if (params.empty())
|
||||
display = source.nc->display;
|
||||
else if (const NickAlias *na = findnick(params[0]))
|
||||
else if (const NickAlias *na = NickAlias::Find(params[0]))
|
||||
display = na->nc->display;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ class CSTop : public Module
|
||||
CommandCSGTop commandcsgtop;
|
||||
CommandCSTop10 commandcstop10;
|
||||
CommandCSGTop10 commandcsgtop10;
|
||||
service_reference<SQLProvider> sql;
|
||||
ServiceReference<SQLProvider> sql;
|
||||
MySQLInterface sqlinterface;
|
||||
Anope::string prefix;
|
||||
|
||||
@@ -115,7 +115,7 @@ class CSTop : public Module
|
||||
ConfigReader config;
|
||||
prefix = config.ReadValue("chanstats", "prefix", "anope_", 0);
|
||||
Anope::string engine = config.ReadValue("chanstats", "engine", "", 0);
|
||||
this->sql = service_reference<SQLProvider>("SQLProvider", engine);
|
||||
this->sql = ServiceReference<SQLProvider>("SQLProvider", engine);
|
||||
}
|
||||
|
||||
SQLResult RunQuery(const SQLQuery &query)
|
||||
|
||||
@@ -32,12 +32,12 @@ class FlagsChanAccess : public ChanAccess
|
||||
return false;
|
||||
}
|
||||
|
||||
Anope::string Serialize() const
|
||||
Anope::string AccessSerialize() const
|
||||
{
|
||||
return Anope::string(this->flags.begin(), this->flags.end());
|
||||
}
|
||||
|
||||
void Unserialize(const Anope::string &data) anope_override
|
||||
void AccessUnserialize(const Anope::string &data) anope_override
|
||||
{
|
||||
for (unsigned i = data.length(); i > 0; --i)
|
||||
this->flags.insert(data[i - 1]);
|
||||
@@ -46,7 +46,7 @@ class FlagsChanAccess : public ChanAccess
|
||||
static Anope::string DetermineFlags(const ChanAccess *access)
|
||||
{
|
||||
if (access->provider->name == "access/flags")
|
||||
return access->Serialize();
|
||||
return access->AccessSerialize();
|
||||
|
||||
std::set<char> buffer;
|
||||
|
||||
@@ -86,9 +86,9 @@ class CommandCSFlags : public Command
|
||||
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask))
|
||||
if (mask.find_first_of("!*@") == Anope::string::npos && !NickAlias::Find(mask))
|
||||
{
|
||||
User *targ = finduser(mask);
|
||||
User *targ = User::Find(mask, true);
|
||||
if (targ != NULL)
|
||||
mask = "*!*@" + targ->GetDisplayedHost();
|
||||
else
|
||||
@@ -191,7 +191,7 @@ class CommandCSFlags : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
service_reference<AccessProvider> provider("AccessProvider", "access/flags");
|
||||
ServiceReference<AccessProvider> provider("AccessProvider", "access/flags");
|
||||
if (!provider)
|
||||
return;
|
||||
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
||||
@@ -209,8 +209,8 @@ class CommandCSFlags : public Command
|
||||
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, source, access));
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->Serialize();
|
||||
source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->Serialize().c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->AccessSerialize();
|
||||
source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class CommandCSFlags : public Command
|
||||
|
||||
ListFormatter list;
|
||||
|
||||
list.addColumn("Number").addColumn("Mask").addColumn("Flags").addColumn("Creator").addColumn("Created");
|
||||
list.AddColumn("Number").AddColumn("Mask").AddColumn("Flags").AddColumn("Creator").AddColumn("Created");
|
||||
|
||||
unsigned count = 0;
|
||||
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
|
||||
@@ -257,11 +257,11 @@ class CommandCSFlags : public Command
|
||||
entry["Mask"] = access->mask;
|
||||
entry["Flags"] = FlagsChanAccess::DetermineFlags(access);
|
||||
entry["Creator"] = access->creator;
|
||||
entry["Created"] = do_strftime(access->created, source.nc, true);
|
||||
list.addEntry(entry);
|
||||
entry["Created"] = Anope::strftime(access->created, source.nc, true);
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
|
||||
if (list.isEmpty())
|
||||
if (list.IsEmpty())
|
||||
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
@@ -311,7 +311,7 @@ class CommandCSFlags : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
const Anope::string &cmd = params[1];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(chan);
|
||||
ChannelInfo *ci = ChannelInfo::Find(chan);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
|
||||
@@ -329,7 +329,7 @@ class CommandCSFlags : public Command
|
||||
|
||||
if (!has_access)
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (readonly && !is_list)
|
||||
else if (Anope::ReadOnly && !is_list)
|
||||
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
|
||||
else if (cmd.equals_ci("MODIFY"))
|
||||
this->DoModify(source, ci, params);
|
||||
@@ -374,7 +374,7 @@ class CommandCSFlags : public Command
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(it->second);
|
||||
if (p == NULL)
|
||||
continue;
|
||||
source.Reply(" %c - %s", it->first, translate(source.nc, p->desc.c_str()));
|
||||
source.Reply(" %c - %s", it->first, Language::Translate(source.nc, p->desc.c_str()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -26,7 +26,7 @@ class CommandCSGetKey : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -22,7 +22,7 @@ class CommandCSInfo : public Command
|
||||
if (!buf.empty())
|
||||
buf += ", ";
|
||||
|
||||
buf += translate(nc, str);
|
||||
buf += Language::Translate(nc, str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class CommandCSInfo : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
NickCore *nc = source.nc;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -65,8 +65,8 @@ class CommandCSInfo : public Command
|
||||
if (!ci->desc.empty())
|
||||
info["Description"] = ci->desc;
|
||||
|
||||
info["Registered"] = do_strftime(ci->time_registered);
|
||||
info["Last used"] = do_strftime(ci->last_used);
|
||||
info["Registered"] = Anope::strftime(ci->time_registered);
|
||||
info["Last used"] = Anope::strftime(ci->last_used);
|
||||
|
||||
const ModeLock *secret = ci->GetMLock(CMODE_SECRET);
|
||||
if (!ci->last_topic.empty() && (show_all || ((!secret || secret->set == false) && (!ci->c || !ci->c->HasMode(CMODE_SECRET)))))
|
||||
@@ -103,7 +103,7 @@ class CommandCSInfo : public Command
|
||||
info["Mode lock"] = ml;
|
||||
|
||||
if (!ci->HasFlag(CI_NO_EXPIRE))
|
||||
info["Expires on"] = do_strftime(ci->last_used + Config->CSExpire);
|
||||
info["Expires on"] = Anope::strftime(ci->last_used + Config->CSExpire);
|
||||
}
|
||||
if (ci->HasFlag(CI_SUSPENDED))
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ class CommandCSInvite : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
User *u = source.GetUser();
|
||||
Channel *c = findchan(chan);
|
||||
Channel *c = Channel::Find(chan);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class CommandCSInvite : public Command
|
||||
if (params.size() == 1)
|
||||
u2 = u;
|
||||
else
|
||||
u2 = finduser(params[1]);
|
||||
u2 = User::Find(params[1], true);
|
||||
|
||||
if (!u2)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class CommandCSInvite : public Command
|
||||
{
|
||||
bool override = !source.AccessFor(ci).HasPriv("INVITE");
|
||||
|
||||
ircdproto->SendInvite(ci->WhoSends(), c, u2);
|
||||
IRCD->SendInvite(ci->WhoSends(), c, u2);
|
||||
if (u2 != u)
|
||||
{
|
||||
source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str());
|
||||
|
||||
@@ -30,9 +30,9 @@ class CommandCSKick : public Command
|
||||
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
|
||||
|
||||
User *u = source.GetUser();
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
User *u2 = finduser(target);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
User *u2 = User::Find(target, true);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
|
||||
@@ -33,8 +33,9 @@ class CommandCSList : public Command
|
||||
|
||||
if (pattern[0] == '#')
|
||||
{
|
||||
Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */
|
||||
n2 = myStrGetTokenRemainder(pattern, '-', 1);
|
||||
Anope::string n1, n2;
|
||||
sepstream(pattern.substr(1), '-').GetToken(n1, 0);
|
||||
sepstream(pattern, '-').GetToken(n2, 1);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -72,7 +73,7 @@ class CommandCSList : public Command
|
||||
source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str());
|
||||
|
||||
ListFormatter list;
|
||||
list.addColumn("Name").addColumn("Description");
|
||||
list.AddColumn("Name").AddColumn("Description");
|
||||
|
||||
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
|
||||
{
|
||||
@@ -99,7 +100,7 @@ class CommandCSList : public Command
|
||||
entry["Description"] = "[Suspended]";
|
||||
else
|
||||
entry["Description"] = ci->desc;
|
||||
list.addEntry(entry);
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
+11
-11
@@ -28,7 +28,7 @@ public:
|
||||
{
|
||||
const Anope::string &channel = params[0];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(channel);
|
||||
ChannelInfo *ci = ChannelInfo::Find(channel);
|
||||
if (ci == NULL)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str());
|
||||
else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/set"))
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
else
|
||||
{
|
||||
ListFormatter list;
|
||||
list.addColumn("Number").addColumn("Service").addColumn("Command").addColumn("Method").addColumn("");
|
||||
list.AddColumn("Number").AddColumn("Service").AddColumn("Command").AddColumn("Method").AddColumn("");
|
||||
|
||||
for (unsigned i = 0; i < ci->log_settings->size(); ++i)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
entry["Command"] = log->command_name;
|
||||
entry["Method"] = log->method;
|
||||
entry[""] = log->extra;
|
||||
list.addEntry(entry);
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
|
||||
source.Reply(_("Log list for %s:"), ci->name.c_str());
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
Anope::string service = command.substr(0, sl),
|
||||
command_name = command.substr(sl + 1);
|
||||
BotInfo *bi = findbot(service);
|
||||
BotInfo *bi = BotInfo::Find(service, true);
|
||||
|
||||
if (bi == NULL || bi->commands.count(command_name) == 0)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
service_reference<Command> c_service("Command", bi->commands[command_name].name);
|
||||
ServiceReference<Command> c_service("Command", bi->commands[command_name].name);
|
||||
if (!c_service)
|
||||
{
|
||||
source.Reply(_("%s is not a valid command."), command.c_str());
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
{
|
||||
if (log->extra == extra)
|
||||
{
|
||||
log->destroy();
|
||||
log->Destroy();
|
||||
ci->log_settings->erase(ci->log_settings->begin() + i - 1);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
|
||||
source.Reply(_("Logging for command %s on %s with log method %s%s%s has been removed."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
|
||||
@@ -194,7 +194,7 @@ class CSLog : public Module
|
||||
|
||||
void OnLog(Log *l) anope_override
|
||||
{
|
||||
if (l->Type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced())
|
||||
if (l->type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced())
|
||||
return;
|
||||
|
||||
for (unsigned i = l->ci->log_settings->size(); i > 0; --i)
|
||||
@@ -207,13 +207,13 @@ class CSLog : public Module
|
||||
|
||||
if (log->method.equals_ci("MESSAGE") && l->ci->c && l->ci->bi && l->ci->c->FindUser(l->ci->bi) != NULL)
|
||||
{
|
||||
ircdproto->SendPrivmsg(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str());
|
||||
IRCD->SendPrivmsg(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str());
|
||||
l->ci->bi->lastmsg = Anope::CurTime;
|
||||
}
|
||||
else if (log->method.equals_ci("NOTICE") && l->ci->c && l->ci->bi && l->ci->c->FindUser(l->ci->bi) != NULL)
|
||||
ircdproto->SendNotice(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str());
|
||||
else if (log->method.equals_ci("MEMO") && memoserv && l->ci->WhoSends() != NULL)
|
||||
memoserv->Send(l->ci->WhoSends()->nick, l->ci->name, buffer, true);
|
||||
IRCD->SendNotice(l->ci->bi, log->extra + l->ci->c->name, "%s", buffer.c_str());
|
||||
else if (log->method.equals_ci("MEMO") && MemoServService && l->ci->WhoSends() != NULL)
|
||||
MemoServService->Send(l->ci->WhoSends()->nick, l->ci->name, buffer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,8 @@ class CommandModeBase : public Command
|
||||
void do_mode(CommandSource &source, Command *com, ChannelMode *cm, const Anope::string &chan, const Anope::string &nick, bool set, const Anope::string &level, const Anope::string &levelself)
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
User *u2 = finduser(nick);
|
||||
Channel *c = findchan(chan);
|
||||
User *u2 = User::Find(nick, true);
|
||||
Channel *c = Channel::Find(chan);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
|
||||
@@ -29,10 +29,10 @@ class CommandCSRegister : public Command
|
||||
|
||||
User *u = source.GetUser();
|
||||
NickCore *nc = source.nc;
|
||||
Channel *c = findchan(params[0]);
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
source.Reply(_("Sorry, channel registration is temporarily disabled."));
|
||||
else if (nc->HasFlag(NI_UNCONFIRMED))
|
||||
source.Reply(_("You must confirm your account before you can register a channel."));
|
||||
@@ -40,7 +40,7 @@ class CommandCSRegister : public Command
|
||||
source.Reply(_("Local channels cannot be registered."));
|
||||
else if (chan[0] != '#')
|
||||
source.Reply(CHAN_SYMBOL_REQUIRED);
|
||||
else if (!ircdproto->IsChannelValid(chan))
|
||||
else if (!IRCD->IsChannelValid(chan))
|
||||
source.Reply(CHAN_X_INVALID, chan.c_str());
|
||||
else if (ci)
|
||||
source.Reply(_("Channel \002%s\002 is already registered!"), chan.c_str());
|
||||
@@ -55,7 +55,7 @@ class CommandCSRegister : public Command
|
||||
if (!chdesc.empty())
|
||||
ci->desc = chdesc;
|
||||
|
||||
for (ChannelInfo::ModeList::iterator it = def_mode_locks.begin(), it_end = def_mode_locks.end(); it != it_end; ++it)
|
||||
for (ChannelInfo::ModeList::iterator it = ModeManager::DefaultModeLocks.begin(), it_end = ModeManager::DefaultModeLocks.end(); it != it_end; ++it)
|
||||
{
|
||||
ModeLock *ml = new ModeLock(*it->second);
|
||||
ml->setter = source.GetNick();
|
||||
|
||||
@@ -43,7 +43,7 @@ class CommandCSSASet : public Command
|
||||
const CommandInfo &info = it->second;
|
||||
if (c_name.find_ci(this_name + " ") == 0)
|
||||
{
|
||||
service_reference<Command> command("Command", info.name);
|
||||
ServiceReference<Command> command("Command", info.name);
|
||||
if (command)
|
||||
{
|
||||
source.command = it->first;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSASetNoexpire : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ class CommandCSSet : public Command
|
||||
const CommandInfo &info = it->second;
|
||||
if (c_name.find_ci(this_name + " ") == 0)
|
||||
{
|
||||
service_reference<Command> command("Command", info.name);
|
||||
ServiceReference<Command> command("Command", info.name);
|
||||
if (command)
|
||||
{
|
||||
source.command = it->first;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetAutoOp : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetBanType : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetChanstats : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (!ci)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetDescription : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetFounder : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -48,7 +48,7 @@ class CommandCSSetFounder : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
const NickAlias *na = findnick(params[1]);
|
||||
const NickAlias *na = NickAlias::Find(params[1]);
|
||||
if (!na)
|
||||
{
|
||||
source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetKeepTopic : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
struct CSMiscData : ExtensibleItem, Serializable
|
||||
{
|
||||
serialize_obj<ChannelInfo> ci;
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
|
||||
@@ -22,7 +22,7 @@ struct CSMiscData : ExtensibleItem, Serializable
|
||||
{
|
||||
}
|
||||
|
||||
Serialize::Data serialize() const anope_override
|
||||
Serialize::Data Serialize() const anope_override
|
||||
{
|
||||
Serialize::Data sdata;
|
||||
|
||||
@@ -33,9 +33,9 @@ struct CSMiscData : ExtensibleItem, Serializable
|
||||
return sdata;
|
||||
}
|
||||
|
||||
static Serializable* unserialize(Serializable *obj, Serialize::Data &data)
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(data["ci"].astr());
|
||||
ChannelInfo *ci = ChannelInfo::Find(data["ci"].astr());
|
||||
if (ci == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -75,7 +75,7 @@ class CommandCSSetMisc : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -108,12 +108,12 @@ class CommandCSSetMisc : public Command
|
||||
|
||||
class CSSetMisc : public Module
|
||||
{
|
||||
SerializeType csmiscdata_type;
|
||||
Serialize::Type csmiscdata_type;
|
||||
CommandCSSetMisc commandcssetmisc;
|
||||
|
||||
public:
|
||||
CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
|
||||
csmiscdata_type("CSMiscData", CSMiscData::unserialize), commandcssetmisc(this)
|
||||
csmiscdata_type("CSMiscData", CSMiscData::Unserialize), commandcssetmisc(this)
|
||||
{
|
||||
this->SetAuthor("Anope");
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetPeace : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetPersist : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -60,21 +60,19 @@ class CommandCSSetPersist : public Command
|
||||
ci->bi->Join(c);
|
||||
}
|
||||
|
||||
/* No botserv bot, no channel mode */
|
||||
/* Give them ChanServ
|
||||
* Yes, this works fine with no Config->s_BotServ
|
||||
/* No botserv bot, no channel mode, give them ChanServ.
|
||||
* Yes, this works fine with no Config->BotServ.
|
||||
*/
|
||||
if (!ci->bi && !cm)
|
||||
{
|
||||
BotInfo *bi = findbot(Config->ChanServ);
|
||||
if (!bi)
|
||||
if (!ChanServ)
|
||||
{
|
||||
source.Reply(_("ChanServ is required to enable persist on this network."));
|
||||
return;
|
||||
}
|
||||
bi->Assign(NULL, ci);
|
||||
if (!ci->c->FindUser(bi))
|
||||
bi->Join(ci->c);
|
||||
ChanServ->Assign(NULL, ci);
|
||||
if (!ci->c->FindUser(ChanServ))
|
||||
ChanServ->Join(ci->c);
|
||||
}
|
||||
|
||||
/* Set the perm mode */
|
||||
@@ -111,14 +109,13 @@ class CommandCSSetPersist : public Command
|
||||
*/
|
||||
if (!cm && Config->BotServ.empty() && ci->bi)
|
||||
{
|
||||
BotInfo *bi = findbot(Config->ChanServ);
|
||||
if (!bi)
|
||||
if (!ChanServ)
|
||||
{
|
||||
source.Reply(_("ChanServ is required to enable persist on this network."));
|
||||
return;
|
||||
}
|
||||
/* Unassign bot */
|
||||
bi->UnAssign(NULL, ci);
|
||||
ChanServ->UnAssign(NULL, ci);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetPrivate : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -23,7 +23,7 @@ class CommandCSSetRestricted : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetSecure : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetSecureFounder : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetSecureOps : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetSignKick : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetSuccessor : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -55,7 +55,7 @@ class CommandCSSetSuccessor : public Command
|
||||
|
||||
if (params.size() > 1)
|
||||
{
|
||||
const NickAlias *na = findnick(params[1]);
|
||||
const NickAlias *na = NickAlias::Find(params[1]);
|
||||
|
||||
if (!na)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSSetTopicLock : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
{
|
||||
const Anope::string &channel = params[0];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(channel);
|
||||
ChannelInfo *ci = ChannelInfo::Find(channel);
|
||||
if (ci == NULL)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str());
|
||||
else if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/access/modify"))
|
||||
@@ -38,20 +38,20 @@ public:
|
||||
nick = params[1];
|
||||
|
||||
AccessGroup ag;
|
||||
User *u = finduser(nick);
|
||||
User *u = User::Find(nick, true);
|
||||
NickAlias *na = NULL;
|
||||
if (u != NULL)
|
||||
ag = ci->AccessFor(u);
|
||||
else
|
||||
{
|
||||
na = findnick(nick);
|
||||
na = NickAlias::Find(nick);
|
||||
if (na != NULL)
|
||||
ag = ci->AccessFor(na->nc);
|
||||
}
|
||||
|
||||
if (ag.SuperAdmin)
|
||||
if (ag.super_admin)
|
||||
source.Reply(_("\2%s\2 is a super administrator."), nick.c_str());
|
||||
else if (ag.Founder)
|
||||
else if (ag.founder)
|
||||
source.Reply(_("\2%s\2 is the channel founder."), nick.c_str());
|
||||
else if (ag.empty())
|
||||
source.Reply(_("\2%s\2 has no access on \2%s\2."), nick.c_str(), ci->name.c_str());
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
{
|
||||
ChanAccess *acc = ag[i];
|
||||
|
||||
source.Reply(_("\2%s\2 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->Serialize().c_str());
|
||||
source.Reply(_("\2%s\2 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->AccessSerialize().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ struct ChanSuspend : ExtensibleItem, Serializable
|
||||
{
|
||||
}
|
||||
|
||||
Serialize::Data serialize() const anope_override
|
||||
Serialize::Data Serialize() const anope_override
|
||||
{
|
||||
Serialize::Data sd;
|
||||
|
||||
@@ -32,9 +32,9 @@ struct ChanSuspend : ExtensibleItem, Serializable
|
||||
return sd;
|
||||
}
|
||||
|
||||
static Serializable* unserialize(Serializable *obj, Serialize::Data &sd)
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &sd)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(sd["chan"].astr());
|
||||
ChannelInfo *ci = ChannelInfo::Find(sd["chan"].astr());
|
||||
if (ci == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -77,7 +77,7 @@ class CommandCSSuspend : public Command
|
||||
expiry.clear();
|
||||
}
|
||||
else
|
||||
expiry_secs = dotime(expiry);
|
||||
expiry_secs = Anope::DoTime(expiry);
|
||||
|
||||
if (Config->ForceForbidReason && reason.empty())
|
||||
{
|
||||
@@ -85,10 +85,10 @@ class CommandCSSuspend : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
|
||||
ChannelInfo *ci = cs_findchan(chan);
|
||||
ChannelInfo *ci = ChannelInfo::Find(chan);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
|
||||
@@ -113,7 +113,7 @@ class CommandCSSuspend : public Command
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < users.size(); ++i)
|
||||
ci->c->Kick(NULL, users[i], "%s", !reason.empty() ? reason.c_str() : translate(users[i], _("This channel has been suspended.")));
|
||||
ci->c->Kick(NULL, users[i], "%s", !reason.empty() ? reason.c_str() : Language::Translate(users[i], _("This channel has been suspended.")));
|
||||
}
|
||||
|
||||
if (expiry_secs > 0)
|
||||
@@ -125,7 +125,7 @@ class CommandCSSuspend : public Command
|
||||
ci->Extend("cs_suspend_expire", cs);
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? do_strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
source.Reply(_("Channel \002%s\002 is now suspended."), ci->name.c_str());
|
||||
|
||||
FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci));
|
||||
@@ -161,10 +161,10 @@ class CommandCSUnSuspend : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
|
||||
if (readonly)
|
||||
if (Anope::ReadOnly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -206,13 +206,13 @@ class CommandCSUnSuspend : public Command
|
||||
|
||||
class CSSuspend : public Module
|
||||
{
|
||||
SerializeType chansuspend_type;
|
||||
Serialize::Type chansuspend_type;
|
||||
CommandCSSuspend commandcssuspend;
|
||||
CommandCSUnSuspend commandcsunsuspend;
|
||||
|
||||
public:
|
||||
CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
|
||||
chansuspend_type("ChanSuspend", ChanSuspend::unserialize), commandcssuspend(this), commandcsunsuspend(this)
|
||||
chansuspend_type("ChanSuspend", ChanSuspend::Unserialize), commandcssuspend(this), commandcsunsuspend(this)
|
||||
{
|
||||
this->SetAuthor("Anope");
|
||||
|
||||
@@ -247,7 +247,7 @@ class CSSuspend : public Module
|
||||
ci->Shrink("suspend_by");
|
||||
ci->Shrink("suspend_reason");
|
||||
|
||||
Log(LOG_NORMAL, "expire", findbot(Config->ChanServ)) << "Expiring suspend for " << ci->name;
|
||||
Log(LOG_NORMAL, "expire", ChanServ) << "Expiring suspend for " << ci->name;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ class CommandCSSync : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
|
||||
if (ci == NULL)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -35,7 +35,7 @@ class CommandCSSync : public Command
|
||||
Log(LOG_COMMAND, source, this, ci);
|
||||
|
||||
for (CUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
|
||||
chan_set_correct_modes((*it)->user, ci->c, 1, false);
|
||||
ci->c->SetCorrectModes((*it)->user, true, false);
|
||||
|
||||
source.Reply(_("All user modes on \002%s\002 have been synced."), ci->name.c_str());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ static Module *me;
|
||||
class TempBan : public CallBack
|
||||
{
|
||||
private:
|
||||
dynamic_reference<Channel> chan;
|
||||
Reference<Channel> chan;
|
||||
Anope::string mask;
|
||||
|
||||
public:
|
||||
@@ -46,7 +46,7 @@ class CommandCSTBan : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Channel *c = findchan(params[0]);
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
|
||||
const Anope::string &nick = params[1];
|
||||
const Anope::string &time = params[2];
|
||||
@@ -58,23 +58,22 @@ class CommandCSTBan : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
|
||||
else if (!source.AccessFor(c->ci).HasPriv("BAN"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!(u2 = finduser(nick)))
|
||||
else if (!(u2 = User::Find(nick, true)))
|
||||
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
|
||||
else if (matches_list(c, u2, CMODE_EXCEPT))
|
||||
else if (c->MatchesList(u2, CMODE_EXCEPT))
|
||||
source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), c->ci->name.c_str());
|
||||
else if (u2->IsProtected())
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
time_t t = dotime(time);
|
||||
Anope::string mask;
|
||||
get_idealban(c->ci, u2, mask);
|
||||
time_t t = Anope::DoTime(time);
|
||||
Anope::string mask = c->ci->GetIdealBan(u2);
|
||||
c->SetMode(NULL, CMODE_BAN, mask);
|
||||
new TempBan(t, c, mask);
|
||||
|
||||
Log(LOG_COMMAND, source, this, c->ci) << "for " << mask << " to expire in " << duration(t);
|
||||
Log(LOG_COMMAND, source, this, c->ci) << "for " << mask << " to expire in " << Anope::Duration(t);
|
||||
|
||||
source.Reply(_("%s banned from %s, will auto-expire in %s."), mask.c_str(), c->name.c_str(), duration(t).c_str());
|
||||
source.Reply(_("%s banned from %s, will auto-expire in %s."), mask.c_str(), c->name.c_str(), Anope::Duration(t).c_str());
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -27,7 +27,7 @@ class CommandCSTopic : public Command
|
||||
const Anope::string &topic = params.size() > 1 ? params[1] : "";
|
||||
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSUnban : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
ChannelInfo *ci = ChannelInfo::Find(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
@@ -45,7 +45,7 @@ class CommandCSUnban : public Command
|
||||
|
||||
User *u2 = source.GetUser();
|
||||
if (params.size() > 1)
|
||||
u2 = finduser(params[1]);
|
||||
u2 = User::Find(params[1], true);
|
||||
|
||||
if (!u2)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ class CommandCSUnban : public Command
|
||||
|
||||
Log(LOG_COMMAND, source, this, ci) << "to unban " << u2->nick;
|
||||
|
||||
common_unban(ci, u2, source.GetUser() == u2);
|
||||
ci->c->Unban(u2, source.GetUser() == u2);
|
||||
if (u2 == source.GetUser())
|
||||
source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str());
|
||||
else
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user