summaryrefslogtreecommitdiff
path: root/src/modules/m_cap.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-08 23:29:21 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-08 23:29:21 +0000
commit7e843c22e16c81054bad18073d24fe1a07026431 (patch)
tree44ca0213c7d7a80270b993fec1fbed275ec56424 /src/modules/m_cap.h
parentc440038736f749a56dbac1badee5b2f099286117 (diff)
Update Event and Request APIs
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11808 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cap.h')
-rw-r--r--src/modules/m_cap.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/modules/m_cap.h b/src/modules/m_cap.h
index a37580126..809b0f4cf 100644
--- a/src/modules/m_cap.h
+++ b/src/modules/m_cap.h
@@ -17,7 +17,7 @@
#include <map>
#include <string>
-class CapData : public classbase
+class CapEvent : public Event
{
public:
irc::string type;
@@ -25,6 +25,7 @@ class CapData : public classbase
std::vector<std::string> ack;
User* user;
Module* creator;
+ CapEvent(Module* sender, const std::string& t) : Event(sender, t) {}
};
class GenericCap
@@ -37,12 +38,11 @@ class GenericCap
Extensible::Register(&ext);
}
- void HandleEvent(Event* ev)
+ void HandleEvent(Event& ev)
{
- if (ev->GetEventID() == "cap_req")
+ CapEvent *data = static_cast<CapEvent*>(&ev);
+ if (ev.id == "cap_req")
{
- CapData *data = (CapData *) ev->GetData();
-
std::vector<std::string>::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);
}