1 /***************************************************************************
2 * Copyright (C) 2005-2010 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 CORESESSIONEVENTPROCESSOR_H
22 #define CORESESSIONEVENTPROCESSOR_H
24 #include "corenetwork.h"
25 #include "networkevent.h"
29 class IrcEventNumeric;
32 class CoreSessionEventProcessor : public QObject {
36 CoreSessionEventProcessor(CoreSession *session);
38 inline CoreSession *coreSession() const { return _coreSession; }
40 Q_INVOKABLE void processIrcEventNumeric(IrcEventNumeric *event);
42 Q_INVOKABLE void processIrcEventAuthenticate(IrcEvent *event); // SASL auth
43 Q_INVOKABLE void processIrcEventCap(IrcEvent *event); // CAP framework
44 Q_INVOKABLE void processIrcEventInvite(IrcEvent *event);
45 Q_INVOKABLE void processIrcEventJoin(IrcEvent *event);
46 Q_INVOKABLE void processIrcEventKick(IrcEvent *event);
47 Q_INVOKABLE void processIrcEventMode(IrcEvent *event);
48 Q_INVOKABLE void processIrcEventNick(IrcEvent *event);
49 Q_INVOKABLE void processIrcEventPart(IrcEvent *event);
50 Q_INVOKABLE void processIrcEventPong(IrcEvent *event);
51 Q_INVOKABLE void processIrcEventQuit(IrcEvent *event);
52 Q_INVOKABLE void lateProcessIrcEventQuit(IrcEvent *event);
53 Q_INVOKABLE void processIrcEventTopic(IrcEvent *event);
55 Q_INVOKABLE void processIrcEvent001(IrcEvent *event); // RPL_WELCOME
56 Q_INVOKABLE void processIrcEvent005(IrcEvent *event); // RPL_ISUPPORT
57 Q_INVOKABLE void processIrcEvent221(IrcEvent *event); // RPL_UMODEIS
58 Q_INVOKABLE void processIrcEvent250(IrcEvent *event); // RPL_STATSCONN
59 Q_INVOKABLE void processIrcEvent265(IrcEvent *event); // RPL_LOCALUSERS
60 Q_INVOKABLE void processIrcEvent266(IrcEvent *event); // RPL_GLOBALUSERS
61 Q_INVOKABLE void processIrcEvent301(IrcEvent *event); // RPL_AWAY
62 Q_INVOKABLE void processIrcEvent305(IrcEvent *event); // RPL_UNAWAY
63 Q_INVOKABLE void processIrcEvent306(IrcEvent *event); // RPL_NOWAWAY
64 Q_INVOKABLE void processIrcEvent307(IrcEvent *event); // RPL_WHOISSERVICE
65 Q_INVOKABLE void processIrcEvent310(IrcEvent *event); // RPL_SUSERHOST
66 Q_INVOKABLE void processIrcEvent311(IrcEvent *event); // RPL_WHOISUSER
67 Q_INVOKABLE void processIrcEvent312(IrcEvent *event); // RPL_WHOISSERVER
68 Q_INVOKABLE void processIrcEvent313(IrcEvent *event); // RPL_WHOISOPERATOR
69 Q_INVOKABLE void processIrcEvent315(IrcEvent *event); // RPL_ENDOFWHO
70 Q_INVOKABLE void processIrcEvent317(IrcEvent *event); // RPL_WHOISIDLE
71 Q_INVOKABLE void processIrcEvent322(IrcEvent *event); // RPL_LIST
72 Q_INVOKABLE void processIrcEvent323(IrcEvent *event); // RPL_LISTEND
73 Q_INVOKABLE void processIrcEvent324(IrcEvent *event); // RPL_CHANNELMODEIS
74 Q_INVOKABLE void processIrcEvent331(IrcEvent *event); // RPL_NOTOPIC
75 Q_INVOKABLE void processIrcEvent332(IrcEvent *event); // RPL_TOPIC
76 Q_INVOKABLE void processIrcEvent352(IrcEvent *event); // RPL_WHOREPLY
77 Q_INVOKABLE void processIrcEvent353(IrcEvent *event); // RPL_NAMREPLY
78 Q_INVOKABLE void processIrcEvent432(IrcEventNumeric *event); // ERR_ERRONEUSNICKNAME
79 Q_INVOKABLE void processIrcEvent433(IrcEventNumeric *event); // ERR_NICKNAMEINUSE
80 Q_INVOKABLE void processIrcEvent437(IrcEventNumeric *event); // ERR_UNAVAILRESOURCE
82 // Q_INVOKABLE void processIrcEvent(IrcEvent *event);
85 bool checkParamCount(IrcEvent *event, int minParams);
86 inline CoreNetwork *coreNetwork(NetworkEvent *e) const { return qobject_cast<CoreNetwork *>(e->network()); }
87 void tryNextNick(NetworkEvent *e, const QString &errnick, bool erroneous = false);
90 //! Joins after a netsplit
91 /** This slot handles a bulk-join after a netsplit is over
92 * \param net The network
93 * \param channel The channel the users joined
94 * \param users The list of users that joind the channel
95 * \param modes The list of modes the users get set
96 * \param quitMessage The message we received when the netsplit occured
98 void handleNetsplitJoin(Network *net, const QString &channel, const QStringList &users, const QStringList &modes, const QString &quitMessage);
100 //! Quits after a netsplit
101 /** This slot handles a bulk-quit after a netsplit occured
102 * \param net The network
103 * \param channel The channel the users quitted
104 * \param users The list of users that got split
105 * \param quitMessage The message we received when the netsplit occured
107 void handleNetsplitQuit(Network *net, const QString &channel, const QStringList &users, const QString &quitMessage);
109 //! Netsplit finished
110 /** This slot deletes the netsplit object that sent the finished() signal
112 void handleNetsplitFinished();
114 void handleEarlyNetsplitJoin(Network *net, const QString &channel, const QStringList &users, const QStringList &modes);
116 //! Destroy any existing netsplits
117 /** This slot deletes all netsplit objects
118 * Used to get rid of existing netsplits on network reconnect
119 * \param network The network we want to clear
121 void destroyNetsplits(NetworkId network);
124 CoreSession *_coreSession;
126 // structure to organize netsplits
128 // value: the corresponding netsplit object
129 QHash<Network *, QHash<QString, Netsplit*> > _netsplits;