1 /***************************************************************************
2 * Copyright (C) 2005-10 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
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. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef IRCSERVERHANDLER_H
22 #define IRCSERVERHANDLER_H
24 #include "corebasichandler.h"
27 class IrcServerHandler : public CoreBasicHandler {
31 IrcServerHandler(CoreNetwork *parent);
34 void handleServerMsg(QByteArray rawMsg);
37 void handleJoin(const QString &prefix, const QList<QByteArray> ¶ms);
38 void handleKick(const QString &prefix, const QList<QByteArray> ¶ms);
39 void handleMode(const QString &prefix, const QList<QByteArray> ¶ms);
40 void handleNick(const QString &prefix, const QList<QByteArray> ¶ms);
41 void handleNotice(const QString &prefix, const QList<QByteArray> ¶ms);
42 void handlePart(const QString &prefix, const QList<QByteArray> ¶ms);
43 void handlePing(const QString &prefix, const QList<QByteArray> ¶ms);
44 void handlePong(const QString &prefix, const QList<QByteArray> ¶ms);
45 void handlePrivmsg(const QString &prefix, const QList<QByteArray> ¶ms);
46 void handleQuit(const QString &prefix, const QList<QByteArray> ¶ms);
47 void handleTopic(const QString &prefix, const QList<QByteArray> ¶ms);
48 void handleCap(const QString &prefix, const QList<QByteArray> ¶ms); // CAP framework
49 void handleAuthenticate(); // SASL auth - no params
50 void handle001(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WELCOME
51 void handle005(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ISUPPORT
52 void handle221(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_UMODEIS
53 void handle250(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_STATSDLINE
54 void handle265(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_LOCALUSERS
55 void handle266(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_GLOBALUSERS
56 void handle301(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_AWAY
57 void handle305(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_UNAWAY
58 void handle306(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_NOWAWAY
59 void handle307(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISSERVICE
60 void handle310(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_SUSERHOST
61 void handle311(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISUSER
62 void handle312(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISSERVER
63 void handle313(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISOPERATOR
64 void handle314(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOWASUSER
65 void handle315(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ENDOFWHO
66 void handle317(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISIDLE
67 void handle318(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ENDOFWHOIS
68 void handle319(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISCHANNELS
69 void handle320(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOISVIRT (is identified to services)
70 void handle322(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_LIST
71 void handle323(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_LISTEND
72 void handle324(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_CHANNELMODEIS
73 void handle328(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_??? (channel homepage)
74 void handle329(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_??? (channel creation time)
75 void handle331(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_NOTOPIC
76 void handle332(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_TOPIC
77 void handle333(const QString &prefix, const QList<QByteArray> ¶ms); // Topic set by...
78 void handle352(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOREPLY
79 void handle353(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_NAMREPLY
80 void handle369(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ENDOFWHOWAS
81 void handle432(const QString &prefix, const QList<QByteArray> ¶ms); // ERR_ERRONEUSNICKNAME
82 void handle433(const QString &prefix, const QList<QByteArray> ¶ms); // ERR_NICKNAMEINUSE
84 void defaultHandler(QString cmd, const QString &prefix, const QList<QByteArray> ¶ms);
87 //! Joins after a netsplit
88 /** This slot handles a bulk-join after a netsplit is over
89 * \param channel The channel the users joined
90 * \param users The list of users that joind the channel
91 * \param modes The list of modes the users get set
92 * \param quitMessage The message we received when the netsplit occured
94 void handleNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes, const QString &quitMessage);
96 //! Quits after a netsplit
97 /** This slot handles a bulk-quit after a netsplit occured
98 * \param channel The channel the users quitted
99 * \param users The list of users that got split
100 * \param quitMessage The message we received when the netsplit occured
102 void handleNetsplitQuit(const QString &channel, const QStringList &users, const QString &quitMessage);
104 //! Netsplit finished
105 /** This slot deletes the netsplit object that sent the finished() signal
107 void handleNetsplitFinished();
109 void handleEarlyNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes);
111 //! Destroy any existing netsplits
112 /** This slot deletes all netsplit objects
113 * Used to get rid of existing netsplits on network reconnect
115 void destroyNetsplits();
118 void tryNextNick(const QString &errnick, bool erroneus = false);
119 bool checkParamCount(const QString &methodName, const QList<QByteArray> ¶ms, int minParams);
121 // holds the target for numeric replies or is invalid otherwise
122 inline const QString &target() const { return _target; }
127 // structure to organize netsplits
129 // value: the corresponding netsplit object
130 QHash<QString, Netsplit*> _netsplits;