X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fpeer.cpp;h=3785326cc106f7f61d13b0afb6d9d487854a2699;hb=d0e9b7a1d5e73041ade519189eea012500440ba9;hp=14041597310464ccbe619cfa3ca2b58e4ce72c0f;hpb=1cb02004ee5973b89368bd84f234d4652794690d;p=quassel.git diff --git a/src/common/peer.cpp b/src/common/peer.cpp index 14041597..3785326c 100644 --- a/src/common/peer.cpp +++ b/src/common/peer.cpp @@ -32,3 +32,22 @@ AuthHandler *Peer::authHandler() const { return _authHandler; } + + +// Note that we need to use a fixed-size integer instead of uintptr_t, in order +// to avoid issues with different architectures for client and core. +// In practice, we'll never really have to restore the real value of a PeerPtr from +// a QVariant. +QDataStream &operator<<(QDataStream &out, PeerPtr ptr) +{ + out << reinterpret_cast(ptr); + return out; +} + +QDataStream &operator>>(QDataStream &in, PeerPtr &ptr) +{ + quint64 value; + in >> value; + ptr = reinterpret_cast(value); + return in; +}