InspIRCd  3.0
membership.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2012-2014 Attila Molnar <[email protected]>
5  * Copyright (C) 2009 Daniel De Graaf <[email protected]>
6  *
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.
10  *
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
14  * details.
15  *
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/>.
18  */
19 
20 
21 #pragma once
22 
23 uint64_t ConvToUInt64(const std::string& in);
24 
32 class CoreExport Membership : public Extensible, public insp::intrusive_list_node<Membership>
33 {
34  public:
37  typedef uint64_t Id;
38 
41  User* const user;
42 
45  Channel* const chan;
46 
50  std::string modes;
51 
55  Id id;
56 
61  static Id IdFromString(const std::string& str)
62  {
63  return ConvToUInt64(str);
64  }
65 
71  Membership(User* u, Channel* c) : user(u), chan(c) {}
72 
77  bool HasMode(const PrefixMode* pm) const
78  {
79  return (modes.find(pm->GetModeChar()) != std::string::npos);
80  }
81 
87  unsigned int getRank();
88 
97  bool SetPrefix(PrefixMode* mh, bool adding);
98 
106  char GetPrefixChar() const;
107 
113  std::string GetAllPrefixChars() const;
114 };
Definition: intrusive_list.h:33
Definition: extensible.h:90
Membership(User *u, Channel *c)
Definition: membership.h:71
Definition: users.h:224
Id id
Definition: membership.h:55
Definition: membership.h:32
static Id IdFromString(const std::string &str)
Definition: membership.h:61
User *const user
Definition: membership.h:41
Channel *const chan
Definition: membership.h:45
uint64_t Id
Definition: membership.h:37
bool HasMode(const PrefixMode *pm) const
Definition: membership.h:77
Definition: mode.h:342
std::string modes
Definition: membership.h:50
char GetModeChar() const
Definition: mode.h:235
Definition: channels.h:37