- Network(const uint &networkid, QObject *parent = 0);
- //virtual ~Network();
-
- NetworkId networkId() const;
- bool initialized() const;
-
- SignalProxy *proxy() const;
- void setProxy(SignalProxy *proxy);
-
- bool isMyNick(const QString &nick) const;
- bool isMyNick(IrcUser *ircuser) const;
+ enum ConnectionState {
+ Disconnected,
+ Connecting,
+ Initializing,
+ Initialized,
+ Reconnecting,
+ Disconnecting
+ };
+
+ // see:
+ // http://www.irc.org/tech_docs/005.html
+ // http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
+ enum ChannelModeType {
+ NOT_A_CHANMODE = 0x00,
+ A_CHANMODE = 0x01,
+ B_CHANMODE = 0x02,
+ C_CHANMODE = 0x04,
+ D_CHANMODE = 0x08
+ };
+
+ struct Server {
+ QString host;
+ uint port;
+ QString password;
+ bool useSsl;
+ int sslVersion;
+
+ bool useProxy;
+ int proxyType;
+ QString proxyHost;
+ uint proxyPort;
+ QString proxyUser;
+ QString proxyPass;
+
+ Server() : port(6667), useSsl(false), sslVersion(0), useProxy(false), proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {}
+ Server(const QString &host, uint port, const QString &password, bool useSsl)
+ : host(host), port(port), password(password), useSsl(useSsl), sslVersion(0),
+ useProxy(false), proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {}
+ bool operator==(const Server &other) const;
+ bool operator!=(const Server &other) const;
+ };
+ typedef QList<Server> ServerList;
+
+ Network(const NetworkId &networkid, QObject *parent = 0);
+ ~Network();
+
+ inline NetworkId networkId() const { return _networkId; }
+
+ inline SignalProxy *proxy() const { return _proxy; }
+ inline void setProxy(SignalProxy *proxy) { _proxy = proxy; }
+
+ inline bool isMyNick(const QString &nick) const { return (myNick().toLower() == nick.toLower()); }
+ inline bool isMe(IrcUser *ircuser) const { return (ircuser->nick().toLower() == myNick().toLower()); }