summaryrefslogtreecommitdiff
path: root/modules/pseudoclients
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-10-27 18:57:37 -0400
committerAdam <Adam@anope.org>2015-10-27 18:58:48 -0400
commit64dac60071fab652745a6e7a06cf6b7bdbbd3625 (patch)
treef8f30161150451672b381f6370a8fdcab654bbb8 /modules/pseudoclients
parent162fdbe5815bbdf187f549fefac94ff476d72e62 (diff)
parent830361e97d03c74e54cb1cf1bbf329dffdeb66f7 (diff)
Merge branch '2.0' into 2.1
Diffstat (limited to 'modules/pseudoclients')
-rw-r--r--modules/pseudoclients/botserv/botserv.cpp6
-rw-r--r--modules/pseudoclients/chanserv/channel.cpp17
-rw-r--r--modules/pseudoclients/chanserv/channel.h4
-rw-r--r--modules/pseudoclients/nickserv/nickserv.cpp44
-rw-r--r--modules/pseudoclients/operserv.cpp8
5 files changed, 68 insertions, 11 deletions
diff --git a/modules/pseudoclients/botserv/botserv.cpp b/modules/pseudoclients/botserv/botserv.cpp
index 0042b6267..0b51691fc 100644
--- a/modules/pseudoclients/botserv/botserv.cpp
+++ b/modules/pseudoclients/botserv/botserv.cpp
@@ -103,7 +103,7 @@ class BotServCore : public Module, public BotServ::BotServService
{
/**
* We let the bot join even if it was an ignored user, as if we don't,
- * and the ignored user doesnt just leave, the bot will never
+ * and the ignored user doesn't just leave, the bot will never
* make it into the channel, leaving the channel botless even for
* legit users - Rob
**/
@@ -121,8 +121,8 @@ class BotServCore : public Module, public BotServ::BotServService
/* Channel is persistent, it shouldn't be deleted and the service bot should stay */
if (c->ci && persist && persist->HasExt(c->ci))
return;
-
- /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly
+
+ /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediately
* We also don't part the bot here either, if necessary we will part it after the sync
*/
if (c->syncing)
diff --git a/modules/pseudoclients/chanserv/channel.cpp b/modules/pseudoclients/chanserv/channel.cpp
index 8b349dc1f..b24edcc0c 100644
--- a/modules/pseudoclients/chanserv/channel.cpp
+++ b/modules/pseudoclients/chanserv/channel.cpp
@@ -194,7 +194,7 @@ ChanServ::ChanAccess *ChannelImpl::GetAccess(unsigned index)
return a.size() > index ? a[index] : nullptr;
}
-ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u)
+ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed)
{
ChanServ::AccessGroup group;
@@ -223,7 +223,8 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u)
if (group.founder || !group.empty())
{
- this->SetLastUsed(Anope::CurTime);
+ if (updateLastUsed)
+ this->SetLastUsed(Anope::CurTime);
for (unsigned i = 0; i < group.size(); ++i)
group[i]->SetLastSeen(Anope::CurTime);
@@ -232,7 +233,7 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u)
return group;
}
-ChanServ::AccessGroup ChannelImpl::AccessFor(NickServ::Account *nc)
+ChanServ::AccessGroup ChannelImpl::AccessFor(NickServ::Account *nc, bool updateLastUsed)
{
ChanServ::AccessGroup group;
@@ -248,7 +249,8 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(NickServ::Account *nc)
}
if (group.founder || !group.empty())
- this->SetLastUsed(Anope::CurTime);
+ if (updateLastUsed)
+ this->SetLastUsed(Anope::CurTime);
/* don't update access last seen here, this isn't the user requesting access */
@@ -362,6 +364,13 @@ void ChannelImpl::SetLevel(const Anope::string &priv, int16_t level)
return;
}
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(priv) : nullptr;
+ if (!p)
+ {
+ Log(LOG_DEBUG) << "Unknown privilege " + priv;
+ return;
+ }
+
ChanServ::Level *l = ChanServ::level.Create();
l->SetChannel(this);
l->SetName(priv);
diff --git a/modules/pseudoclients/chanserv/channel.h b/modules/pseudoclients/chanserv/channel.h
index 18a4be5d6..86e42a8f9 100644
--- a/modules/pseudoclients/chanserv/channel.h
+++ b/modules/pseudoclients/chanserv/channel.h
@@ -50,8 +50,8 @@ class ChannelImpl : public ChanServ::Channel
void SetSuccessor(NickServ::Account *nc) override;
NickServ::Account *GetSuccessor() override;
ChanServ::ChanAccess *GetAccess(unsigned index) /*const*/ override;
- ChanServ::AccessGroup AccessFor(const User *u) override;
- ChanServ::AccessGroup AccessFor(NickServ::Account *nc) override;
+ ChanServ::AccessGroup AccessFor(const User *u, bool = true) override;
+ ChanServ::AccessGroup AccessFor(NickServ::Account *nc, bool = true) override;
unsigned GetAccessCount()/* const*/ override;
unsigned GetDeepAccessCount() const override;
void ClearAccess() override;
diff --git a/modules/pseudoclients/nickserv/nickserv.cpp b/modules/pseudoclients/nickserv/nickserv.cpp
index ee6068ef1..26f1457cc 100644
--- a/modules/pseudoclients/nickserv/nickserv.cpp
+++ b/modules/pseudoclients/nickserv/nickserv.cpp
@@ -20,6 +20,9 @@
#include "accounttype.h"
#include "modetype.h"
+class NickServCollide;
+static std::set<NickServCollide *> collides;
+
/** Timer for colliding nicks to force people off of nicknames
*/
class NickServCollide : public Timer
@@ -32,6 +35,22 @@ class NickServCollide : public Timer
public:
NickServCollide(Module *me, NickServ::NickServService *nss, User *user, NickServ::Nick *nick, time_t delay) : Timer(me, delay), service(nss), u(user), ts(user->timestamp), na(nick)
{
+ collides.insert(this);
+ }
+
+ ~NickServCollide()
+ {
+ collides.erase(this);
+ }
+
+ NickServ::Nick *GetNick()
+ {
+ return na;
+ }
+
+ User *GetUser()
+ {
+ return u;
}
void Tick(time_t t) override
@@ -429,6 +448,16 @@ class NickServCore : public Module, public NickServ::NickServService
"Your privacy is respected; this e-mail won't be given to\n"
"any third-party person."), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str());
}
+
+ for (std::set<NickServCollide *>::iterator it = collides.begin(); it != collides.end(); ++it)
+ {
+ NickServCollide *c = *it;
+ if (c->GetUser() == u && c->GetNick() && c->GetNick()->GetAccount() == u->Account())
+ {
+ delete c;
+ break;
+ }
+ }
}
void OnNickGroup(User *u, NickServ::Nick *target) override
@@ -632,8 +661,23 @@ class NickServCore : public Module, public NickServ::NickServService
++it;
ir->Release(m);
+#if 0
+ ir->holds.erase(m);
+ if (ir->holds.empty() && ir->dispatched)
+ {
+ if (!ir->success)
+ ir->OnFail();
+ delete ir;
+ continue;
+ }
+
if (ir->GetOwner() == m)
+ {
+ if (!ir->success)
+ ir->OnFail();
delete ir;
+ }
+#endif
}
}
};
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index fe187b70c..0a4f1b692 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -139,9 +139,13 @@ class SQLineManager : public XLineManager
if (std::regex_match(c->name.str(), *x->regex))
return x;
}
- else if (Anope::Match(c->name, x->GetMask(), false, true))
+ else
{
- return x;
+ if (x->GetMask().empty() || x->GetMask()[0] != '#')
+ continue;
+
+ if (Anope::Match(c->name, x->GetMask(), false, true))
+ return x;
}
}
return nullptr;