inline NetworkId networkId() const { return network()? network()->networkId() : NetworkId(); }
inline Network *network() const { return _network; }
+ static Event *create(EventManager::EventType type, QVariantMap &map, Network *network);
+
protected:
+ explicit NetworkEvent(EventManager::EventType type, QVariantMap &map, Network *network);
+ void toVariantMap(QVariantMap &map) const;
+
virtual inline QString className() const { return "NetworkEvent"; }
virtual inline void debugInfo(QDebug &dbg) const { dbg.nospace() << ", net = " << qPrintable(_network->networkName()); }
Network *_network;
};
+/*****************************************************************************/
+
class NetworkConnectionEvent : public NetworkEvent {
public:
inline void setConnectionState(Network::ConnectionState state) { _state = state; }
protected:
+ explicit NetworkConnectionEvent(EventManager::EventType type, QVariantMap &map, Network *network);
+ void toVariantMap(QVariantMap &map) const;
+
virtual inline QString className() const { return "NetworkConnectionEvent"; }
virtual inline void debugInfo(QDebug &dbg) const {
NetworkEvent::debugInfo(dbg);
private:
Network::ConnectionState _state;
+
+ friend class NetworkEvent;
};
class NetworkDataEvent : public NetworkEvent {
inline void setData(const QByteArray &data) { _data = data; }
protected:
+ explicit NetworkDataEvent(EventManager::EventType type, QVariantMap &map, Network *network);
+ void toVariantMap(QVariantMap &map) const;
+
virtual inline QString className() const { return "NetworkDataEvent"; }
virtual inline void debugInfo(QDebug &dbg) const {
NetworkEvent::debugInfo(dbg);
private:
QByteArray _data;
+
+ friend class NetworkEvent;
};
class NetworkSplitEvent : public NetworkEvent {
inline QStringList users() const { return _users; }
inline QString quitMessage() const { return _quitMsg; }
+protected:
+ explicit NetworkSplitEvent(EventManager::EventType type, QVariantMap &map, Network *network);
+ void toVariantMap(QVariantMap &map) const;
+
+ virtual inline QString className() const { return "NetworkSplitEvent"; }
+ virtual inline void debugInfo(QDebug &dbg) const {
+ NetworkEvent::debugInfo(dbg);
+ dbg.nospace() << ", channel = " << qPrintable(channel())
+ << ", users = " << users()
+ << ", quitmsg = " << quitMessage();
+ }
+
private:
QString _channel;
QStringList _users;
QString _quitMsg;
+
+ friend class NetworkEvent;
};