Changeset - 62f3fbf99c88
[Not reviewed]
0 3 0
Jan Kaluza - 14 years ago 2011-04-06 14:32:03
hanzz.k@gmail.com
Buddy::JIDToLegacyName
3 files changed with 18 insertions and 2 deletions:
0 comments (0 inline, 0 general)
include/transport/buddy.h
Show inline comments
 
@@ -126,12 +126,14 @@ class Buddy {
 

	
 
		/// Returns SHA-1 hash of buddy icon (avatar) or empty string if there is no avatar
 
		/// for this buddy.
 
		/// \return avatar hash or empty string.
 
		virtual std::string getIconHash() = 0;
 

	
 
		static std::string JIDToLegacyName(const Swift::JID &jid);
 

	
 
	private:
 
		void generateJID();
 

	
 
		long m_id;
 
		bool m_online;
 
		std::string m_subscription;
src/buddy.cpp
Show inline comments
 
@@ -150,7 +150,21 @@ void Buddy::buddyChanged() {
 
	Swift::Presence::ref presence = generatePresenceStanza(255);
 
	if (presence) {
 
		m_rosterManager->getUser()->getComponent()->getStanzaChannel()->sendPresence(presence);
 
	}
 
}
 

	
 
std::string Buddy::JIDToLegacyName(const Swift::JID &jid) {
 
	std::string name;
 
	if (jid.getUnescapedNode() == jid.getNode()) {
 
		name = jid.getNode();
 
		if (name.find_last_of("%") != std::string::npos) {
 
			name.replace(name.find_last_of("%"), 1, "@");
 
		}
 
	}
 
	else {
 
		name = jid.getUnescapedNode();
 
	}
 
	return name;
 
}
 

	
 
}
src/rostermanager.cpp
Show inline comments
 
@@ -117,10 +117,10 @@ void RosterManager::sendRIE() {
 

	
 
	boost::shared_ptr<Swift::GenericRequest<Swift::RosterItemExchangePayload> > request(new Swift::GenericRequest<Swift::RosterItemExchangePayload>(Swift::IQ::Set, m_user->getJID(), payload, m_component->getIQRouter()));
 
	request->send();
 
}
 

	
 
void RosterManager::handleSubscription(Swift::Presence::ref presence) {
 
	></i>
 
	std::string legacyName = Buddy::JIDToLegacyName(presence->getTo());
 
}
 

	
 
}
 
\ No newline at end of file
 
}
0 comments (0 inline, 0 general)