Changeset - 9d50d5870ede
[Not reviewed]
Merge
0 1 0
Jan Kaluza - 12 years ago 2013-01-29 09:43:34
hanzz.k@gmail.com
Merge pull request #23 from vitalyster/vcard_fields

libpurple backend: handle Display name vcard field
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -1080,49 +1080,49 @@ static void *notify_user_info(PurpleConnection *gc, const char *who, PurpleNotif
 
	
 
	GList *vcardEntries = purple_notify_user_info_get_entries_wrapped(user_info);
 
	PurpleNotifyUserInfoEntry *vcardEntry;
 
	std::string firstName;
 
	std::string lastName;
 
	std::string fullName;
 
	std::string nickname;
 
	std::string header;
 
	std::string label;
 
	std::string photo;
 

	
 
	while (vcardEntries) {
 
		vcardEntry = (PurpleNotifyUserInfoEntry *)(vcardEntries->data);
 
		if (purple_notify_user_info_entry_get_label_wrapped(vcardEntry) && purple_notify_user_info_entry_get_value_wrapped(vcardEntry)){
 
			label = purple_notify_user_info_entry_get_label_wrapped(vcardEntry);
 
			if (label == "Given Name" || label == "First Name") {
 
				firstName = purple_notify_user_info_entry_get_value_wrapped(vcardEntry);
 
			}
 
			else if (label == "Family Name" || label == "Last Name") {
 
				lastName = purple_notify_user_info_entry_get_value_wrapped(vcardEntry);
 
			}
 
			else if (label=="Nickname" || label == "Nick") {
 
				nickname = purple_notify_user_info_entry_get_value_wrapped(vcardEntry);
 
			}
 
			else if (label=="Full Name") {
 
			else if (label=="Full Name" || label == "Display name") {
 
				fullName = purple_notify_user_info_entry_get_value_wrapped(vcardEntry);
 
			}
 
			else {
 
				LOG4CXX_WARN(logger, "Unhandled VCard Label '" << purple_notify_user_info_entry_get_label_wrapped(vcardEntry) << "' " << purple_notify_user_info_entry_get_value_wrapped(vcardEntry));
 
			}
 
		}
 
		vcardEntries = vcardEntries->next;
 
	}
 

	
 
	if ((!firstName.empty() || !lastName.empty()) && fullName.empty())
 
		fullName = firstName + " " + lastName;
 

	
 
	if (nickname.empty() && !fullName.empty()) {
 
		nickname = fullName;
 
	}
 

	
 
	bool ownInfo = name == purple_account_get_username_wrapped(account);
 

	
 
	if (ownInfo) {
 
		const gchar *displayname = purple_connection_get_display_name_wrapped(gc);
 
#if PURPLE_MAJOR_VERSION >= 2 && PURPLE_MINOR_VERSION >= 7
 
		if (!displayname) {
 
			displayname = purple_account_get_name_for_display_wrapped(account);
 
		}
0 comments (0 inline, 0 general)