X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fnetwork.h;h=4c5baf6cf5ff638c65fb750e718a9c2a52130868;hp=bee38e9656eb2c6a4140a71436b4c9e8f9f9e826;hb=70283ef877bdf3339fb067667ad9130ceabd8b9a;hpb=f824db0e31b54969e0b7fa0b5405b1e9173d482c diff --git a/src/common/network.h b/src/common/network.h index bee38e96..4c5baf6c 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -44,6 +44,7 @@ struct NetworkInfo; // TODO: ConnectionInfo to propagate and sync the current state of NetworkConnection, encodings etcpp class Network : public SyncableObject { + SYNCABLE_OBJECT Q_OBJECT Q_ENUMS(ConnectionState Network::ConnectionState) @@ -203,6 +204,10 @@ public: inline bool autoAwayActive() const { return _autoAwayActive; } inline void setAutoAwayActive(bool active) { _autoAwayActive = active; } + static QStringList presetNetworks(bool onlyDefault = false); + static QStringList presetDefaultChannels(const QString &networkName); + static NetworkInfo networkInfoFromPreset(const QString &networkName); + public slots: void setNetworkName(const QString &networkName); void setCurrentServer(const QString ¤tServer); @@ -250,9 +255,9 @@ public slots: // channel lists up to date void ircUserNickChanged(QString newnick); - virtual inline void requestConnect() const { emit connectRequested(); } - virtual inline void requestDisconnect() const { emit disconnectRequested(); } - virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { emit setNetworkInfoRequested(info); } + virtual inline void requestConnect() const { REQUEST(NO_ARG) } + virtual inline void requestDisconnect() const { REQUEST(NO_ARG) } + virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { REQUEST(ARG(info)) } void emitConnectionError(const QString &); @@ -267,39 +272,41 @@ signals: void currentServerSet(const QString ¤tServer); void connectedSet(bool isConnected); void connectionStateSet(Network::ConnectionState); - void connectionStateSet(int); +// void connectionStateSet(int); void connectionError(const QString &errorMsg); void myNickSet(const QString &mynick); - void latencySet(int latency); +// void latencySet(int latency); void identitySet(IdentityId); - void serverListSet(QVariantList serverList); - void useRandomServerSet(bool); - void performSet(const QStringList &); - void useAutoIdentifySet(bool); - void autoIdentifyServiceSet(const QString &); - void autoIdentifyPasswordSet(const QString &); - void useAutoReconnectSet(bool); - void autoReconnectIntervalSet(quint32); - void autoReconnectRetriesSet(quint16); - void unlimitedReconnectRetriesSet(bool); - void rejoinChannelsSet(bool); - - void codecForServerSet(const QByteArray &codecName); - void codecForEncodingSet(const QByteArray &codecName); - void codecForDecodingSet(const QByteArray &codecName); - - void supportAdded(const QString ¶m, const QString &value); - void supportRemoved(const QString ¶m); - - void ircUserAdded(const QString &hostmask); + void configChanged(); + + // void serverListSet(QVariantList serverList); +// void useRandomServerSet(bool); +// void performSet(const QStringList &); +// void useAutoIdentifySet(bool); +// void autoIdentifyServiceSet(const QString &); +// void autoIdentifyPasswordSet(const QString &); +// void useAutoReconnectSet(bool); +// void autoReconnectIntervalSet(quint32); +// void autoReconnectRetriesSet(quint16); +// void unlimitedReconnectRetriesSet(bool); +// void rejoinChannelsSet(bool); + +// void codecForServerSet(const QByteArray &codecName); +// void codecForEncodingSet(const QByteArray &codecName); +// void codecForDecodingSet(const QByteArray &codecName); + +// void supportAdded(const QString ¶m, const QString &value); +// void supportRemoved(const QString ¶m); + +// void ircUserAdded(const QString &hostmask); void ircUserAdded(IrcUser *); - void ircChannelAdded(const QString &channelname); +// void ircChannelAdded(const QString &channelname); void ircChannelAdded(IrcChannel *); - void connectRequested() const; - void disconnectRequested() const; - void setNetworkInfoRequested(const NetworkInfo &) const; +// void connectRequested() const; +// void disconnectRequested() const; +// void setNetworkInfoRequested(const NetworkInfo &) const; protected: inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new IrcChannel(channelname, this); } @@ -350,12 +357,17 @@ private: bool _autoAwayActive; // when this is active handle305 and handle306 don't trigger any output + static QString _networksIniPath; + friend class IrcUser; friend class IrcChannel; }; //! Stores all editable information about a network (as opposed to runtime state). struct NetworkInfo { + // set some default values, note that this does not initialize e.g. name and id + NetworkInfo(); + NetworkId networkId; QString networkName; IdentityId identity; @@ -365,7 +377,6 @@ struct NetworkInfo { QByteArray codecForEncoding; QByteArray codecForDecoding; - // Server entry: QString "Host", uint "Port", QString "Password", bool "UseSSL" Network::ServerList serverList; bool useRandomServer;