diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-04-02 10:25:21 -0300 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-04-02 10:37:37 -0300 |
commit | 94fb8f7e048cbacf261c2fa89d83f91dc1c401c5 (patch) | |
tree | d48aad2a023367ea1d82387e6dfa9786a7b4590d /examples | |
parent | 124975bc160784805a06abc35065db7c2208bd89 (diff) |
cm example: Add example for BaseProtocolPresenceInterface usage.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cm/protocol.cpp | 18 | ||||
-rw-r--r-- | examples/cm/protocol.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/examples/cm/protocol.cpp b/examples/cm/protocol.cpp index 3319e0b3..08e4a3b5 100644 --- a/examples/cm/protocol.cpp +++ b/examples/cm/protocol.cpp @@ -62,6 +62,24 @@ Protocol::Protocol(const QDBusConnection &dbusConnection, const QString &name) avatarsIface->setAvatarDetails(AvatarSpec(QStringList() << QLatin1String("image/png"), 16, 64, 32, 16, 64, 32, 1024)); plugInterface(AbstractProtocolInterfacePtr::dynamicCast(avatarsIface)); + + SimpleStatusSpec spAvailable; + spAvailable.type = ConnectionPresenceTypeAvailable; + spAvailable.maySetOnSelf = true; + spAvailable.canHaveMessage = true; + + SimpleStatusSpec spOffline; + spOffline.type = ConnectionPresenceTypeOffline; + spOffline.maySetOnSelf = true; + spOffline.canHaveMessage = false; + + SimpleStatusSpecMap specs; + specs.insert(QLatin1String("available"), spAvailable); + specs.insert(QLatin1String("offline"), spOffline); + + presenceIface = BaseProtocolPresenceInterface::create(); + presenceIface->setStatuses(PresenceSpecList(specs)); + plugInterface(AbstractProtocolInterfacePtr::dynamicCast(presenceIface)); } Protocol::~Protocol() diff --git a/examples/cm/protocol.h b/examples/cm/protocol.h index 7b5c7015..7f263cfa 100644 --- a/examples/cm/protocol.h +++ b/examples/cm/protocol.h @@ -46,6 +46,7 @@ private: Tp::BaseProtocolAddressingInterfacePtr addrIface; Tp::BaseProtocolAvatarsInterfacePtr avatarsIface; + Tp::BaseProtocolPresenceInterfacePtr presenceIface; }; #endif |