Working subscriptions with swiften_raw backend
This commit is contained in:
parent
5c60ead75c
commit
ba9a34731c
1 changed files with 14 additions and 0 deletions
|
@ -296,6 +296,8 @@ class SwiftenPlugin : public NetworkPlugin, Swift::XMPPParserClient {
|
|||
client->getPresenceOracle()->onPresenceChange.connect(boost::bind(&SwiftenPlugin::handleSwiftPresenceChanged, this, user, _1));
|
||||
client->onDataRead.connect(boost::bind(&SwiftenPlugin::handleSwiftenDataRead, this, _1));
|
||||
client->onDataWritten.connect(boost::bind(&SwiftenPlugin::handleSwiftenDataWritten, this, _1));
|
||||
client->getSubscriptionManager()->onPresenceSubscriptionRequest.connect(boost::bind(&SwiftenPlugin::handleSubscriptionRequest, this, user, _1, _2, _3));
|
||||
client->getSubscriptionManager()->onPresenceSubscriptionRevoked.connect(boost::bind(&SwiftenPlugin::handleSubscriptionRevoked, this, user, _1, _2));
|
||||
Swift::ClientOptions opt;
|
||||
opt.allowPLAINWithoutTLS = true;
|
||||
client->connect(opt);
|
||||
|
@ -305,6 +307,18 @@ class SwiftenPlugin : public NetworkPlugin, Swift::XMPPParserClient {
|
|||
m_handlers[user] = handler;
|
||||
}
|
||||
|
||||
void handleSubscriptionRequest(const std::string &user, const Swift::JID& jid, const std::string& message, Swift::Presence::ref presence) {
|
||||
handleSwiftPresenceChanged(user, presence);
|
||||
}
|
||||
|
||||
void handleSubscriptionRevoked(const std::string &user, const Swift::JID& jid, const std::string& message) {
|
||||
Swift::Presence::ref presence = Swift::Presence::create();
|
||||
presence->setTo(user);
|
||||
presence->setFrom(jid);
|
||||
presence->setType(Swift::Presence::Unsubscribe);
|
||||
handleSwiftPresenceChanged(user, presence);
|
||||
}
|
||||
|
||||
void handleLogoutRequest(const std::string &user, const std::string &legacyName) {
|
||||
boost::shared_ptr<Swift::Client> client = m_users[user];
|
||||
if (client) {
|
||||
|
|
Loading…
Add table
Reference in a new issue