1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 class CapData : public classbase
24 std::vector<std::string> wanted;
25 std::vector<std::string> ack;
30 void GenericCapHandler(Event* ev, const std::string &extname, const std::string &cap)
32 if (ev->GetEventID() == "cap_req")
34 CapData *data = (CapData *) ev->GetData();
36 std::vector<std::string>::iterator it;
37 if ((it = std::find(data->wanted.begin(), data->wanted.end(), cap)) != data->wanted.end())
39 // we can handle this, so ACK it, and remove it from the wanted list
40 data->ack.push_back(*it);
41 data->wanted.erase(it);
42 data->user->Extend(extname);
46 if (ev->GetEventID() == "cap_ls")
48 CapData *data = (CapData *) ev->GetData();
49 data->wanted.push_back(cap);
52 if (ev->GetEventID() == "cap_list")
54 CapData *data = (CapData *) ev->GetData();
56 if (data->user->GetExt(extname))
57 data->wanted.push_back(cap);
60 if (ev->GetEventID() == "cap_clear")
62 CapData *data = (CapData *) ev->GetData();
63 data->ack.push_back("-" + cap);
64 data->user->Shrink(extname);