ircchanneladapter.h
1 //------------------------------------------------------------------------------
2 // ircchanneladapter.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 __IRCCHANNELADAPTER_H__
24 #define __IRCCHANNELADAPTER_H__
25 
26 #include "irc/ircchatadapter.h"
27 #include <QStringList>
28 
29 class IRCUserInfo;
30 class IRCUserList;
31 
36 {
37  Q_OBJECT
38 
39 public:
40  IRCChannelAdapter(IRCNetworkAdapter *pNetwork, const QString &recipient);
41  ~IRCChannelAdapter() override;
42 
43  AdapterType adapterType() const override
44  {
45  return ChannelAdapter;
46  }
47 
51  bool amIOperator() const;
52 
59  void appendNameToCachedList(const QString &name);
60 
65  void appendNamesToCachedList(const QStringList &names);
66 
76  void banUser(const QString &nickname, const QString &reason);
77 
83  void emitChatMessage(const QString &sender, const QString &content) override;
84 
85  bool hasUser(const QString &nickname);
86 
90  bool isOperator(const QString &nickname) const;
91 
101  void kickUser(const QString &nickname, const QString &reason);
102 
103 
109  void removeNameFromCachedList(const QString &name);
110 
114  void setHalfOp(const QString &nickname, bool bSet);
115 
121  void setOp(const QString &nickname, bool bSet);
122 
128  void setVoiced(const QString &nickname, bool bSet);
129 
134  void userChangesNickname(const QString &oldNickname, const QString &newNickname) override;
135  void userJoins(const QString &nickname, const QString &fullSignature) override;
136  void userLeaves(const QString &nickname, const QString &farewellMessage, IRCQuitType quitType) override;
137 
142  void userModeChanges(const QString &nickname, const QList<char> &addedFlags, const QList<char> &removedFlags) override;
143 
144 signals:
150  void myNicknameUsed();
151  void nameAdded(const IRCUserInfo &userInfo);
152  void nameListUpdated(const IRCUserList &names);
153  void nameRemoved(const IRCUserInfo &userInfo);
154  void nameUpdated(const IRCUserInfo &userInfo);
155 
156 private:
157  IRCUserList *users;
158 
167  bool addName(const QString &name);
168 };
169 
170 #endif