summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp9
-rw-r--r--src/config.cpp9
-rw-r--r--src/init.cpp2
-rw-r--r--src/nickserv.cpp2
-rw-r--r--src/servers.cpp8
-rw-r--r--src/users.cpp16
6 files changed, 35 insertions, 11 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index 2ebe4bb58..e94691b05 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -13,7 +13,7 @@
Anope::insensitive_map<BotInfo *> BotListByNick;
Anope::map<BotInfo *> BotListByUID;
-BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal) : User(nnick, nuser, nhost, ts6_uid_retrieve()), Flags<BotFlag, BI_END>(BotFlagString)
+BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const Anope::string &nhost, const Anope::string &nreal, const Anope::string &modes) : User(nnick, nuser, nhost, ts6_uid_retrieve()), Flags<BotFlag, BI_END>(BotFlagString), botmodes(modes)
{
this->realname = nreal;
this->server = Me;
@@ -28,13 +28,14 @@ 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())
{
- ircdproto->SendClientIntroduction(this, ircd->pseudoclient_mode);
+ ircdproto->SendClientIntroduction(this);
XLine x(this->nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
}
- this->SetModeInternal(ModeManager::FindUserModeByName(UMODE_PROTECTED));
- this->SetModeInternal(ModeManager::FindUserModeByName(UMODE_GOD));
+ Anope::string tmodes = !this->botmodes.empty() ? ("+" + this->botmodes) : (ircd ? ircd->pseudoclient_mode : "");
+ if (!tmodes.empty())
+ this->SetModesInternal(tmodes.c_str());
if (Config)
for (unsigned i = 0; i < Config->LogInfos.size(); ++i)
diff --git a/src/config.cpp b/src/config.cpp
index c4d59d6fc..baedb92ba 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -937,6 +937,7 @@ static bool DoServices(ServerConfig *config, const Anope::string &, const Anope:
Anope::string user = values[1].GetValue();
Anope::string host = values[2].GetValue();
Anope::string gecos = values[3].GetValue();
+ Anope::string modes = values[4].GetValue();
ValueItem vi(nick);
if (!ValidateNotEmpty(config, "service", "nick", vi))
@@ -958,7 +959,7 @@ static bool DoServices(ServerConfig *config, const Anope::string &, const Anope:
BotInfo *bi = findbot(nick);
if (bi != NULL)
return true;
- bi = new BotInfo(nick, user, host, gecos);
+ bi = new BotInfo(nick, user, host, gecos, modes);
bi->SetFlag(BI_CONF);
return true;
}
@@ -1257,9 +1258,9 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitOpers, DoOper, DoneOpers},
{"service",
- {"nick", "user", "host", "gecos", ""},
- {"", "", "", "", ""},
- {DT_STRING, DT_STRING, DT_STRING, DT_STRING},
+ {"nick", "user", "host", "gecos", "modes", ""},
+ {"", "", "", "", "", ""},
+ {DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitServices, DoServices, DoneServices},
{"log",
{"target", "source", "logage", "inhabitlogchannel", "admin", "override", "commands", "servers", "channels", "users", "other", "rawio", "debug", ""},
diff --git a/src/init.cpp b/src/init.cpp
index 721b6aa8e..0a218f099 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -27,7 +27,7 @@ void introduce_user(const Anope::string &user)
User *u = finduser(user);
if (u)
{
- ircdproto->SendClientIntroduction(u, ircd->pseudoclient_mode);
+ ircdproto->SendClientIntroduction(u);
BotInfo *bi = findbot(u->nick);
if (bi)
diff --git a/src/nickserv.cpp b/src/nickserv.cpp
index 9825c3ecc..c88eab55f 100644
--- a/src/nickserv.cpp
+++ b/src/nickserv.cpp
@@ -60,7 +60,7 @@ NickServRelease::NickServRelease(NickAlias *na, time_t delay) : User(na->nick, C
NickServReleases.insert(std::make_pair(this->nick, this));
- ircdproto->SendClientIntroduction(this, "+");
+ ircdproto->SendClientIntroduction(this);
}
NickServRelease::~NickServRelease()
diff --git a/src/servers.cpp b/src/servers.cpp
index 2ebf555c7..e63311eef 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -55,6 +55,12 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A
/* Load MLock from the database now that we know what modes exist */
for (registered_channel_map::iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
it->second->LoadMLock();
+ for (botinfo_map::iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ {
+ BotInfo *bi = it->second;
+ Anope::string modes = !bi->botmodes.empty() ? ("+" + bi->botmodes) : ircd->pseudoclient_mode;
+ bi->SetModesInternal(modes.c_str());
+ }
ircdproto->SendBOB();
@@ -71,7 +77,7 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A
{
User *u = it->second;
- ircdproto->SendClientIntroduction(u, ircd->pseudoclient_mode);
+ ircdproto->SendClientIntroduction(u);
BotInfo *bi = findbot(u->nick);
if (bi)
diff --git a/src/users.cpp b/src/users.cpp
index d1b9945b9..9e4b935fc 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -705,6 +705,22 @@ void User::SetModesInternal(const char *umodes, ...)
}
}
+Anope::string User::GetModes() const
+{
+ Anope::string ret;
+
+ for (size_t i = UMODE_BEGIN + 1; i < UMODE_END; ++i)
+ if (this->modes.HasFlag(static_cast<UserModeName>(i)))
+ {
+ UserMode *um = ModeManager::FindUserModeByName(static_cast<UserModeName>(i));
+ if (um == NULL)
+ continue;
+ ret += um->ModeChar;
+ }
+
+ return ret;
+}
+
/** Find the channel container for Channel c that the user is on
* This is preferred over using FindUser in Channel, as there are usually more users in a channel
* than channels a user is in