2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2012-2014 Attila Molnar <attilamolnar@hush.com>
5 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
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 class CoreExport Membership : public Extensible, public intrusive_list_node<Membership>
28 // mode list, sorted by prefix rank, higest first
30 Membership(User* u, Channel* c) : user(u), chan(c) {}
31 inline bool hasMode(char m) const
33 return modes.find(m) != std::string::npos;
35 unsigned int getRank();
37 /** Add a prefix character to a user.
38 * Only the core should call this method, usually from
39 * within the mode parser or when the first user joins
40 * the channel (to grant the default privs to them)
41 * @param mh The mode handler of the prefix mode to associate
42 * @param adding True if adding the prefix, false when removing
43 * @return True if a change was made
45 bool SetPrefix(PrefixMode* mh, bool adding);
47 /** Get the highest prefix this user has on the channel
48 * @return A character containing the highest prefix.
49 * If the user has no prefix, 0 is returned. If the user has multiple prefixes,
50 * the highest is returned. If you do not recognise the prefix character you
51 * can get, you can deal with it in a 'proportional' manner compared to known
52 * prefixes, using GetPrefixValue().
54 char GetPrefixChar() const;
56 /** Return all prefix chars this member has.
57 * @return A list of all prefix characters. The prefixes will always
58 * be in rank order, greatest first, as certain IRC clients require
59 * this when multiple prefixes are used names lists.
61 const char* GetAllPrefixChars() const;
68 intrusive_list<Invitation, T> invites;
73 friend class Invitation;
76 class CoreExport Invitation : public intrusive_list_node<Invitation, Channel>, public intrusive_list_node<Invitation, LocalUser>
78 Invitation(Channel* c, LocalUser* u, time_t timeout) : user(u), chan(c), expiry(timeout) {}
81 LocalUser* const user;
86 static void Create(Channel* c, LocalUser* u, time_t timeout);
87 static Invitation* Find(Channel* c, LocalUser* u, bool check_expired = true);
90 typedef intrusive_list<Invitation, LocalUser> InviteList;
93 inline void InviteBase<T>::ClearInvites()
95 for (typename intrusive_list<Invitation, T>::iterator i = invites.begin(); i != invites.end(); )