public:
/** A map of Memberships on a channel keyed by User pointers
*/
- typedef std::map<User*, insp::aligned_storage<Membership> > MemberMap;
+ typedef std::map<User*, insp::aligned_storage<Membership> > MemberMap;
private:
/** Set default modes for the channel on creation
void SetMode(ModeHandler* mode, bool value);
/** Returns true if a mode is set on a channel
- * @param mode The mode character you wish to query
- * @return True if the custom mode is set, false if otherwise
- */
+ * @param mode The mode character you wish to query
+ * @return True if the custom mode is set, false if otherwise
+ */
bool IsModeSet(ModeHandler* mode) { return ((mode->GetId() != ModeParser::MODEID_MAX) && (modes[mode->GetId()])); }
bool IsModeSet(ModeHandler& mode) { return IsModeSet(&mode); }
bool IsModeSet(ChanModeReference& mode);
/** Returns the parameter for a custom mode on a channel.
- * @param mode The mode character you wish to query
- *
- * For example if "+L #foo" is set, and you pass this method
- * 'L', it will return '\#foo'. If the mode is not set on the
- * channel, or the mode has no parameters associated with it,
- * it will return an empty string.
- *
- * @return The parameter for this mode is returned, or an empty string
- */
+ * @param mode The mode character you wish to query
+ *
+ * For example if "+L #foo" is set, and you pass this method
+ * 'L', it will return '\#foo'. If the mode is not set on the
+ * channel, or the mode has no parameters associated with it,
+ * it will return an empty string.
+ *
+ * @return The parameter for this mode is returned, or an empty string
+ */
std::string GetModeParameter(ModeHandler* mode);
std::string GetModeParameter(ChanModeReference& mode);
std::string GetModeParameter(ParamModeBase* pm);
: ptr(NULL)
, owned(true)
{
- new(str) std::string(s);
+ new(str) std::string(s);
}
Param(const Param& other)
class CoreExport CommandParser
{
public:
- typedef TR1NS::unordered_map<std::string, Command*, irc::insensitive, irc::StrHashComp> CommandMap;
+ typedef TR1NS::unordered_map<std::string, Command*, irc::insensitive, irc::StrHashComp> CommandMap;
private:
/** Process a command from a user.
class CoreExport ActionBase : public classbase
{
public:
- /** Executes this action. */
+ /** Executes this action. */
virtual void Call() = 0;
};
}
private:
- /** Private send queue. Note that individual strings may be shared.
+ /** Private send queue. Note that individual strings may be shared.
*/
Container data;
* @param hook Next IOHook in the chain, can be NULL
* @param rq Receive queue to put incoming data into
* @return < 0 on error or close, 0 if no new data is ready (but the socket is still connected), > 0 if data was read from
- the socket and put into the recvq
+ * the socket and put into the recvq
*/
int HookChainRead(IOHook* hook, std::string& rq);
class IOHookProvider : public refcountbase, public ServiceProvider
{
- const bool middlehook;
+ const bool middlehook;
public:
enum Type
/** Whether to update the source user's idle time. */
bool update_idle;
- /** The users who are exempted from receiving this message. */
+ /** The users who are exempted from receiving this message. */
CUList exemptions;
/* The original message as sent by the user. */
class CoreExport ModeHandler : public ServiceProvider
{
public:
- typedef size_t Id;
+ typedef size_t Id;
enum Class
{
private:
/** Type of the container that maps mode names to ModeWatchers
*/
- typedef insp::flat_multimap<std::string, ModeWatcher*> ModeWatcherMap;
+ typedef insp::flat_multimap<std::string, ModeWatcher*> ModeWatcherMap;
/** Last item in the ModeType enum
*/
class CallerID::APIBase : public DataProvider
{
public:
- APIBase(Module* parent)
+ APIBase(Module* parent)
: DataProvider(parent, "m_callerid_api")
{
}
/* Use result cache if available */
bool use_cache;
/* Request id */
- RequestId id;
- /* Creator of this request */
+ RequestId id;
+ /* Creator of this request */
Module* const creator;
Request(Manager* mgr, Module* mod, const std::string& addr, QueryType qt, bool usecache = true, unsigned int timeout = 0)
class RegexException : public ModuleException
{
public:
- RegexException(const std::string& regex, const std::string& error)
- : ModuleException("Error in regex '" + regex + "': " + error) { }
+ RegexException(const std::string& regex, const std::string& error)
+ : ModuleException("Error in regex '" + regex + "': " + error) { }
- RegexException(const std::string& regex, const std::string& error, int offset)
- : ModuleException("Error in regex '" + regex + "' at offset " + ConvToStr(offset) + ": " + error) { }
+ RegexException(const std::string& regex, const std::string& error, int offset)
+ : ModuleException("Error in regex '" + regex + "' at offset " + ConvToStr(offset) + ": " + error) { }
};
class SSLClientCert
{
public:
- /**
+ /**
* Get the client certificate from a socket
* @param sock The socket to get the certificate from, the socket does not have to use TLS (SSL)
* @return The TLS (SSL) client certificate information, NULL if the peer is not using TLS (SSL)
class UserCertificateAPIBase : public DataProvider
{
public:
- UserCertificateAPIBase(Module* parent)
+ UserCertificateAPIBase(Module* parent)
: DataProvider(parent, "m_sslinfo_api")
{
}
class CoreExport ParamModeBase : public ModeHandler
{
private:
- virtual void OnUnsetInternal(User* source, Channel* chan) = 0;
+ virtual void OnUnsetInternal(User* source, Channel* chan) = 0;
public:
ParamModeBase(Module* Creator, const std::string& Name, char modeletter, ParamSpec ps)
EntryMap entries;
public:
- /** Retrieves the child elements. */
+ /** Retrieves the child elements. */
const ChildMap& GetChildren() const { return children; }
ChildMap& GetChildren() { return children; }
static DWORD WINAPI Entry(void* parameter);
/** Create a new thread. This takes an already allocated
- * Thread* pointer and initializes it to use this threading
- * engine. On failure, this function may throw a CoreException.
- * @param thread_to_init Pointer to a newly allocated Thread
- * derived object.
- */
+ * Thread* pointer and initializes it to use this threading
+ * engine. On failure, this function may throw a CoreException.
+ * @param thread_to_init Pointer to a newly allocated Thread
+ * derived object.
+ */
void Start(Thread* thread_to_init);
/** Stop a thread gracefully.
REG_USER = 1, /* Has sent USER */
REG_NICK = 2, /* Has sent NICK */
- REG_NICKUSER = 3, /* Bitwise combination of REG_NICK and REG_USER */
- REG_ALL = 7 /* REG_NICKUSER plus next bit along */
+ REG_NICKUSER = 3, /* Bitwise combination of REG_NICK and REG_USER */
+ REG_ALL = 7 /* REG_NICKUSER plus next bit along */
};
enum UserType {
class CoreExport UserIOHandler : public StreamSocket
{
private:
- size_t checked_until;
+ size_t checked_until;
public:
LocalUser* const user;
UserIOHandler(LocalUser* me)
if(j->first != key)
continue;
value = j->second;
- if (!allow_lf && (value.find('\n') != std::string::npos))
+ if (!allow_lf && (value.find('\n') != std::string::npos))
{
ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() +
" contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces.");
ConfigTagList binds = ConfTags("bind");
if (binds.first == binds.second)
- errstr << "Possible configuration error: you have not defined any <bind> blocks." << std::endl
- << "You will need to do this if you want clients to be able to connect!" << std::endl;
+ errstr << "Possible configuration error: you have not defined any <bind> blocks." << std::endl
+ << "You will need to do this if you want clients to be able to connect!" << std::endl;
if (old && valid)
{
const ModuleManager::ModuleMap& mods = ServerInstance->Modules->GetModules();
- for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
+ for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
{
Module* m = i->second;
Version V = m->GetVersion();
class DummySerializer : public ClientProtocol::Serializer
{
- bool Parse(LocalUser* user, const std::string& line, ClientProtocol::ParseOutput& parseoutput) CXX11_OVERRIDE
- {
- return false;
- }
+ bool Parse(LocalUser* user, const std::string& line, ClientProtocol::ParseOutput& parseoutput) CXX11_OVERRIDE
+ {
+ return false;
+ }
ClientProtocol::SerializedMessage Serialize(const ClientProtocol::Message& msg, const ClientProtocol::TagSelection& tagwl) const CXX11_OVERRIDE
{
{
}
- bool Parse(LocalUser* user, const std::string& line, ClientProtocol::ParseOutput& parseoutput) CXX11_OVERRIDE;
+ bool Parse(LocalUser* user, const std::string& line, ClientProtocol::ParseOutput& parseoutput) CXX11_OVERRIDE;
ClientProtocol::SerializedMessage Serialize(const ClientProtocol::Message& msg, const ClientProtocol::TagSelection& tagwl) const CXX11_OVERRIDE;
};
class CoreModStub : public Module
{
private:
- CommandCapab cmdcapab;
+ CommandCapab cmdcapab;
CommandConnect cmdconnect;
CommandLinks cmdlinks;
CommandSquit cmdsquit;
void SendChanList(WhoisContextImpl& whois);
public:
- /** If true then all opers are shown with a generic 'is a server operator' line rather than the oper type. */
+ /** If true then all opers are shown with a generic 'is a server operator' line rather than the oper type. */
bool genericoper;
- /** How to handle private/secret channels in the WHOIS response. */
+ /** How to handle private/secret channels in the WHOIS response. */
SplitWhoisState splitwhois;
*/
return ((str.length() == 3) && isdigit(str[0]) &&
((str[1] >= 'A' && str[1] <= 'Z') || isdigit(str[1])) &&
- ((str[2] >= 'A' && str[2] <= 'Z') || isdigit(str[2])));
+ ((str[2] >= 'A' && str[2] <= 'Z') || isdigit(str[2])));
}
/** A lookup table of values for multiplier characters used by
else if ((pos_of_pling == std::string::npos) && (pos_of_at != std::string::npos))
{
/* Has an @ but no !, its a user@host */
- mask = "*!" + mask;
+ mask = "*!" + mask;
}
else if ((pos_of_pling != std::string::npos) && (pos_of_at == std::string::npos))
{
for (unsigned char mode = 'A'; mode <= 'z'; mode++)
{
ModeHandler* mh = modehandlers[mt][mode-65];
- /* One parameter when adding */
if (mh)
{
+ /* One parameter when adding */
if (mh->NeedsParam(true))
{
PrefixMode* pm = mh->IsPrefixMode();
void Module::OnAddLine(User*, XLine*) { DetachEvent(I_OnAddLine); }
void Module::OnDelLine(User*, XLine*) { DetachEvent(I_OnDelLine); }
void Module::OnExpireLine(XLine*) { DetachEvent(I_OnExpireLine); }
-void Module::OnCleanup(ExtensionItem::ExtensibleType, Extensible*) { }
+void Module::OnCleanup(ExtensionItem::ExtensibleType, Extensible*) { }
ModResult Module::OnChannelPreDelete(Channel*) { DetachEvent(I_OnChannelPreDelete); return MOD_RES_PASSTHRU; }
void Module::OnChannelDelete(Channel*) { DetachEvent(I_OnChannelDelete); }
void Module::OnBuildNeighborList(User*, IncludeChanList&, std::map<User*,bool>&) { DetachEvent(I_OnBuildNeighborList); }
void Module::OnGarbageCollect() { DetachEvent(I_OnGarbageCollect); }
ModResult Module::OnSetConnectClass(LocalUser* user, ConnectClass* myclass) { DetachEvent(I_OnSetConnectClass); return MOD_RES_PASSTHRU; }
-void Module::OnUserMessage(User*, const MessageTarget&, const MessageDetails&) { DetachEvent(I_OnUserMessage); }
+void Module::OnUserMessage(User*, const MessageTarget&, const MessageDetails&) { DetachEvent(I_OnUserMessage); }
ModResult Module::OnNumeric(User*, const Numeric::Numeric&) { DetachEvent(I_OnNumeric); return MOD_RES_PASSTHRU; }
ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { DetachEvent(I_OnAcceptConnection); return MOD_RES_PASSTHRU; }
void Module::OnSetUserIP(LocalUser*) { DetachEvent(I_OnSetUserIP); }
public:
reference<ConfigTag> conf; /* The <database> entry */
std::deque<QueueItem> queue;
- PGconn* sql; /* PgSQL database connection handle */
+ PGconn* sql; /* PgSQL database connection handle */
SQLstatus status; /* PgSQL database connection status */
QueueItem qinprog; /* If there is currently a query in progress */
GnuTLS::Profile profile;
public:
- GnuTLSIOHookProvider(Module* mod, GnuTLS::Profile::Config& config)
+ GnuTLSIOHookProvider(Module* mod, GnuTLS::Profile::Config& config)
: SSLIOHookProvider(mod, config.name)
, profile(config)
{
mbedTLS::Profile profile;
public:
- mbedTLSIOHookProvider(Module* mod, mbedTLS::Profile::Config& config)
+ mbedTLSIOHookProvider(Module* mod, mbedTLS::Profile::Config& config)
: SSLIOHookProvider(mod, config.name)
, profile(config)
{
class callerid_data
{
public:
- typedef insp::flat_set<User*> UserSet;
+ typedef insp::flat_set<User*> UserSet;
typedef std::vector<callerid_data*> CallerIdDataSet;
time_t lastnotify;
CBanFactory() : XLineFactory("CBAN") { }
/** Generate a CBAN
- */
+ */
XLine* Generate(time_t set_time, unsigned long duration, const std::string& source, const std::string& reason, const std::string& xline_specific_mask) CXX11_OVERRIDE
{
return new CBan(set_time, duration, source, reason, xline_specific_mask);
// Channel is banned.
user->WriteNumeric(ERR_BADCHANNEL, cname, InspIRCd::Format("Channel %s is CBANed: %s", cname.c_str(), rl->reason.c_str()));
ServerInstance->SNO->WriteGlobalSno('a', "%s tried to join %s which is CBANed (%s)",
- user->nick.c_str(), cname.c_str(), rl->reason.c_str());
+ user->nick.c_str(), cname.c_str(), rl->reason.c_str());
return MOD_RES_DENY;
}
IRCv3::Batch::Batch batch;
public:
- CommandClones(Module* Creator)
+ CommandClones(Module* Creator)
: SplitCommand(Creator,"CLONES", 1)
, batchmanager(Creator)
, batch("inspircd.org/clones")
void DisplayDCCAllowList(User* user)
{
- // display current DCCALLOW list
+ // display current DCCALLOW list
user->WriteNumeric(RPL_DCCALLOWSTART, "Users on your DCCALLOW list:");
dl = ext.get(user);
class HAProxyHookProvider : public IOHookProvider
{
private:
- UserCertificateAPI sslapi;
+ UserCertificateAPI sslapi;
public:
HAProxyHookProvider(Module* mod)
const Modes::Change& curr = *i;
if (settings.GetRequiredRank(*curr.mh) <= rank)
{
- // No restriction on who can see this mode or there is one but the member's rank is sufficient
+ // No restriction on who can see this mode or there is one but the member's rank is sufficient
if (modechangelist)
modechangelist->push(curr);
{
if (pathsegment == ".")
{
- // Stay at the current level.
+ // Stay at the current level.
continue;
}
HTTPdAPI API;
public:
- ModuleHTTPAccessList()
+ ModuleHTTPAccessList()
: HTTPACLEventListener(this)
, API(this)
{
ClientProtocol::Events::Join extendedjoinmsg;
public:
- const std::string asterisk;
+ const std::string asterisk;
ClientProtocol::EventProvider awayprotoev;
AwayMessage awaymsg;
- Cap::Capability extendedjoincap;
+ Cap::Capability extendedjoincap;
Cap::Capability awaycap;
JoinHook(Module* mod)
class IRCv3::Batch::ManagerImpl : public Manager
{
- typedef std::vector<Batch*> BatchList;
+ typedef std::vector<Batch*> BatchList;
Cap::Capability cap;
ClientProtocol::EventProvider protoevprov;
LocalIntExt batchbits;
- BatchList active_batches;
+ BatchList active_batches;
bool unloading;
bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) CXX11_OVERRIDE
whitelistedcidrs.clear();
requiredattributes.clear();
- base = tag->getString("baserdn");
+ base = tag->getString("baserdn");
attribute = tag->getString("attribute");
killreason = tag->getString("killreason");
vhost = tag->getString("host");
}
private:
- typedef TR1NS::unordered_map<std::string, Entry, irc::insensitive, irc::StrHashComp> NickHash;
+ typedef TR1NS::unordered_map<std::string, Entry, irc::insensitive, irc::StrHashComp> NickHash;
Entry* Find(const std::string& nick)
{
return &extdata->list;
}
- NickHash nicks;
- ExtItem ext;
- WatchedList emptywatchedlist;
+ NickHash nicks;
+ ExtItem ext;
+ WatchedList emptywatchedlist;
};
void IRCv3::Monitor::Manager::ExtItem::FromInternal(Extensible* container, const std::string& value)
static bool Call(const std::string&);
};
- /*,m_reverse_additionalUp[256];*/
static unsigned char m_reverse_additional[256],m_additionalMB[256],m_additionalUtf8[256],m_additionalUtf8range[256],m_additionalUtf8interval[256];
char utf8checkrest(unsigned char * mb, unsigned char cnt)
if (*p == '0')
{
if (p[1] == 'x')
- /* hex with the leading "0x" */
+ /* hex with the leading "0x" */
chartable[i] = symtoi(p + 2, 16);
else
chartable[i] = symtoi(p + 1, 8);
else if (*p == 'x')
{
chartable[i] = symtoi(p + 1, 16);
- }else /* decimal form */
+ }
+ else /* decimal form */
{
chartable[i] = symtoi(p, 10);
}
}
- else /* plain-text char between '' */
+ else /* plain-text char between '' */
{
if (*(p + 1) == '\\')
{
ChanModeReference& nokicksmode;
public:
- unsigned int protectedrank;
+ unsigned int protectedrank;
RemoveBase(Module* Creator, bool& snk, ChanModeReference& nkm, const char* cmdn)
: Command(Creator, cmdn, 2, 3)
{
/* We'll let everyone remove their level and below, eg:
* ops can remove ops, halfops, voices, and those with no mode (no moders actually are set to 1)
- a ulined target will get a higher level than it's possible for a /remover to get..so they're safe.
+ * a ulined target will get a higher level than it's possible for a /remover to get..so they're safe.
* Nobody may remove people with >= protectedrank rank.
*/
unsigned int ulevel = channel->GetPrefixValue(user);
class ChannelSettings
{
public:
- enum RepeatAction
+ enum RepeatAction
{
ACT_KICK,
ACT_BLOCK,
{
switch (this->state)
{
- case SASL_INIT:
+ case SASL_INIT:
this->agent = msg[0];
this->state = SASL_COMM;
/* fall through */
- case SASL_COMM:
+ case SASL_COMM:
if (msg[0] != this->agent)
return this->state;
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
break;
- case SASL_DONE:
+ case SASL_DONE:
break;
- default:
+ default:
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state);
break;
}
switch (this->result)
{
- case SASL_OK:
+ case SASL_OK:
this->user->WriteNumeric(RPL_SASLSUCCESS, "SASL authentication successful");
break;
- case SASL_ABORT:
+ case SASL_ABORT:
this->user->WriteNumeric(ERR_SASLABORTED, "SASL authentication aborted");
break;
- case SASL_FAIL:
+ case SASL_FAIL:
this->user->WriteNumeric(ERR_SASLFAIL, "SASL authentication failed");
break;
- default:
+ default:
break;
}
class CommandAuthenticate : public SplitCommand
{
private:
- // The maximum length of an AUTHENTICATE request.
- static const size_t MAX_AUTHENTICATE_SIZE = 400;
+ // The maximum length of an AUTHENTICATE request.
+ static const size_t MAX_AUTHENTICATE_SIZE = 400;
public:
SimpleExtItem<SaslAuthenticator>& authExt;
class SHA1HashProvider : public HashProvider
{
public:
- SHA1HashProvider(Module* mod)
+ SHA1HashProvider(Module* mod)
: HashProvider(mod, "sha1", 20, 64)
{
}
ShunFactory() : XLineFactory("SHUN") { }
/** Generate a shun
- */
+ */
XLine* Generate(time_t set_time, unsigned long duration, const std::string& source, const std::string& reason, const std::string& xline_specific_mask) CXX11_OVERRIDE
{
return new Shun(set_time, duration, source, reason, xline_specific_mask);
{
if (user->IsOper())
{
- ShowLinks(server, user, hops+1);
+ ShowLinks(server, user, hops+1);
}
}
else
* if ident@ip is equal, and theirs is newer, or
* ident@ip differ, and ours is newer
*/
- if((SamePerson && remotets < localts) ||
- (!SamePerson && remotets > localts))
+ if ((SamePerson && remotets < localts) || (!SamePerson && remotets > localts))
{
// Only remote needs to change
bChangeLocal = false;
}
else
{
- user->WriteNotice("*** SQUIT: The server \002" + parameters[0] + "\002 does not exist on the network.");
+ user->WriteNotice("*** SQUIT: The server \002" + parameters[0] + "\002 does not exist on the network.");
}
return MOD_RES_DENY;
}
* CONNECTING: indicates an outbound socket which is
* waiting to be writeable.
* WAIT_AUTH_1: indicates the socket is outbound and
- * has successfully connected, but has not
+ * has successfully connected, but has not
* yet sent and received SERVER strings.
* WAIT_AUTH_2: indicates that the socket is inbound
- * but has not yet sent and received
+ * but has not yet sent and received
* SERVER strings.
* CONNECTED: represents a fully authorized, fully
* connected server.
CacheRefreshTimer RefreshTimer;
public:
- typedef std::set<TreeSocket*> TreeSocketSet;
+ typedef std::set<TreeSocket*> TreeSocketSet;
typedef std::map<TreeSocket*, std::pair<std::string, unsigned int> > TimeoutList;
/** Creator module
SVSHoldFactory() : XLineFactory("SVSHOLD") { }
/** Generate an SVSHOLD
- */
+ */
XLine* Generate(time_t set_time, unsigned long duration, const std::string& source, const std::string& reason, const std::string& xline_specific_mask) CXX11_OVERRIDE
{
return new SVSHold(set_time, duration, source, reason, xline_specific_mask);
{
/* Load the configuration
* Note:
- * This is on purpose not changed on a rehash. It would be non-trivial to change the database on-the-fly.
- * Imagine a scenario where the new file already exists. Merging the current XLines with the existing database is likely a bad idea
- * ...and so is discarding all current in-memory XLines for the ones in the database.
+ * This is on purpose not changed on a rehash. It would be non-trivial to change the database on-the-fly.
+ * Imagine a scenario where the new file already exists. Merging the current XLines with the existing database is likely a bad idea
+ * ...and so is discarding all current in-memory XLines for the ones in the database.
*/
ConfigTag* Conf = ServerInstance->Config->ConfValue("xlinedb");
xlinedbpath = ServerInstance->Config->Paths.PrependData(Conf->getString("filename", "xline.db", 1));
* xline types may not have a conf tag, so let's just write them.
* In addition, let's use a file version, so we can maintain some
* semblance of backwards compatibility for reading on startup..
- * -- w00t
+ * -- w00t
*/
stream << "VERSION 1" << std::endl;
const time_t current = ServerInstance->Time();
- LookupIter safei;
+ LookupIter safei;
for (LookupIter i = x->second.begin(); i != x->second.end(); )
{
g_ServiceData.argc = argc;
// Note: since this memory is going to stay allocated for the rest of the execution,
- // it doesn't make sense to free it, as it's going to be "freed" on process termination
+ // it doesn't make sense to free it, as it's going to be "freed" on process termination
try {
g_ServiceData.argv = new char*[argc];