vector<string> urls = config.getSyncURL();
m_peers[server.first].clear();
BOOST_FOREACH (const string &url, urls) {
- m_peers[server.first].push_back(make_pair(url,MIGHTWORK));
+ // take current status into account,
+ // PresenceStatus::checkPresence() calls init() and
+ // expects up-to-date information
+ PeerStatus status;
+ if ((boost::starts_with(url, "obex-bt") && m_btPresence) ||
+ (boost::starts_with (url, "http") && m_httpPresence)) {
+ status = MIGHTWORK;
+ } else {
+ status = NOTRANSPORT;
+ }
+ m_peers[server.first].push_back(make_pair(url, status));
}
}
m_initiated = true;
void PresenceStatus::updatePresenceStatus (bool httpPresence, bool btPresence) {
bool httpChanged = (m_httpPresence != httpPresence);
bool btChanged = (m_btPresence != btPresence);
- m_httpPresence = httpPresence;
- m_btPresence = btPresence;
if(httpChanged) {
m_httpTimer.reset();
}
return;
}
- //initialize the configured peer list
+ //initialize the configured peer list using old presence status
bool initiated = m_initiated;
if (!m_initiated) {
init();
}
+ // switch to new status
+ m_httpPresence = httpPresence;
+ m_btPresence = btPresence;
+
//iterate all configured peers and fire singals
BOOST_FOREACH (StatusPair &peer, m_peers) {
//iterate all possible transports