X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cap.h;h=d2d094c85f39429f36343ef7e9c87dcf1c5e4051;hb=04cfaea87edd1b4b742cb607ea69ece760c460aa;hp=a375801264218bf345543b95c8fa1979d5ff77ff;hpb=91df762e93212958db487d8517addba1a63a4ddd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cap.h b/src/modules/m_cap.h index a37580126..d2d094c85 100644 --- a/src/modules/m_cap.h +++ b/src/modules/m_cap.h @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * InspIRCd: (C) 2002-2010 InspIRCd Development Team * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see @@ -17,7 +17,7 @@ #include #include -class CapData : public classbase +class CapEvent : public Event { public: irc::string type; @@ -25,6 +25,7 @@ class CapData : public classbase std::vector ack; User* user; Module* creator; + CapEvent(Module* sender, const std::string& t) : Event(sender, t) {} }; class GenericCap @@ -34,15 +35,14 @@ class GenericCap const std::string cap; GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap) { - Extensible::Register(&ext); + ServerInstance->Extensions.Register(&ext); } - void HandleEvent(Event* ev) + void HandleEvent(Event& ev) { - if (ev->GetEventID() == "cap_req") + CapEvent *data = static_cast(&ev); + if (ev.id == "cap_req") { - CapData *data = (CapData *) ev->GetData(); - std::vector::iterator it; if ((it = std::find(data->wanted.begin(), data->wanted.end(), cap)) != data->wanted.end()) { @@ -53,23 +53,19 @@ class GenericCap } } - if (ev->GetEventID() == "cap_ls") + if (ev.id == "cap_ls") { - CapData *data = (CapData *) ev->GetData(); data->wanted.push_back(cap); } - if (ev->GetEventID() == "cap_list") + if (ev.id == "cap_list") { - CapData *data = (CapData *) ev->GetData(); - if (ext.get(data->user)) data->wanted.push_back(cap); } - if (ev->GetEventID() == "cap_clear") + if (ev.id == "cap_clear") { - CapData *data = (CapData *) ev->GetData(); data->ack.push_back("-" + cap); ext.set(data->user, 0); }