ircchanneladapter.h
1 //------------------------------------------------------------------------------
2 // ircchanneladapter.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program 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
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; 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 <QStringList>
27 #include "irc/ircchatadapter.h"
28 
29 class IRCUserInfo;
30 class IRCUserList;
31 
36 {
37  Q_OBJECT
38 
39  public:
40  IRCChannelAdapter(IRCNetworkAdapter* pNetwork, const QString& recipient);
42 
43  AdapterType adapterType() const { return ChannelAdapter; }
44 
48  bool amIOperator() const;
49 
56  void appendNameToCachedList(const QString& name);
57 
62  void appendNamesToCachedList(const QStringList& names);
63 
73  void banUser(const QString& nickname, const QString& reason);
74 
80  void emitChatMessage(const QString& sender, const QString& content);
81 
82  bool hasUser(const QString& nickname);
83 
87  bool isOperator(const QString& nickname) const;
88 
98  void kickUser(const QString& nickname, const QString& reason);
99 
100 
106  void removeNameFromCachedList(const QString& name);
107 
111  void setHalfOp(const QString& nickname, bool bSet);
112 
118  void setOp(const QString& nickname, bool bSet);
119 
125  void setVoiced(const QString& nickname, bool bSet);
126 
131  void userChangesNickname(const QString& oldNickname, const QString& newNickname);
132  void userJoins(const QString& nickname, const QString& fullSignature);
133  void userLeaves(const QString& nickname, const QString& farewellMessage, IRCQuitType quitType);
134 
139  void userModeChanges(const QString& nickname, const QList<char> &addedFlags, const QList<char> &removedFlags);
140 
141  signals:
147  void myNicknameUsed();
148  void nameAdded(const IRCUserInfo& userInfo);
149  void nameListUpdated(const IRCUserList& names);
150  void nameRemoved(const IRCUserInfo& userInfo);
151  void nameUpdated(const IRCUserInfo& userInfo);
152 
153  private:
154  IRCUserList* users;
155 
164  bool addName(const QString& name);
165 };
166 
167 #endif
Interprets communication between the client and the IRC server.
Allows to perform operation on a list of users.
Definition: ircuserlist.h:42
void emitCachedNameListUpdated()
Emits cached list of names. This should be called when end of names list message is received for this...
Class type that is used for conversations within a channel.
void userJoins(const QString &nickname, const QString &fullSignature)
Use this to register the fact that user has joined the chat.
void myNicknameUsed()
Emitted when nickname is used in a message.
void userModeChanges(const QString &nickname, const QList< char > &addedFlags, const QList< char > &removedFlags)
void kickUser(const QString &nickname, const QString &reason)
Kicks user from the channel.
void removeNameFromCachedList(const QString &name)
Removes a name from the sortecd cachedNames list.
void setHalfOp(const QString &nickname, bool bSet)
Sets half op mode for given user.
void appendNamesToCachedList(const QStringList &names)
Appends a list of names to cachedNames list. This ensures that no duplicate names are found on the li...
bool amIOperator() const
Checks if this client is an operator on this channel.
Handles chatting through IRC.
void banUser(const QString &nickname, const QString &reason)
Bans and kicks user from the channel.
void userLeaves(const QString &nickname, const QString &farewellMessage, IRCQuitType quitType)
Use this to register the fact that user has left the chat.
void userChangesNickname(const QString &oldNickname, const QString &newNickname)
void setVoiced(const QString &nickname, bool bSet)
Sets voice mode for given user.
AdapterType
Defines all possible types of IRC adapters.
Holds information flags about given nickname.
Definition: ircuserinfo.h:35
void setOp(const QString &nickname, bool bSet)
Sets op mode for given user.
bool isOperator(const QString &nickname) const
Checks if user is an operator on this channel.
void emitChatMessage(const QString &sender, const QString &content)
Emits message() signal formatting it to present sender's message.
AdapterType adapterType() const
Gets adapter type for this adapter instance.
void appendNameToCachedList(const QString &name)
Appends a single name to the sorted cachedNames list.