From 90c5531101dedb1825bd8192d3b5ea4c810eee06 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 18 Mar 2008 22:11:41 +0000 Subject: Merge in patch by nenolod for CAP CLEAR git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9123 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cap.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/modules') 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; } }; -- cgit v1.2.3