Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ircconnection.h

Go to the documentation of this file.
00001 /*
00002     OpieIRC - An embedded IRC client
00003     Copyright (C) 2002 Wenzel Jakob
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 */
00020 
00021 #ifndef __IRCCONNECTION_H
00022 #define __IRCCONNECTION_H
00023 
00024 #include <qsocket.h>
00025 #include "ircserver.h"
00026 #include "ircmessage.h"
00027 #include "ircoutput.h"
00028 
00029 /* IRCConnection acts as a wrapper around QSocket
00030    and is responsible for the communication with the
00031    IRC server */
00032 class IRCConnection : public QObject {
00033     Q_OBJECT
00034 public:
00035     IRCConnection(IRCServer *server);
00036     void doConnect();
00037     /* used to send commands to the IRC server */
00038     void sendLine(QString line);
00039     /* used to send CTCP commands to the IRC server */
00040     void sendCTCPReply(const QString &nickname, const QString &type, const QString &args);
00041     void sendCTCPRequest(const QString &nickname, const QString &type, const QString &args);
00042     void sendCTCPPing(const QString &nickname);
00043     void whois(const QString &nickname);
00044     void sendCTCPping(const QString &nickname);
00045     void close();
00046     bool isConnected();
00047     bool isLoggedIn();
00048 signals:
00049     /* triggered when the server sent us a message */
00050     void messageArrived(IRCMessage *message);
00051     /* Used to send commands to the UI (such as displaying text etc) */
00052     void outputReady(IRCOutput output);
00053 protected slots:
00054     /* automatically executed after the connection is established */
00055     void login();
00056     /* called when there are socket errors */
00057     void error(int num);
00058     /* called when data arrived on m_socket (triggers messageArrived) */
00059     void dataReady();
00060     /* called when the IRC server closes the connection */
00061     void disconnect();
00062 protected:
00063     IRCServer  *m_server;
00064     QSocket    *m_socket;
00065     bool        m_connected;
00066     bool        m_loggedIn;
00067 };
00068 
00069 #endif /* __IRCCONNECTION_H */

Generated on Sat Nov 5 16:17:40 2005 for OPIE by  doxygen 1.4.2