X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cap.h;h=809b0f4cf2eb3062f6537b9351a1ca3d124d1d64;hb=26cd5393c9308fabe73c41870f06f73a5b001cd7;hp=72c7a14a5b6b35bd4a30b8685bb1d27ed29cabdd;hpb=6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cap.h b/src/modules/m_cap.h index 72c7a14a5..809b0f4cf 100644 --- a/src/modules/m_cap.h +++ b/src/modules/m_cap.h @@ -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 @@ -32,17 +33,16 @@ class GenericCap public: LocalIntExt ext; const std::string cap; - GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + cap, parent), cap(Cap) + GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap) { Extensible::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); }