Commit 04cf6998 authored by Simon Désaulniers's avatar Simon Désaulniers

presencemanager: get tracked ring buddy status

Change-Id: I7de7dda5f11e0a86a6335e8806c4f2dfd79caa9f
parent f9f3c3e6
......@@ -3,6 +3,7 @@
*
* Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
* Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com>
* Author: Simon Désaulniers <simon.desaulniers@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -37,6 +38,8 @@
#include "client/ring_signal.h"
#include "compiler_intrinsics.h"
#include "ringdht/ringaccount.h"
namespace DRing {
using ring::SIPAccount;
......@@ -76,6 +79,8 @@ subscribeBuddy(const std::string& accountID, const std::string& uri, bool flag)
flag ? "S" : "Uns", accountID.c_str(), uri.c_str());
pres->subscribeClient(uri, flag);
}
} else if (auto ringaccount = ring::Manager::instance().getAccount<ring::RingAccount>(accountID)) {
ringaccount->trackBuddyPresence(uri);
} else
RING_ERR("Could not find account %s", accountID.c_str());
}
......@@ -140,6 +145,13 @@ getSubscriptions(const std::string& accountID)
}
} else
RING_ERR("Presence not initialized");
} else if (auto ringaccount = ring::Manager::instance().getAccount<ring::RingAccount>(accountID)) {
for (const auto& tracked_id : ringaccount->getTrackedBuddyPresence()) {
ret.push_back({
{BUDDY_KEY, tracked_id.first},
{STATUS_KEY, tracked_id.second ? ONLINE_KEY : OFFLINE_KEY}
});
}
} else
RING_ERR("Could not find account %s.", accountID.c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment