Changeset - ca76287f4d9c
[Not reviewed]
0 4 0
HanzZ - 14 years ago 2011-10-03 23:09:14
hanzz.k@gmail.com
Set nickname according to received vcard
4 files changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -708,9 +708,11 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
 
			}
 
		}
 

	
 
		void handleVCardUpdatedRequest(const std::string &user, const std::string &image) {
 
		void handleVCardUpdatedRequest(const std::string &user, const std::string &image, const std::string &nickname) {
 
			PurpleAccount *account = m_sessions[user];
 
			if (account) {
 
				purple_account_set_alias(account, nickname.c_str());
 
				purple_account_set_public_alias(account, nickname.c_str(), NULL, NULL);
 
				gssize size = image.size();
 
				// this will be freed by libpurple
 
				guchar *photo = (guchar *) g_malloc(size * sizeof(guchar));
include/transport/networkplugin.h
Show inline comments
 
@@ -201,7 +201,7 @@ class NetworkPlugin {
 
		/// You should update the VCard in legacy network too.
 
		/// \param user XMPP JID of user for which this event occurs.
 
		/// \param photo Raw photo data.
 
		virtual void handleVCardUpdatedRequest(const std::string &/*user*/, const std::string &/*photo*/) {}
 
		virtual void handleVCardUpdatedRequest(const std::string &/*user*/, const std::string &/*photo*/, const std::string &nickname) {}
 

	
 

	
 
		virtual void handleJoinRoomRequest(const std::string &/*user*/, const std::string &/*room*/, const std::string &/*nickname*/, const std::string &/*pasword*/) {}
src/networkplugin.cpp
Show inline comments
 
@@ -449,7 +449,7 @@ void NetworkPlugin::handleVCardPayload(const std::string &data) {
 
	}
 

	
 
	if (payload.has_photo()) {
 
		handleVCardUpdatedRequest(payload.username(), payload.photo());
 
		handleVCardUpdatedRequest(payload.username(), payload.photo(), payload.nickname());
 
	}
 
	else if (!payload.buddyname().empty()) {
 
		handleVCardRequest(payload.username(), payload.buddyname(), payload.id());
src/networkpluginserver.cpp
Show inline comments
 
@@ -1218,6 +1218,7 @@ void NetworkPluginServer::handleVCardUpdated(User *user, boost::shared_ptr<Swift
 
	vcard.set_buddyname("");
 
	vcard.set_id(0);
 
	vcard.set_photo(&v->getPhoto()[0], v->getPhoto().size());
 
	vcard.set_nickname(v->getNickname());
 

	
 
	std::string message;
 
	vcard.SerializeToString(&message);
0 comments (0 inline, 0 general)