diff --git a/src/rostermanager.cpp b/src/rostermanager.cpp index 34a2d690bdcb910b9dc96bcff4d051c0d6b9b3d3..88b6997131ad7c02605fb9c7b4004216a6e22b09 100644 --- a/src/rostermanager.cpp +++ b/src/rostermanager.cpp @@ -204,7 +204,9 @@ void RosterManager::sendBuddySubscribePresence(Buddy *buddy) { response->setTo(m_user->getJID()); response->setFrom(buddy->getJID()); response->setType(Swift::Presence::Subscribe); -// TODO: NICKNAME + if (!buddy->getAlias().empty()) { + response->addPayload(boost::make_shared(buddy->getAlias())); + } m_component->getStanzaChannel()->sendPresence(response); } @@ -231,14 +233,7 @@ void RosterManager::setBuddyCallback(Buddy *buddy) { sendBuddyRosterPush(buddy); } else { - // Send RIE only if there's resource which supports it. - Swift::JID jidWithRIE = m_user->getJIDWithFeature("http://jabber.org/protocol/rosterx"); - if (jidWithRIE.isValid()) { - m_RIETimer->start(); - } - else { - sendBuddySubscribePresence(buddy); - } + m_RIETimer->start(); } } @@ -317,10 +312,10 @@ void RosterManager::sendRIE() { m_RIETimer->stop(); // Check the feature, because proper resource could logout during RIETimer. - Swift::JID jidWithRIE = m_user->getJIDWithFeature("http://jabber.org/protocol/rosterx"); + std::vector jidWithRIE = m_user->getJIDWithFeature("http://jabber.org/protocol/rosterx"); // fallback to normal subscribe - if (!jidWithRIE.isValid()) { + if (jidWithRIE.empty()) { for (std::map, boost::pool_allocator< std::pair > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) { Buddy *buddy = (*it).second; if (!buddy) { @@ -331,8 +326,6 @@ void RosterManager::sendRIE() { return; } - LOG4CXX_INFO(logger, "Sending RIE stanza to " << jidWithRIE.toString()); - Swift::RosterItemExchangePayload::ref payload = Swift::RosterItemExchangePayload::ref(new Swift::RosterItemExchangePayload()); for (std::map, boost::pool_allocator< std::pair > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) { Buddy *buddy = (*it).second; @@ -348,8 +341,11 @@ void RosterManager::sendRIE() { payload->addItem(item); } - boost::shared_ptr > request(new Swift::GenericRequest(Swift::IQ::Set, jidWithRIE, payload, m_component->getIQRouter())); - request->send(); + BOOST_FOREACH(Swift::JID &jid, jidWithRIE) { + LOG4CXX_INFO(logger, "Sending RIE stanza to " << jid.toString()); + boost::shared_ptr > request(new Swift::GenericRequest(Swift::IQ::Set, jid, payload, m_component->getIQRouter())); + request->send(); + } } void RosterManager::handleSubscription(Swift::Presence::ref presence) {