summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-01-21 18:44:08 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-01-21 18:44:08 +0100
commite244cb2c63b1ac1d85bdbb4691f7b1bd940ae804 (patch)
tree5a69b0efe6c0b7ab88925d3d066271ec40845e23 /src/modules/m_spanningtree
parentfead8af2b767cb5591536a3c98babf6b35194a66 (diff)
parent7dd831383f7506e49f568d0684ee1ecb1f5dc90f (diff)
Merge insp20
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp12
-rw-r--r--src/modules/m_spanningtree/main.h5
-rw-r--r--src/modules/m_spanningtree/svsnick.cpp16
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
4 files changed, 27 insertions, 8 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 9a7cddec3..671e10269 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -38,6 +38,7 @@
ModuleSpanningTree::ModuleSpanningTree()
: rconnect(this), rsquit(this), map(this)
, commands(NULL), DNS(this, "DNS")
+ , KeepNickTS(false)
{
}
@@ -246,7 +247,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
{
bool ipvalid = true;
- if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name)))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
{
ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
return;
@@ -377,9 +378,9 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& para
for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++)
{
Link* x = *i;
- if (InspIRCd::Match(x->Name.c_str(),parameters[0]))
+ if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map))
{
- if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name)))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
{
RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str());
return MOD_RES_DENY;
@@ -529,7 +530,7 @@ void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos)
if (user->registered != REG_ALL || !IS_LOCAL(user))
return;
- CmdBuilder(user, "FNAME").push(gecos).Broadcast();
+ CmdBuilder(user, "FNAME").push_last(gecos).Broadcast();
}
void ModuleSpanningTree::OnChangeIdent(User* user, const std::string &ident)
@@ -587,11 +588,12 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick)
/** IMPORTANT: We don't update the TS if the oldnick is just a case change of the newnick!
*/
- if (irc::string(user->nick.c_str()) != assign(oldnick))
+ if ((irc::string(user->nick.c_str()) != assign(oldnick)) && (!this->KeepNickTS))
user->age = ServerInstance->Time();
params.push_back(ConvToStr(user->age));
params.Broadcast();
+ this->KeepNickTS = false;
}
else if (!loopCall && user->nick == user->uuid)
{
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 513e86a2f..12667aebf 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -77,6 +77,11 @@ class ModuleSpanningTree : public Module
*/
bool SplitInProgress;
+ /** If true OnUserPostNick() won't update the nick TS before sending the NICK,
+ * used when handling SVSNICK.
+ */
+ bool KeepNickTS;
+
/** Constructor
*/
ModuleSpanningTree();
diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp
index a504afbd7..b3480eb55 100644
--- a/src/modules/m_spanningtree/svsnick.cpp
+++ b/src/modules/m_spanningtree/svsnick.cpp
@@ -20,6 +20,7 @@
#include "inspircd.h"
+#include "main.h"
#include "commands.h"
CmdResult CommandSVSNick::Handle(User* user, std::vector<std::string>& parameters)
@@ -32,17 +33,28 @@ CmdResult CommandSVSNick::Handle(User* user, std::vector<std::string>& parameter
if (isdigit(nick[0]))
nick = u->uuid;
+ // Don't update the TS if the nick is exactly the same
+ if (u->nick == nick)
+ return CMD_FAILURE;
+
+ time_t NickTS = ConvToInt(parameters[2]);
+ if (NickTS <= 0)
+ return CMD_FAILURE;
+
+ ModuleSpanningTree* st = (ModuleSpanningTree*)(Module*)creator;
+ st->KeepNickTS = true;
+ u->age = NickTS;
+
if (!u->ForceNickChange(nick))
{
/* buh. UID them */
if (!u->ForceNickChange(u->uuid))
{
ServerInstance->Users->QuitUser(u, "Nickname collision");
- return CMD_SUCCESS;
}
}
- u->age = ConvToInt(parameters[2]);
+ st->KeepNickTS = false;
}
return CMD_SUCCESS;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index fd51fb6b4..de96b073d 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -363,7 +363,7 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name)
for (std::vector<reference<Link> >::iterator i = LinkBlocks.begin(); i != LinkBlocks.end(); ++i)
{
Link* x = *i;
- if (InspIRCd::Match(x->Name.c_str(), name.c_str()))
+ if (InspIRCd::Match(x->Name.c_str(), name.c_str(), rfc_case_insensitive_map))
{
return x;
}