X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fnetwork.h;h=4a432d841b002969026fb15e1cc2c86a62f317d2;hb=731ec69d4608ba95e3ae4f154b8ca1852e1db2e5;hp=1371231b47e880614b1b16c4d6efb5f3b5f049e9;hpb=769fd4e7ade0b44503434d30fab8880a4b66411b;p=quassel.git diff --git a/src/common/network.h b/src/common/network.h index 1371231b..4a432d84 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef NETWORK_H_ -#define NETWORK_H_ +#ifndef NETWORK_H +#define NETWORK_H #include #include @@ -88,7 +88,7 @@ public: D_CHANMODE = 0x08 }; - + Network(const NetworkId &networkid, QObject *parent = 0); ~Network(); @@ -113,7 +113,7 @@ public: ChannelModeType channelModeType(const QString &mode); inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); } - + inline const QString &networkName() const { return _networkName; } inline const QString ¤tServer() const { return _currentServer; } inline const QString &myNick() const { return _myNick; } @@ -143,14 +143,14 @@ public: bool supports(const QString ¶m) const { return _supports.contains(param); } QString support(const QString ¶m) const; - IrcUser *newIrcUser(const QString &hostmask); + IrcUser *newIrcUser(const QString &hostmask, const QVariantMap &initData = QVariantMap()); inline IrcUser *newIrcUser(const QByteArray &hostmask) { return newIrcUser(decodeServerString(hostmask)); } IrcUser *ircUser(QString nickname) const; inline IrcUser *ircUser(const QByteArray &nickname) const { return ircUser(decodeServerString(nickname)); } inline QList ircUsers() const { return _ircUsers.values(); } inline quint32 ircUserCount() const { return _ircUsers.count(); } - IrcChannel *newIrcChannel(const QString &channelname); + IrcChannel *newIrcChannel(const QString &channelname, const QVariantMap &initData = QVariantMap()); inline IrcChannel *newIrcChannel(const QByteArray &channelname) { return newIrcChannel(decodeServerString(channelname)); } IrcChannel *ircChannel(QString channelname) const; inline IrcChannel *ircChannel(const QByteArray &channelname) const { return ircChannel(decodeServerString(channelname)); } @@ -176,6 +176,9 @@ public: static void setDefaultCodecForEncoding(const QByteArray &name); static void setDefaultCodecForDecoding(const QByteArray &name); + bool autoAwayActive() const { return _autoAwayActive; } + void setAutoAwayActive(bool active) { _autoAwayActive = active; } + public slots: void setNetworkName(const QString &networkName); void setCurrentServer(const QString ¤tServer); @@ -207,8 +210,6 @@ public slots: inline void addIrcUser(const QString &hostmask) { newIrcUser(hostmask); } inline void addIrcChannel(const QString &channel) { newIrcChannel(channel); } - void removeIrcUser(const QString &nick); - void removeIrcChannel(const QString &channel); //init geters QVariantMap initSupports() const; @@ -216,14 +217,14 @@ public slots: virtual QVariantMap initIrcUsersAndChannels() const; // QStringList initIrcUsers() const; // QStringList initIrcChannels() const; - + //init seters void initSetSupports(const QVariantMap &supports); inline void initSetServerList(const QVariantList &serverList) { setServerList(serverList); } virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels); // void initSetIrcUsers(const QStringList &hostmasks); // void initSetIrcChannels(const QStringList &channels); - + IrcUser *updateNickFromMask(const QString &mask); // these slots are to keep the hashlists of all users and the @@ -232,17 +233,14 @@ public slots: virtual inline void requestConnect() const { emit connectRequested(); } virtual inline void requestDisconnect() const { emit disconnectRequested(); } + virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { emit setNetworkInfoRequested(info); } void emitConnectionError(const QString &); private slots: - void ircUserDestroyed(); - void channelDestroyed(); void removeIrcUser(IrcUser *ircuser); void removeIrcChannel(IrcChannel *ircChannel); void removeChansAndUsers(); - void ircUserInitDone(); - void ircChannelInitDone(); signals: void aboutToBeDestroyed(); @@ -280,18 +278,12 @@ signals: void ircChannelAdded(const QString &channelname); void ircChannelAdded(IrcChannel *); - void ircUserRemoved(const QString &nick); - void ircChannelRemoved(const QString &channel); - - // needed for client sync progress - void ircUserRemoved(QObject *); - void ircChannelRemoved(QObject *); - - void ircUserInitDone(IrcUser *); - void ircChannelInitDone(IrcChannel *); - void connectRequested(NetworkId id = 0) const; void disconnectRequested(NetworkId id = 0) const; + void setNetworkInfoRequested(const NetworkInfo &) const; + +protected: + inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new IrcChannel(channelname, this); } private: QPointer _proxy; @@ -336,6 +328,11 @@ private: static QTextCodec *_defaultCodecForServer; static QTextCodec *_defaultCodecForEncoding; static QTextCodec *_defaultCodecForDecoding; + + bool _autoAwayActive; // when this is active handle305 and handle306 don't trigger any output + + friend class IrcUser; + friend class IrcChannel; }; //! Stores all editable information about a network (as opposed to runtime state). @@ -373,6 +370,6 @@ QDataStream &operator<<(QDataStream &out, const NetworkInfo &info); QDataStream &operator>>(QDataStream &in, NetworkInfo &info); QDebug operator<<(QDebug dbg, const NetworkInfo &i); -Q_DECLARE_METATYPE(NetworkInfo); +Q_DECLARE_METATYPE(NetworkInfo) #endif