1 /***************************************************************************
2 * Copyright (C) 2005/06 by The Quassel Team *
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) any later version. *
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 ***************************************************************************/
29 #define DEFAULT_PORT 6667
32 * This is a server object, managing a single connection to an IRC server, handling the associated channels and so on.
33 * We have this run in its own thread mainly to not block other server objects or the core if something goes wrong,
34 * e.g. if some scripts starts running wild...
37 class Server : public QThread {
47 // serverState state();
50 // void setServerOptions();
51 void connectToIrc(const QString &host, quint16 port = DEFAULT_PORT);
52 void disconnectFromIrc();
54 void putRawLine(const QString &input /*, Buffer *source = 0 */);
57 //void outputLine(const QString & /*, Buffer *target = 0 */);
59 void recvLine(const QString&);
63 void socketError(QAbstractSocket::SocketError);
64 void socketConnected();
65 void socketDisconnected();
66 void socketStateChanged(QAbstractSocket::SocketState);
72 static void handleServerMsg(Message *);
73 static void handleUserMsg(Message *);
78 class TcpConnection : public QThread {
84 QAbstractSocket::SocketState state() const;
87 void connectToHost(const QString &host, quint16 port = DEFAULT_PORT);
88 void disconnectFromHost();
89 void sendLine(const QString &);
92 void recvLine(QString);
93 void error(QAbstractSocket::SocketError);
96 void stateChanged(QAbstractSocket::SocketState);