summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-22 00:50:33 -0500
committerAdam <Adam@anope.org>2012-11-22 00:50:33 -0500
commitd33a0f75a5c0c584fbb7cc0076da36d494f39494 (patch)
tree7b2274cc833c793c0f5595660cbd4d715de52ffd /src
parent368d469631763e9c8bf399980d0ac7c5b5664d39 (diff)
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each other
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/access.cpp93
-rw-r--r--src/account.cpp80
-rw-r--r--src/actions.cpp70
-rw-r--r--src/base.cpp38
-rw-r--r--src/base64.cpp1
-rw-r--r--src/bin/CMakeLists.txt8
-rw-r--r--src/bots.cpp84
-rw-r--r--src/botserv.cpp116
-rw-r--r--src/channels.cpp671
-rw-r--r--src/chanserv.cpp105
-rw-r--r--src/command.cpp31
-rw-r--r--src/config.cpp146
-rw-r--r--src/configreader.cpp1
-rw-r--r--src/dns.cpp235
-rw-r--r--src/encrypt.cpp10
-rw-r--r--src/hashcomp.cpp36
-rw-r--r--src/init.cpp211
-rw-r--r--src/language.cpp46
-rw-r--r--src/logger.cpp147
-rw-r--r--src/mail.cpp42
-rw-r--r--src/main.cpp313
-rw-r--r--src/memos.cpp (renamed from src/memoserv.cpp)21
-rw-r--r--src/messages.cpp240
-rw-r--r--src/misc.cpp334
-rw-r--r--src/modes.cpp594
-rw-r--r--src/module.cpp54
-rw-r--r--src/modulemanager.cpp26
-rw-r--r--src/modules.cpp28
-rw-r--r--src/nickalias.cpp87
-rw-r--r--src/nickcore.cpp82
-rw-r--r--src/nickserv.cpp157
-rw-r--r--src/operserv.cpp484
-rw-r--r--src/opertype.cpp2
-rw-r--r--src/process.cpp48
-rw-r--r--src/protocol.cpp106
-rw-r--r--src/regchannel.cpp388
-rw-r--r--src/serialize.cpp94
-rw-r--r--src/servers.cpp195
-rw-r--r--src/socket_clients.cpp9
-rw-r--r--src/socket_transport.cpp43
-rw-r--r--src/socketengines/pipeengine_eventfd.cpp2
-rw-r--r--src/sockets.cpp155
-rw-r--r--src/threadengine.cpp45
-rw-r--r--src/timers.cpp48
-rw-r--r--src/tools/CMakeLists.txt8
-rw-r--r--src/tools/anoperc.in (renamed from src/bin/anoperc.in)0
-rw-r--r--src/uplink.cpp204
-rw-r--r--src/users.cpp337
-rw-r--r--src/win32/windows.cpp2
-rw-r--r--src/xline.cpp425
51 files changed, 2815 insertions, 3888 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f1f383397..b9d58f367 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -119,7 +119,6 @@ add_to_cpack_ignored_files("${SERVICES_BINARY}$" TRUE)
configure_file(${Anope_SOURCE_DIR}/include/sysconf.h.cmake ${Anope_BINARY_DIR}/include/sysconf.h)
# Go into the following directories and run their CMakeLists.txt as well
-add_subdirectory(bin)
add_subdirectory(tools)
# Set Anope to be installed to the bin directory
diff --git a/src/access.cpp b/src/access.cpp
index 6b22ba871..863e0d41d 100644
--- a/src/access.cpp
+++ b/src/access.cpp
@@ -7,6 +7,7 @@
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
+ *
*/
#include "service.h"
@@ -24,27 +25,27 @@ bool Privilege::operator==(const Privilege &other) const
return this->name == other.name;
}
-std::vector<Privilege> PrivilegeManager::privs;
+std::vector<Privilege> PrivilegeManager::Privileges;
void PrivilegeManager::AddPrivilege(Privilege p)
{
unsigned i;
- for (i = 0; i < privs.size(); ++i)
+ for (i = 0; i < Privileges.size(); ++i)
{
- Privilege &priv = privs[i];
+ Privilege &priv = Privileges[i];
if (priv.rank > p.rank)
break;
}
- privs.insert(privs.begin() + i, p);
+ Privileges.insert(Privileges.begin() + i, p);
}
void PrivilegeManager::RemovePrivilege(Privilege &p)
{
- std::vector<Privilege>::iterator it = std::find(privs.begin(), privs.end(), p);
- if (it != privs.end())
- privs.erase(it);
+ std::vector<Privilege>::iterator it = std::find(Privileges.begin(), Privileges.end(), p);
+ if (it != Privileges.end())
+ Privileges.erase(it);
for (registered_channel_map::const_iterator cit = RegisteredChannelList->begin(), cit_end = RegisteredChannelList->end(); cit != cit_end; ++cit)
{
@@ -55,39 +56,39 @@ void PrivilegeManager::RemovePrivilege(Privilege &p)
Privilege *PrivilegeManager::FindPrivilege(const Anope::string &name)
{
- for (unsigned i = privs.size(); i > 0; --i)
- if (privs[i - 1].name.equals_ci(name))
- return &privs[i - 1];
+ for (unsigned i = Privileges.size(); i > 0; --i)
+ if (Privileges[i - 1].name.equals_ci(name))
+ return &Privileges[i - 1];
return NULL;
}
std::vector<Privilege> &PrivilegeManager::GetPrivileges()
{
- return privs;
+ return Privileges;
}
void PrivilegeManager::ClearPrivileges()
{
- privs.clear();
+ Privileges.clear();
}
AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service(o, "AccessProvider", n)
{
- providers.push_back(this);
+ Providers.push_back(this);
}
AccessProvider::~AccessProvider()
{
- std::list<AccessProvider *>::iterator it = std::find(providers.begin(), providers.end(), this);
- if (it != providers.end())
- providers.erase(it);
+ std::list<AccessProvider *>::iterator it = std::find(Providers.begin(), Providers.end(), this);
+ if (it != Providers.end())
+ Providers.erase(it);
}
-std::list<AccessProvider *> AccessProvider::providers;
+std::list<AccessProvider *> AccessProvider::Providers;
const std::list<AccessProvider *>& AccessProvider::GetProviders()
{
- return providers;
+ return Providers;
}
ChanAccess::ChanAccess(AccessProvider *p) : Serializable("ChanAccess"), provider(p)
@@ -98,7 +99,7 @@ ChanAccess::~ChanAccess()
{
}
-Serialize::Data ChanAccess::serialize() const
+Serialize::Data ChanAccess::Serialize() const
{
Serialize::Data data;
@@ -106,17 +107,17 @@ Serialize::Data ChanAccess::serialize() const
data["ci"] << this->ci->name;
data["mask"] << this->mask;
data["creator"] << this->creator;
- data["last_seen"].setType(Serialize::DT_INT) << this->last_seen;
- data["created"].setType(Serialize::DT_INT) << this->created;
- data["data"] << this->Serialize();
+ data["last_seen"].SetType(Serialize::DT_INT) << this->last_seen;
+ data["created"].SetType(Serialize::DT_INT) << this->created;
+ data["data"] << this->AccessSerialize();
return data;
}
-Serializable* ChanAccess::unserialize(Serializable *obj, Serialize::Data &data)
+Serializable* ChanAccess::Unserialize(Serializable *obj, Serialize::Data &data)
{
- service_reference<AccessProvider> aprovider("AccessProvider", data["provider"].astr());
- ChannelInfo *ci = cs_findchan(data["ci"].astr());
+ ServiceReference<AccessProvider> aprovider("AccessProvider", data["provider"].astr());
+ ChannelInfo *ci = ChannelInfo::Find(data["ci"].astr());
if (!aprovider || !ci)
return NULL;
@@ -130,7 +131,7 @@ Serializable* ChanAccess::unserialize(Serializable *obj, Serialize::Data &data)
data["creator"] >> access->creator;
data["last_seen"] >> access->last_seen;
data["created"] >> access->created;
- access->Unserialize(data["data"].astr());
+ access->AccessUnserialize(data["data"].astr());
if (!obj)
ci->AddAccess(access);
@@ -145,7 +146,7 @@ bool ChanAccess::Matches(const User *u, const NickCore *nc) const
else if (u && Anope::Match(u->GetDisplayedMask(), this->mask))
return true;
else if (nc)
- for (std::list<serialize_obj<NickAlias> >::const_iterator it = nc->aliases.begin(); it != nc->aliases.end();)
+ for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = nc->aliases.begin(); it != nc->aliases.end();)
{
const NickAlias *na = *it++;
if (na && Anope::Match(na->nick, this->mask))
@@ -234,16 +235,16 @@ AccessGroup::AccessGroup() : std::vector<ChanAccess *>()
{
this->ci = NULL;
this->nc = NULL;
- this->SuperAdmin = this->Founder = false;
+ this->super_admin = this->founder = false;
}
bool AccessGroup::HasPriv(const Anope::string &name) const
{
- if (this->SuperAdmin)
+ if (this->super_admin)
return true;
else if (ci->GetLevel(name) == ACCESS_INVALID)
return false;
- else if (this->Founder)
+ else if (this->founder)
return true;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnGroupCheckPriv, OnGroupCheckPriv(this, name));
@@ -271,13 +272,13 @@ const ChanAccess *AccessGroup::Highest() const
bool AccessGroup::operator>(const AccessGroup &other) const
{
- if (this->SuperAdmin)
+ if (this->super_admin)
return true;
- else if (other.SuperAdmin)
+ else if (other.super_admin)
return false;
- else if (this->Founder && !other.Founder)
+ else if (this->founder && !other.founder)
return true;
- else if (!this->Founder && other.Founder)
+ else if (!this->founder && other.founder)
return false;
const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
for (unsigned i = privs.size(); i > 0; --i)
@@ -298,13 +299,13 @@ bool AccessGroup::operator>(const AccessGroup &other) const
bool AccessGroup::operator<(const AccessGroup &other) const
{
- if (other.SuperAdmin)
+ if (other.super_admin)
return true;
- else if (this->SuperAdmin)
+ else if (this->super_admin)
return false;
- else if (other.Founder && !this->Founder)
+ else if (other.founder && !this->founder)
return true;
- else if (this->Founder && !other.Founder)
+ else if (this->founder && !other.founder)
return false;
const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
for (unsigned i = privs.size(); i > 0; --i)
@@ -325,13 +326,13 @@ bool AccessGroup::operator<(const AccessGroup &other) const
bool AccessGroup::operator>=(const AccessGroup &other) const
{
- if (this->SuperAdmin)
+ if (this->super_admin)
return true;
- else if (other.SuperAdmin)
+ else if (other.super_admin)
return false;
- else if (this->Founder)
+ else if (this->founder)
return true;
- else if (other.Founder)
+ else if (other.founder)
return false;
const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
for (unsigned i = privs.size(); i > 0; --i)
@@ -352,13 +353,13 @@ bool AccessGroup::operator>=(const AccessGroup &other) const
bool AccessGroup::operator<=(const AccessGroup &other) const
{
- if (other.SuperAdmin)
+ if (other.super_admin)
return true;
- else if (this->SuperAdmin)
+ else if (this->super_admin)
return false;
- else if (other.Founder)
+ else if (other.founder)
return true;
- else if (this->Founder)
+ else if (this->founder)
return false;
const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
for (unsigned i = privs.size(); i > 0; --i)
diff --git a/src/account.cpp b/src/account.cpp
new file mode 100644
index 000000000..b7dd5b51b
--- /dev/null
+++ b/src/account.cpp
@@ -0,0 +1,80 @@
+/*
+ *
+ * (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.
+ *
+ */
+
+#include "services.h"
+#include "account.h"
+#include "modules.h"
+#include "users.h"
+#include "protocol.h"
+#include "regchannel.h"
+
+std::set<IdentifyRequest *> IdentifyRequest::Requests;
+
+IdentifyRequest::IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), account(acc), password(pass), dispatched(false), success(false)
+{
+ Requests.insert(this);
+}
+
+IdentifyRequest::~IdentifyRequest()
+{
+ Requests.erase(this);
+}
+
+void IdentifyRequest::Hold(Module *m)
+{
+ holds.insert(m);
+}
+
+void IdentifyRequest::Release(Module *m)
+{
+ holds.erase(m);
+ if (holds.empty() && dispatched)
+ {
+ if (!success)
+ this->OnFail();
+ delete this;
+ }
+}
+
+void IdentifyRequest::Success(Module *m)
+{
+ if (!success)
+ {
+ this->OnSuccess();
+ success = true;
+ }
+}
+
+void IdentifyRequest::Dispatch()
+{
+ if (holds.empty())
+ {
+ if (!success)
+ this->OnFail();
+ delete this;
+ }
+ else
+ dispatched = true;
+}
+
+void IdentifyRequest::ModuleUnload(Module *m)
+{
+ for (std::set<IdentifyRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end;)
+ {
+ IdentifyRequest *ir = *it;
+ ++it;
+
+ ir->Release(m);
+ if (ir->owner == m)
+ delete ir;
+ }
+}
diff --git a/src/actions.cpp b/src/actions.cpp
deleted file mode 100644
index 512a0fa52..000000000
--- a/src/actions.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Various routines to perform simple actions.
- *
- * (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.
- */
-
-#include "services.h"
-#include "users.h"
-#include "config.h"
-#include "regchannel.h"
-#include "channels.h"
-#include "extern.h"
-
-/*************************************************************************/
-
-/**
- * Note a bad password attempt for the given user. If they've used up
- * their limit, toss them off.
- * @param u the User to check
- * @return true if the user was killed, otherwise false
- */
-bool bad_password(User *u)
-{
- if (!u || !Config->BadPassLimit)
- return false;
-
- if (Config->BadPassTimeout > 0 && u->invalid_pw_time > 0 && u->invalid_pw_time < Anope::CurTime - Config->BadPassTimeout)
- u->invalid_pw_count = 0;
- ++u->invalid_pw_count;
- u->invalid_pw_time = Anope::CurTime;
- if (u->invalid_pw_count >= Config->BadPassLimit)
- {
- u->Kill(Config->ServerName, "Too many invalid passwords");
- return true;
- }
-
- return false;
-}
-
-/*************************************************************************/
-
-
-/**
- * Unban the user from a channel
- * @param ci channel info for the channel
- * @param u The user to unban
- * @param full True to match against the users real host and IP
- * @return void
- */
-void common_unban(const ChannelInfo *ci, User *u, bool full)
-{
- if (!u || !ci || !ci->c || !ci->c->HasMode(CMODE_BAN))
- return;
-
- std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> bans = ci->c->GetModeList(CMODE_BAN);
- for (; bans.first != bans.second;)
- {
- Entry ban(CMODE_BAN, bans.first->second);
- ++bans.first;
- if (ban.Matches(u, full))
- ci->c->RemoveMode(NULL, CMODE_BAN, ban.GetMask());
- }
-}
-
-/*************************************************************************/
diff --git a/src/base.cpp b/src/base.cpp
index af2b38fde..5b8d828b6 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -1,20 +1,18 @@
-#include "services.h"
-#include "modules.h"
-#include "oper.h"
-#include "account.h"
-#include "regchannel.h"
-#include "access.h"
-#include "bots.h"
+/*
+ *
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
-std::map<Anope::string, std::map<Anope::string, Service *> > Service::services;
+#include "services.h"
+#include "anope.h"
+#include "service.h"
-void RegisterTypes()
-{
- static SerializeType nc("NickCore", NickCore::unserialize), na("NickAlias", NickAlias::unserialize), bi("BotInfo", BotInfo::unserialize),
- ci("ChannelInfo", ChannelInfo::unserialize), access("ChanAccess", ChanAccess::unserialize), logsetting("LogSetting", LogSetting::unserialize),
- modelock("ModeLock", ModeLock::unserialize), akick("AutoKick", AutoKick::unserialize), badword("BadWord", BadWord::unserialize),
- memo("Memo", Memo::unserialize), xline("XLine", XLine::unserialize);
-}
+std::map<Anope::string, std::map<Anope::string, Service *> > Service::Services;
+std::map<Anope::string, std::map<Anope::string, Anope::string> > Service::Aliases;
Base::Base()
{
@@ -22,19 +20,19 @@ Base::Base()
Base::~Base()
{
- for (std::set<dynamic_reference_base *>::iterator it = this->References.begin(), it_end = this->References.end(); it != it_end; ++it)
+ for (std::set<ReferenceBase *>::iterator it = this->references.begin(), it_end = this->references.end(); it != it_end; ++it)
{
(*it)->Invalidate();
}
}
-void Base::AddReference(dynamic_reference_base *r)
+void Base::AddReference(ReferenceBase *r)
{
- this->References.insert(r);
+ this->references.insert(r);
}
-void Base::DelReference(dynamic_reference_base *r)
+void Base::DelReference(ReferenceBase *r)
{
- this->References.erase(r);
+ this->references.erase(r);
}
diff --git a/src/base64.cpp b/src/base64.cpp
index df4189547..ae026d8ef 100644
--- a/src/base64.cpp
+++ b/src/base64.cpp
@@ -7,6 +7,7 @@
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
+ *
*/
#include "services.h"
diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt
deleted file mode 100644
index d1cdb5d06..000000000
--- a/src/bin/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# If not on Windows, generate anoperc and install it along with mydbgen
-if(NOT WIN32)
- configure_file(${Anope_SOURCE_DIR}/src/bin/anoperc.in ${Anope_BINARY_DIR}/src/bin/anoperc)
- install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anoperc
- DESTINATION ${BIN_DIR}
- )
-
-endif(NOT WIN32)
diff --git a/src/bots.cpp b/src/bots.cpp
index 7bb5ace5d..52753148f 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -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.
+ *
*/
#include "services.h"
@@ -10,17 +12,27 @@
#include "bots.h"
#include "servers.h"
#include "protocol.h"
-#include "oper.h"
+#include "xline.h"
#include "regchannel.h"
#include "channels.h"
#include "config.h"
#include "language.h"
-#include "extern.h"
#include "serialize.h"
-serialize_checker<botinfo_map> BotListByNick("BotInfo"), BotListByUID("BotInfo");
+Serialize::Checker<botinfo_map> BotListByNick("BotInfo"), BotListByUID("BotInfo");
+
+static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "CONF", "" };
+template<> const Anope::string* Flags<BotFlag>::flags_strings = BotFlagString;
+
+static 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", ""
+};
+template<> const Anope::string* Flags<BotServFlag>::flags_strings = BotServFlagStrings;
-BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, "", "", Me, nreal, Anope::CurTime, "", ts6_uid_retrieve()), Flags<BotFlag, BI_END>(BotFlagString), Serializable("BotInfo"), botmodes(bmodes)
+BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &bmodes) : User(nnick, nuser, nhost, "", "", Me, nreal, Anope::CurTime, "", Servers::TS6_UID_Retrieve()), Serializable("BotInfo"), botmodes(bmodes)
{
this->lastmsg = this->created = Anope::CurTime;
this->introduced = false;
@@ -32,13 +44,13 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A
// If we're synchronised with the uplink already, send the bot.
if (Me && Me->IsSynced())
{
- Anope::string tmodes = !this->botmodes.empty() ? ("+" + this->botmodes) : (ircdproto ? ircdproto->DefaultPseudoclientModes : "");
+ Anope::string tmodes = !this->botmodes.empty() ? ("+" + this->botmodes) : (IRCD ? IRCD->DefaultPseudoclientModes : "");
if (!tmodes.empty())
this->SetModesInternal(tmodes.c_str());
XLine x(this->nick, "Reserved for services");
- ircdproto->SendSQLine(NULL, &x);
- ircdproto->SendClientIntroduction(this);
+ IRCD->SendSQLine(NULL, &x);
+ IRCD->SendClientIntroduction(this);
this->introduced = true;
}
}
@@ -48,10 +60,10 @@ BotInfo::~BotInfo()
// If we're synchronised with the uplink already, send the bot.
if (Me && Me->IsSynced())
{
- ircdproto->SendQuit(this, "");
+ IRCD->SendQuit(this, "");
this->introduced = false;
XLine x(this->nick);
- ircdproto->SendSQLineDel(&x);
+ IRCD->SendSQLineDel(&x);
}
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
@@ -70,11 +82,11 @@ BotInfo::~BotInfo()
BotListByUID->erase(this->uid);
}
-Serialize::Data BotInfo::serialize() const
+Serialize::Data BotInfo::Serialize() const
{
Serialize::Data data;
- data["nick"].setMax(64) << this->nick;
+ data["nick"].SetMax(64)/*XXX*/ << this->nick;
data["user"] << this->ident;
data["host"] << this->host;
data["realname"] << this->realname;
@@ -84,12 +96,12 @@ Serialize::Data BotInfo::serialize() const
return data;
}
-Serializable* BotInfo::unserialize(Serializable *obj, Serialize::Data &data)
+Serializable* BotInfo::Unserialize(Serializable *obj, Serialize::Data &data)
{
BotInfo *bi;
if (obj)
bi = anope_dynamic_static_cast<BotInfo *>(obj);
- else if (!(bi = findbot(data["nick"].astr())))
+ else if (!(bi = BotInfo::Find(data["nick"].astr())))
bi = new BotInfo(data["nick"].astr(), data["user"].astr(), data["host"].astr(), data["realname"].astr());
data["created"] >> bi->created;
bi->FromString(data["flags"].astr());
@@ -100,7 +112,7 @@ void BotInfo::GenerateUID()
{
if (!this->uid.empty())
throw CoreException("Bot already has a uid?");
- this->uid = ts6_uid_retrieve();
+ this->uid = Servers::TS6_UID_Retrieve();
(*BotListByUID)[this->uid] = this;
UserListByUID[this->uid] = this;
}
@@ -139,7 +151,7 @@ void BotInfo::Assign(User *u, ChannelInfo *ci)
ci->bi = this;
if (ci->c && ci->c->users.size() >= Config->BSMinUsers)
- this->Join(ci->c, &Config->BotModeList);
+ this->Join(ci->c, &ModeManager::DefaultBotModes);
}
void BotInfo::UnAssign(User *u, ChannelInfo *ci)
@@ -178,7 +190,7 @@ void BotInfo::Join(Channel *c, ChannelStatus *status)
if (c->FindUser(this) != NULL)
return;
- if (Config && ircdproto && Config->BSSmartJoin)
+ if (Config && IRCD && Config->BSSmartJoin)
{
std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> bans = c->GetModeList(CMODE_BAN);
@@ -197,21 +209,21 @@ void BotInfo::Join(Channel *c, ChannelStatus *status)
/* Should we be invited? */
if (c->HasMode(CMODE_INVITE) || (limit && c->users.size() >= limit))
- ircdproto->SendNotice(this, "@" + c->name, "%s invited %s into the channel.", this->nick.c_str(), this->nick.c_str());
+ IRCD->SendNotice(this, "@" + c->name, "%s invited %s into the channel.", this->nick.c_str(), this->nick.c_str());
ModeManager::ProcessModes();
}
c->JoinUser(this);
- if (ircdproto)
- ircdproto->SendJoin(this, c, status);
+ if (IRCD)
+ IRCD->SendJoin(this, c, status);
FOREACH_MOD(I_OnBotJoin, OnBotJoin(c, this));
}
void BotInfo::Join(const Anope::string &chname, ChannelStatus *status)
{
- Channel *c = findchan(chname);
+ Channel *c = Channel::Find(chname);
return this->Join(c ? c : new Channel(chname), status);
}
@@ -220,7 +232,7 @@ void BotInfo::Part(Channel *c, const Anope::string &reason)
if (c->FindUser(this) == NULL)
return;
- ircdproto->SendPa