2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 namespace ClientProtocol
31 struct ClientProtocol::Events::Join : public ClientProtocol::Messages::Join, public ClientProtocol::Event
34 : ClientProtocol::Event(ServerInstance->GetRFCEvents().join, *this)
38 Join(Membership* Memb)
39 : ClientProtocol::Messages::Join(Memb)
40 , ClientProtocol::Event(ServerInstance->GetRFCEvents().join, *this)
44 Join(Membership* Memb, const std::string& Sourcestr)
45 : ClientProtocol::Messages::Join(Memb, Sourcestr)
46 , ClientProtocol::Event(ServerInstance->GetRFCEvents().join, *this)
51 class ClientProtocol::Events::Mode : public ClientProtocol::Event
53 std::list<ClientProtocol::Messages::Mode> modelist;
54 std::vector<Message*> modemsgplist;
55 const Modes::ChangeList& modechanges;
58 static void BuildMessages(User* source, Channel* Chantarget, User* Usertarget, const Modes::ChangeList& changelist, std::list<ClientProtocol::Messages::Mode>& modelist, std::vector<Message*>& modemsgplist)
60 // Build as many MODEs as necessary
61 for (Modes::ChangeList::List::const_iterator i = changelist.getlist().begin(); i != changelist.getlist().end(); i = modelist.back().GetEndIterator())
63 modelist.push_back(ClientProtocol::Messages::Mode(source, Chantarget, Usertarget, changelist, i));
64 modemsgplist.push_back(&modelist.back());
68 Mode(User* source, Channel* Chantarget, User* Usertarget, const Modes::ChangeList& changelist)
69 : ClientProtocol::Event(ServerInstance->GetRFCEvents().mode)
70 , modechanges(changelist)
72 BuildMessages(source, Chantarget, Usertarget, changelist, modelist, modemsgplist);
73 SetMessageList(modemsgplist);
76 const Modes::ChangeList& GetChangeList() const { return modechanges; }
77 const std::list<ClientProtocol::Messages::Mode>& GetMessages() const { return modelist; }