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