X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fnetwork.h;h=6b126d830a7fc521f3f9cc73e3bef31a0fdfcae8;hp=f0bd112ca8238bff95f6386094ae670c492b281a;hb=3456106b07bfc3000e50df9322ddefd4f872e0fb;hpb=e4972a0ebce0d555d752ab2f34ffd6a6dcdef1dd diff --git a/src/common/network.h b/src/common/network.h index f0bd112c..6b126d83 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2012 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -29,6 +29,7 @@ #include #include #include +#include #include "types.h" #include "util.h" @@ -46,7 +47,7 @@ struct NetworkInfo; class Network : public SyncableObject { SYNCABLE_OBJECT Q_OBJECT - Q_ENUMS(ConnectionState Network::ConnectionState) + Q_ENUMS(ConnectionState) Q_PROPERTY(QString networkName READ networkName WRITE setNetworkName STORED false) Q_PROPERTY(QString currentServer READ currentServer WRITE setCurrentServer STORED false) @@ -111,7 +112,7 @@ public: 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) {} + useProxy(false), proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {} bool operator==(const Server &other) const; bool operator!=(const Server &other) const; }; @@ -134,10 +135,10 @@ public: //Network::ConnectionState connectionState() const; inline int connectionState() const { return _connectionState; } - QString prefixToMode(const QString &prefix); - inline QString prefixToMode(const QCharRef &prefix) { return prefixToMode(QString(prefix)); } - QString modeToPrefix(const QString &mode); - inline QString modeToPrefix(const QCharRef &mode) { return modeToPrefix(QString(mode)); } + QString prefixToMode(const QString &prefix) const; + inline QString prefixToMode(const QCharRef &prefix) const { return prefixToMode(QString(prefix)); } + QString modeToPrefix(const QString &mode) const; + inline QString modeToPrefix(const QCharRef &mode) const { return modeToPrefix(QString(mode)); } ChannelModeType channelModeType(const QString &mode); inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); } @@ -168,8 +169,9 @@ public: NetworkInfo networkInfo() const; void setNetworkInfo(const NetworkInfo &); - QString prefixes(); - QString prefixModes(); + QString prefixes() const; + QString prefixModes() const; + void determinePrefixes() const; bool supports(const QString ¶m) const { return _supports.contains(param); } QString support(const QString ¶m) const; @@ -270,10 +272,10 @@ public slots: void emitConnectionError(const QString &); -private slots: - void removeIrcUser(IrcUser *ircuser); - void removeIrcChannel(IrcChannel *ircChannel); - void removeChansAndUsers(); +protected slots: + virtual void removeIrcUser(IrcUser *ircuser); + virtual void removeIrcChannel(IrcChannel *ircChannel); + virtual void removeChansAndUsers(); signals: void aboutToBeDestroyed(); @@ -319,6 +321,7 @@ signals: protected: inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new IrcChannel(channelname, this); } + inline virtual IrcUser *ircUserFactory(const QString &hostmask) { return new IrcUser(hostmask, this); } private: QPointer _proxy; @@ -333,8 +336,8 @@ private: bool _connected; ConnectionState _connectionState; - QString _prefixes; - QString _prefixModes; + mutable QString _prefixes; + mutable QString _prefixModes; QHash _ircUsers; // stores all known nicks for the server QHash _ircChannels; // stores all known channels @@ -358,8 +361,6 @@ private: bool _unlimitedReconnectRetries; bool _rejoinChannels; - void determinePrefixes(); - QTextCodec *_codecForServer; QTextCodec *_codecForEncoding; QTextCodec *_codecForDecoding;