soc.2009.transport: befb4541: Better way how to get nickname

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Mon May 25 20:45:47 EDT 2009


-----------------------------------------------------------------
Revision: befb45413139c04b53e54759941b8b57df5ca962
Ancestor: 72d6ce4d1301c1db42fee04dfe214ca1e5b6f6ff
Author: hanzz at soc.pidgin.im
Date: 2009-05-25T23:59:16
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/befb45413139c04b53e54759941b8b57df5ca962

Modified files:
        user.cpp

ChangeLog: 

Better way how to get nickname

-------------- next part --------------
============================================================
--- user.cpp	525f3a8173bf7c437f31078773c6e19961561b44
+++ user.cpp	9f29f4949be9280d84ddd30435523fbf3977d6e2
@@ -159,7 +159,11 @@ void User::sendRosterX()
 		std::string name(purple_buddy_get_name(buddy));
 		if (!name.empty()){
 			RosterRow user;
-			std::string alias(purple_buddy_get_alias(buddy));
+			std::string alias;                                                                                                                                          
+			if (purple_buddy_get_server_alias(buddy))                                                                                                                   
+				alias = (std::string) purple_buddy_get_server_alias(buddy);
+			else
+				alias = (std::string) purple_buddy_get_alias(buddy);
 			user.id = -1;
 			user.jid = m_jid;
 			user.uin = name;
@@ -213,7 +217,12 @@ Tag *User::generatePresenceStanza(Purple
 Tag *User::generatePresenceStanza(PurpleBuddy *buddy){
 	if (buddy==NULL)
 		return NULL;
-	std::string alias(purple_buddy_get_alias(buddy));
+	std::string alias;
+	if (purple_buddy_get_server_alias(buddy))
+		alias = (std::string) purple_buddy_get_server_alias(buddy);
+	else
+		alias = (std::string) purple_buddy_get_alias(buddy);
+
 	std::string name(purple_buddy_get_name(buddy));
 	PurplePresence *pres = purple_buddy_get_presence(buddy);
 	if (pres==NULL)
@@ -284,7 +293,7 @@ Tag *User::generatePresenceStanza(Purple
 		char *hash = rindex(avatarHash,'/');
 		std::string h;
 		if (hash) {
-			char *dot
+			char *dot;
 			hash++;
 			dot = strchr(hash, '.');
 			if (dot)
@@ -355,7 +364,12 @@ void User::purpleBuddyChanged(PurpleBudd
 void User::purpleBuddyChanged(PurpleBuddy *buddy){
 	if (buddy==NULL)
 		return;
-	std::string alias(purple_buddy_get_alias(buddy));
+	std::string alias;
+	if (purple_buddy_get_server_alias(buddy))
+		alias = (std::string) purple_buddy_get_server_alias(buddy);
+	else
+		alias = (std::string) purple_buddy_get_alias(buddy);
+
 	std::string name(purple_buddy_get_name(buddy));
 	PurplePresence *pres = purple_buddy_get_presence(buddy);
 	if (pres==NULL)


More information about the Commits mailing list