summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:52:12 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:52:12 +0000
commitcdf850dcbbd3153bceaed15ee2d3b42f568c9bf3 (patch)
tree090560df0e4be54d6ef2e35f4d39e29547bba717 /src
parentdf0489220c991cfe106c88fbfaa2a14be0682779 (diff)
Add OnChangeIdent and FIDENT support
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11652 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules.cpp1
-rw-r--r--src/modules/m_setident.cpp4
-rw-r--r--src/modules/m_spanningtree/fident.cpp37
-rw-r--r--src/modules/m_spanningtree/main.cpp19
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/treesocket.h3
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
-rw-r--r--src/users.cpp2
8 files changed, 65 insertions, 6 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index bea9cad0f..9632718ee 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -180,6 +180,7 @@ std::string Module::ProtoTranslate(Extensible*) { return "?"; }
void Module::OnWallops(User*, const std::string&) { }
void Module::OnChangeHost(User*, const std::string&) { }
void Module::OnChangeName(User*, const std::string&) { }
+void Module::OnChangeIdent(User*, const std::string&) { }
void Module::OnAddLine(User*, XLine*) { }
void Module::OnDelLine(User*, XLine*) { }
void Module::OnExpireLine(XLine*) { }
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 93099fc74..03d5f69f9 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -49,7 +49,7 @@ class CommandSetident : public Command
user->ChangeIdent(parameters[0].c_str());
ServerInstance->SNO->WriteGlobalSno('a', "%s used SETIDENT to change their ident to '%s'", user->nick.c_str(), user->ident.c_str());
- return CMD_SUCCESS;
+ return CMD_LOCALONLY;
}
};
@@ -70,7 +70,7 @@ class ModuleSetIdent : public Module
virtual Version GetVersion()
{
- return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+ return Version("$Id$", VF_VENDOR, API_VERSION);
}
};
diff --git a/src/modules/m_spanningtree/fident.cpp b/src/modules/m_spanningtree/fident.cpp
new file mode 100644
index 000000000..0744d9bf2
--- /dev/null
+++ b/src/modules/m_spanningtree/fident.cpp
@@ -0,0 +1,37 @@
+/* +------------------------------------+
+ * | Inspire Internet Relay Chat Daemon |
+ * +------------------------------------+
+ *
+ * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ * the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include "inspircd.h"
+#include "xline.h"
+
+#include "treesocket.h"
+#include "treeserver.h"
+#include "utils.h"
+
+/* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
+
+
+bool TreeSocket::ChangeIdent(const std::string &prefix, parameterlist &params)
+{
+ if (params.size() < 1)
+ return true;
+ User* u = this->ServerInstance->FindNick(prefix);
+ if (u)
+ {
+ u->ChangeIdent(params[0].c_str());
+ params[0] = ":" + params[0];
+ Utils->DoOneToAllButSender(prefix,"FIDENT",params,u->server);
+ }
+ return true;
+}
+
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index ed0165c0e..b533f5484 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -49,10 +49,10 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me)
{
I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostLocalTopicChange,
I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
- I_OnChangeLocalUserHost, I_OnChangeName, I_OnUserPart, I_OnUnloadModule, I_OnUserQuit,
- I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash, I_OnOper,
- I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats, I_OnEvent, I_OnSetAway,
- I_OnPostCommand, I_OnUserConnect
+ I_OnChangeLocalUserHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
+ I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash,
+ I_OnOper, I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats, I_OnEvent,
+ I_OnSetAway, I_OnPostCommand, I_OnUserConnect
};
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
@@ -637,6 +637,17 @@ void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos)
Utils->DoOneToMany(user->uuid,"FNAME",params);
}
+void ModuleSpanningTree::OnChangeIdent(User* user, const std::string &ident)
+{
+ // only occurs for local clients
+ if (user->registered != REG_ALL)
+ return;
+
+ parameterlist params;
+ params.push_back(ident);
+ Utils->DoOneToMany(user->uuid,"FIDENT",params);
+}
+
void ModuleSpanningTree::OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent)
{
if (IS_LOCAL(user))
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index a9cba73af..06b66a5cf 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -170,6 +170,7 @@ class ModuleSpanningTree : public Module
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created);
virtual ModResult OnChangeLocalUserHost(User* user, const std::string &newhost);
virtual void OnChangeName(User* user, const std::string &gecos);
+ virtual void OnChangeIdent(User* user, const std::string &ident);
virtual void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
virtual void OnUserPostNick(User* user, const std::string &oldnick);
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 1350950eb..77934bc07 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -344,6 +344,9 @@ class TreeSocket : public BufferedSocket
*/
bool ChangeName(const std::string &prefix, parameterlist &params);
+ /** FIDENT */
+ bool ChangeIdent(const std::string &prefix, parameterlist &params);
+
/** WHOIS
*/
bool Whois(const std::string &prefix, parameterlist &params);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 79ab791d3..b5482e42e 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -407,6 +407,10 @@ bool TreeSocket::ProcessLine(std::string &line)
{
return this->ChangeName(prefix,params);
}
+ else if (command == "FIDENT")
+ {
+ return this->ChangeIdent(prefix,params);
+ }
else if (command == "ADDLINE")
{
return this->AddLine(prefix,params);
diff --git a/src/users.cpp b/src/users.cpp
index 8f67278e8..192b4aace 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1631,6 +1631,8 @@ bool User::ChangeIdent(const char* newident)
if (this->ident == newident)
return true;
+ FOREACH_MOD(I_OnChangeIdent, OnChangeIdent(this,newident));
+
std::string quitstr = ":" + GetFullHost() + " QUIT :Changing ident";
this->ident.assign(newident, 0, ServerInstance->Config->Limits.IdentMax + 1);