1 /* 2 Copyright (C) 2008-2020 The Communi Project 3 4 You may use this file under the terms of BSD license as follows: 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 * Redistributions of source code must retain the above copyright 9 notice, this list of conditions and the following disclaimer. 10 * Redistributions in binary form must reproduce the above copyright 11 notice, this list of conditions and the following disclaimer in the 12 documentation and/or other materials provided with the distribution. 13 * Neither the name of the copyright holder nor the names of its 14 contributors may be used to endorse or promote products derived 15 from this software without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef IRCCHANNEL_P_H 30 #define IRCCHANNEL_P_H 31 32 #include "ircchannel.h" 33 #include "ircnetwork.h" 34 #include "ircbuffer_p.h" 35 #include <qstringlist.h> 36 #include <qlist.h> 37 #include <qmap.h> 38 39 IRC_BEGIN_NAMESPACE 40 41 class IrcChannelPrivate : public IrcBufferPrivate 42 { 43 Q_DECLARE_PUBLIC(IrcChannel) 44 45 public: 46 IrcChannelPrivate(); 47 ~IrcChannelPrivate() override; 48 49 void init(const QString& title, IrcBufferModel* model) override; 50 void connected() override; 51 void disconnected() override; 52 53 void setActive(bool active); 54 55 void changeModes(const QString& value, const QStringList& arguments); 56 void setModes(const QString& value, const QStringList& arguments); 57 void setTopic(const QString& value); 58 void setKey(const QString& value); 59 60 void addUser(const QString& user); 61 bool removeUser(const QString& user); 62 void setUsers(const QStringList& users); 63 bool renameUser(const QString& from, const QString& to); 64 void setUserMode(const QString& user, const QString& mode); 65 void promoteUser(const QString& user); 66 bool setUserAway(const QString &name, bool away); 67 void setUserServOp(const QString &name, bool servOp); 68 69 bool processAwayMessage(IrcAwayMessage* message) override; 70 bool processJoinMessage(IrcJoinMessage* message) override; 71 bool processKickMessage(IrcKickMessage* message) override; 72 bool processModeMessage(IrcModeMessage* message) override; 73 bool processNamesMessage(IrcNamesMessage* message) override; 74 bool processNickMessage(IrcNickMessage* message) override; 75 bool processNoticeMessage(IrcNoticeMessage* message) override; 76 bool processNumericMessage(IrcNumericMessage* message) override; 77 bool processPartMessage(IrcPartMessage* message) override; 78 bool processPrivateMessage(IrcPrivateMessage* message) override; 79 bool processQuitMessage(IrcQuitMessage* message) override; 80 bool processTopicMessage(IrcTopicMessage* message) override; 81 bool processWhoReplyMessage(IrcWhoReplyMessage* message) override; 82 get(IrcChannel * channel)83 static IrcChannelPrivate* get(IrcChannel* channel) 84 { 85 return channel->d_func(); 86 } 87 88 QMap<QString, QString> modes; 89 QString topic; 90 bool active = false; 91 bool enabled = true; 92 QStringList names; 93 QList<IrcUser*> userList; 94 QList<IrcUser*> activeUsers; 95 QMap<QString, IrcUser*> userMap; 96 QList<IrcUserModel*> userModels; 97 }; 98 99 IRC_END_NAMESPACE 100 101 #endif // IRCCHANNEL_P_H 102