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 handleMode(const QString &prefix, const QList<QByteArray> ¶ms);
39 void handleNotice(const QString &prefix, const QList<QByteArray> ¶ms);
40 void handlePing(const QString &prefix, const QList<QByteArray> ¶ms);
41 void handlePrivmsg(const QString &prefix, const QList<QByteArray> ¶ms);
42 void handleQuit(const QString &prefix, const QList<QByteArray> ¶ms);
43 void handle324(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_CHANNELMODEIS
44 void handle341(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_INVITING
45 void handle352(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_WHOREPLY
46 void handle353(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_NAMREPLY
47 void handle369(const QString &prefix, const QList<QByteArray> ¶ms); // RPL_ENDOFWHOWAS
48 void handle432(const QString &prefix, const QList<QByteArray> ¶ms); // ERR_ERRONEUSNICKNAME
49 void handle433(const QString &prefix, const QList<QByteArray> ¶ms); // ERR_NICKNAMEINUSE
50 void handle437(const QString &prefix, const QList<QByteArray> ¶ms); // ERR_UNAVAILRESOURCE
52 void defaultHandler(QString cmd, const QString &prefix, const QList<QByteArray> ¶ms);
55 //! Joins after a netsplit
56 /** This slot handles a bulk-join after a netsplit is over
57 * \param channel The channel the users joined
58 * \param users The list of users that joind the channel
59 * \param modes The list of modes the users get set
60 * \param quitMessage The message we received when the netsplit occured
62 void handleNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes, const QString &quitMessage);
64 //! Quits after a netsplit
65 /** This slot handles a bulk-quit after a netsplit occured
66 * \param channel The channel the users quitted
67 * \param users The list of users that got split
68 * \param quitMessage The message we received when the netsplit occured
70 void handleNetsplitQuit(const QString &channel, const QStringList &users, const QString &quitMessage);
73 /** This slot deletes the netsplit object that sent the finished() signal
75 void handleNetsplitFinished();
77 void handleEarlyNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes);
79 //! Destroy any existing netsplits
80 /** This slot deletes all netsplit objects
81 * Used to get rid of existing netsplits on network reconnect
83 void destroyNetsplits();
86 void tryNextNick(const QString &errnick, bool erroneus = false);
87 bool checkParamCount(const QString &methodName, const QList<QByteArray> ¶ms, int minParams);
89 // holds the target for numeric replies or is invalid otherwise
90 inline const QString &target() const { return _target; }
95 // structure to organize netsplits
97 // value: the corresponding netsplit object
98 QHash<QString, Netsplit*> _netsplits;
101 QByteArray decrypt(const QString &target, const QByteArray &message, bool isTopic = false);