X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fpeer.cpp;h=3785326cc106f7f61d13b0afb6d9d487854a2699;hp=14041597310464ccbe619cfa3ca2b58e4ce72c0f;hb=d367542ce54ed86fd3c8dbdbbf8210fc9a19a882;hpb=92f37cc0a3dd57ff4732deeef92ad8062cbc641d 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; +}