diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-18 22:11:41 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-18 22:11:41 +0000 |
commit | 90c5531101dedb1825bd8192d3b5ea4c810eee06 (patch) | |
tree | 5f82e3283c3db615b54eaba334c1fe08eaa3c011 /src | |
parent | dbcdd42b5b41c8a6c3dbe8081a39eb50008c69e4 (diff) |
Merge in patch by nenolod for CAP CLEAR
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9123 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_cap.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 8a57de0c7..df11f1d32 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -36,7 +36,6 @@ class CommandCAP : public Command { Module* Creator; public: - /* Command 'dalinfo', takes no parameters and needs no special modes */ CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance,"CAP", 0, 1, true), Creator(mod) { this->source = "m_cap.so"; @@ -45,6 +44,7 @@ class CommandCAP : public Command CmdResult Handle (const char* const* parameters, int pcnt, User *user) { irc::string subcommand = parameters[0]; + if (subcommand == "REQ") { CapData Data; @@ -56,6 +56,8 @@ class CommandCAP : public Command user->Extend("CAP_REGHOLD"); Event event((char*) &Data, (Module*)this->Creator, "cap_req"); event.Send(this->ServerInstance); + + user->WriteServ("CAP * ACK :%s", Data.parameter.c_str()); } else if (subcommand == "END") { @@ -64,21 +66,38 @@ class CommandCAP : public Command else if ((subcommand == "LS") || (subcommand == "LIST")) { CapData Data; - user->Extend("CAP_REGHOLD"); + Data.type = subcommand; Data.user = user; Data.creator = this->Creator; Data.parameter.clear(); + user->Extend("CAP_REGHOLD"); Event event((char*) &Data, (Module*)this->Creator, subcommand == "LS" ? "cap_ls" : "cap_list"); event.Send(this->ServerInstance); user->WriteServ("CAP * LS :%s", Data.parameter.c_str()); } + else if (subcommand == "CLEAR") + { + CapData Data; + + Data.type = subcommand; + Data.user = user; + Data.creator = this->Creator; + Data.parameter.clear(); + + user->Extend("CAP_REGHOLD"); + Event event((char*) &Data, (Module*)this->Creator, "cap_clear"); + event.Send(this->ServerInstance); + + user->WriteServ("CAP * ACK :%s", Data.parameter.c_str()); + } else { - user->WriteServ("410 %s %s :Invalid CAP subcommand", user->nick, subcommand.c_str()); + user->WriteServ("410 * %s :Invalid CAP subcommand", subcommand.c_str()); } + return CMD_FAILURE; } }; |