Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
/***************************************************************************
*
* File: Connection.h
* Created: Thu Jan 6 2000
* (C) 2000 by David M. <captjay@superlink.net>
*
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CONNECTION_H
#define CONNECTION_H
#include <qobject.h>
#include "DataAccess.h"
class IRCModule;
/**
* @author David M.
* @short Handle connection-related problems.
*
* This class is a Controler that handles connection-related events
* (reconnecting when disconnected, connect on DCC Chat requests, etc).
*
* This class, as most controlers is a singleton.
*/
class ConnectionC : public QObject {
Q_OBJECT
public:
/**
* Get a pointer to the single ConnectionC instance.
*/
static ConnectionC* instance();
/**
* Make the connection controler use pList as its internal server list.
*
* PRECONDITIONS: pList != 0
* @param pList A pointer to an existing ServerList.
*/
void setServerList(ServerList* pList);
/**
* Make the connection controler use pModule to interact with the IRC
* server.
*
* PRECONDITIONS: pModule != 0
* @param pList A pointer to an existing IRCModule.
*/
void setIRCModule(IRCModule* pModule);
/**
* Change wether the controler should attempt to reconnect automatically
* when it gets disconnected from the IRC server. This option is turned
* on by default, but should be turned off in case of a voluntary
* disconnection from the server (e.g QUIT)
* @param value The new value for the auto-reconnect option.
*/
void setReconnect(bool value);
/**
* Determine wether the controler currently has auto-reconnect turned on.
* @return true if auto-reconnect is on, false otherwise.
*/
bool getReconnect() const;
/**
* Make the controler connect to the next available server in list.
* The list is considered circular, so if the controler reaches the end
* of the list, it will start again from the beginning.
* If the connection to the next server fails, the controler will attempt
* to connect to the server after the next one, and so on.
* This could unfortunately lead to endless loops if none of the servers
* are good... =(
*/
void connectToNext();
public slots:
/**
* Should be connected to an IRCModule::onDisconnect() signal.
* Notifies the ConnectionC object that the connection to the IRC
* server has been lost.
*/
void onDisconnect();
/**
* Should be connected to an IRCModule::onPrivateCTCP() signal.
* The ConnectionC is only interrested in private DCC Chat requests.
* All other CTCPs are ignored.
*/
void onPrivateCTCP(QString nick,QString ctcpType, QString ctcpText);
protected:
ConnectionC();
static ConnectionC* _instance;
private:
ServerList* _serverList;
IRCModule* _ircModule;
bool _reconnect;
};
#endif
Generated by: nightsky@centauri on Sat Jan 15 23:06:10 2000, using kdoc 2.0a30. |