ircuserinfo.h
1 //------------------------------------------------------------------------------
2 // ircuserinfo.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __IRCUSERINFO_H__
24 #define __IRCUSERINFO_H__
25 
26 #include <QList>
27 #include <QString>
28 
29 class IRCUserPrefix;
30 class IRCNetworkAdapter;
31 
36 {
37 public:
47  QString fullSignature;
48 
54  IRCUserInfo();
59  IRCUserInfo(const QString &nickname, const IRCNetworkAdapter *parentNetwork,
60  const QString &fullSignature = "");
61 
66  QString cleanNickname() const;
67 
72  QString cleanNicknameLowerCase() const;
73 
74  QString extractHostnameFromFullSignature() const;
75 
82  bool isSameNickname(const IRCUserInfo &otherUser) const;
83  bool isSameNickname(const QString &otherNickname) const;
84 
85  bool isOp() const;
86  bool isValid() const;
87 
88  const QList<char> &modes() const;
89  const IRCNetworkAdapter *network() const;
90 
91  bool operator==(const IRCUserInfo &otherUser) const;
92 
100  bool operator<=(const IRCUserInfo &otherUser) const;
101 
105  QString prefixedName() const;
106 
111  QString prefixedNameLowerCase() const;
112 
113  void setModes(const QList<char> &modes);
114  void setMode(char mode);
115  void setPrefixedNickname(const QString &nickname);
116  void unsetMode(char mode);
117 
118 private:
119  const IRCNetworkAdapter *parentNetwork;
120  QList<char> userModes;
121  QString userName;
122 
123  const IRCUserPrefix &prefixes() const;
124 };
125 
126 #endif