Changeset - 1c03537a790b
[Not reviewed]
0 1 0
Jan Kaluza - 13 years ago 2012-09-05 14:31:03
hanzz.k@gmail.com
hopefully fixed replace_invalid crash
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/networkpluginserver.cpp
Show inline comments
 
@@ -419,55 +419,57 @@ void NetworkPluginServer::handleConnectedPayload(const std::string &data) {
 

	
 
void NetworkPluginServer::handleDisconnectedPayload(const std::string &data) {
 
	pbnetwork::Disconnected payload;
 
	if (payload.ParseFromString(data) == false) {
 
		// TODO: ERROR
 
		return;
 
	}
 

	
 
	m_component->m_userRegistry->onPasswordInvalid(payload.user(), payload.message());
 

	
 
	User *user = m_userManager->getUser(payload.user());
 
	if (!user) {
 
		return;
 
	}
 
	user->handleDisconnected(payload.message(), (Swift::SpectrumErrorPayload::Error) payload.error());
 
}
 

	
 
void NetworkPluginServer::handleVCardPayload(const std::string &data) {
 
	pbnetwork::VCard payload;
 
	if (payload.ParseFromString(data) == false) {
 
		std::cout << "PARSING ERROR\n";
 
		// TODO: ERROR
 
		return;
 
	}
 
	std::string field;
 
	std::string field = payload.fullname();
 

	
 
	boost::shared_ptr<Swift::VCard> vcard(new Swift::VCard());
 

	
 
	utf8::replace_invalid(payload.fullname().begin(), payload.fullname().end(), field.begin(), '_');
 
	vcard->setFullName(field);
 

	
 
	field = payload.nickname();
 

	
 
	utf8::replace_invalid(payload.nickname().begin(), payload.nickname().end(), field.begin(), '_');
 
	vcard->setNickname(field);
 

	
 
	vcard->setPhoto(Swift::createByteArray(payload.photo()));
 

	
 
	m_vcardResponder->sendVCard(payload.id(), vcard);
 
}
 

	
 
void NetworkPluginServer::handleAuthorizationPayload(const std::string &data) {
 
	pbnetwork::Buddy payload;
 
	if (payload.ParseFromString(data) == false) {
 
		// TODO: ERROR
 
		return;
 
	}
 

	
 
	User *user = m_userManager->getUser(payload.username());
 
	if (!user)
 
		return;
 

	
 
	// Create subscribe presence and forward it to XMPP side
 
	Swift::Presence::ref response = Swift::Presence::create();
 
	response->setTo(user->getJID());
 
	std::string name = payload.buddyname();
 

	
0 comments (0 inline, 0 general)