summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-30 09:59:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-30 09:59:44 +0000
commitbc0b595b6b9bc6d9fade71117607314cbf54c8c8 (patch)
tree002d0f486d5d8a97cc04b99f0586c6ccceb0a152 /src
parentce0213e10f1c5125a5d1af906136110cdf08c056 (diff)
Added remote kill
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2035 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp2
-rw-r--r--src/modules.cpp1
-rw-r--r--src/modules/m_alias.cpp7
-rw-r--r--src/modules/m_helpop.cpp2
-rw-r--r--src/modules/m_spanningtree.cpp28
5 files changed, 37 insertions, 3 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index e6896e3a7..321e6bc3c 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -332,6 +332,8 @@ void handle_kill(char **parameters, int pcnt, userrec *user)
WriteOpers("*** Remote kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
snprintf(killreason,MAXBUF,"[%s] Killed (%s (%s))",ServerName,user->nick,parameters[1]);
WriteCommonExcept(u,"QUIT :%s",killreason);
+
+ FOREACH_MOD OnRemoteKill(user,u,killreason);
user_hash::iterator iter = clientlist.find(u->nick);
if (iter != clientlist.end())
diff --git a/src/modules.cpp b/src/modules.cpp
index bb6e92272..eb353334e 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -362,6 +362,7 @@ void Module::OnRawSocketClose(int fd) { };
int Module::OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult) { return 0; };
void Module::OnUserMessage(userrec* user, void* dest, int target_type, std::string text) { };
void Module::OnUserNotice(userrec* user, void* dest, int target_type, std::string text) { };
+void Module::OnRemoteKill(userrec* source, userrec* dest, std::string reason) { };
// server is a wrapper class that provides methods to all of the C-style
// exports in the core
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 837750da8..b3544a960 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -38,8 +38,9 @@ class ModuleAlias : public Module
Server *Srv;
ConfigReader *MyConf;
std::vector<Alias> Aliases;
- public:
- /* XXX - small issue, why is this marked public when it's not (really) intended for external use */
+
+ /* XXX - small issue, why is this marked public when it's not (really) intended for external use
+ * Fixed 30/11/05 by Brain as suggestion by w00t */
virtual void ReadAliases()
{
Aliases.clear();
@@ -59,6 +60,8 @@ class ModuleAlias : public Module
}
}
+
+ public:
ModuleAlias()
{
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 9fd3052b7..ca4b4fed3 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -76,7 +76,7 @@ void handle_helpop(char **parameters, int pcnt, userrec *user)
for (int i = 1; output != ""; i++)
{
snprintf(a,MAXBUF,"line%d",i);
- /* XXX - "nohelpo" ? or "nohelp", as above */
+ /* "nohelpo" for opers "nohelp" for users */
output = helpop->ReadValue("nohelpo", std::string(a), 0);
if (output != "")
{
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index d63c11cbf..0c8f03699 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -669,6 +669,22 @@ class TreeSocket : public InspSocket
return true;
}
+ bool RemoteKill(std::string prefix, std::deque<std::string> params)
+ {
+ if (params.size() != 2)
+ return true;
+ std::string nick = params[0];
+ std::string reason = params[1];
+ userrec* u = Srv->FindNick(prefix);
+ userrec* who = Srv->FindNick(nick);
+ if (who)
+ {
+ DoOneToAllButSender(prefix,"KILL",params,u->server)
+ Srv->QuitUser(who,reason);
+ }
+ return true;
+ }
+
bool RemoteServer(std::string prefix, std::deque<std::string> params)
{
if (params.size() < 4)
@@ -914,6 +930,10 @@ class TreeSocket : public InspSocket
{
return this->ForceMode(prefix,params);
}
+ else if (command == "KILL")
+ {
+ return this->RemoteKill(prefix,params);
+ }
else if (command == "SQUIT")
{
if (params.size() == 2)
@@ -1446,6 +1466,14 @@ class ModuleSpanningTree : public Module
}
}
+ virtual void OnRemoteKill(userrec* source, userrec* dest, std::string reason)
+ {
+ std::deque<std::string> params;
+ params.push_back(dest->nick);
+ params.push_back(":"+reason);
+ DoOneToMany(source->nick,"KILL",params);
+ }
+
// note: the protocol does not allow direct umode +o except
// via NICK with 8 params. sending OPERTYPE infers +o modechange
// locally.