comparison libpurple/account.c @ 29499:94f85ba7e5a9

This effectively moves Etan's API addition off im.pidgin.pidgin and onto im.pidgin.pidgin.next.minor so we don't force a 2.7.0 too soon. *** Plucked rev f7d26d95395d5013710b12cfdfcf131aa1033e0c (deryni@pidgin.im): Add a purple_account_get_name_for_display function (I'm not a huge fan of that name but didn't want to use get_display_name as that means something else for connections). This wants to be used in places where we need to display an identifier for the account to the user and honor the appropriate aliases/etc. Refs #8391
author John Bailey <rekkanoryo@rekkanoryo.org>
date Wed, 16 Sep 2009 15:44:26 +0000
parents 3896cbf6336a
children 339cb6c7f0fd
comparison
equal deleted inserted replaced
29498:df24cbb0d6e2 29499:94f85ba7e5a9
2017 g_return_val_if_fail(account != NULL, NULL); 2017 g_return_val_if_fail(account != NULL, NULL);
2018 2018
2019 return account->gc; 2019 return account->gc;
2020 } 2020 }
2021 2021
2022 const gchar *
2023 purple_account_get_name_for_display(const PurpleAccount *account)
2024 {
2025 PurpleBuddy *self = NULL;
2026 PurpleConnection *gc = NULL;
2027 const gchar *name = NULL, *username = NULL, *displayname = NULL;
2028
2029 name = purple_account_get_alias(account);
2030
2031 if (name) {
2032 return name;
2033 }
2034
2035 username = purple_account_get_username(account);
2036 self = purple_find_buddy((PurpleAccount *)account, username);
2037
2038 if (self) {
2039 const gchar *calias= purple_buddy_get_contact_alias(self);
2040
2041 /* We don't want to return the buddy name if the buddy/contact
2042 * doesn't have an alias set. */
2043 if (!purple_strequal(username, calias)) {
2044 return calias;
2045 }
2046 }
2047
2048 gc = purple_account_get_connection(account);
2049 displayname = purple_connection_get_display_name(gc);
2050
2051 if (displayname) {
2052 return displayname;
2053 }
2054
2055 return username;
2056 }
2057
2022 gboolean 2058 gboolean
2023 purple_account_get_remember_password(const PurpleAccount *account) 2059 purple_account_get_remember_password(const PurpleAccount *account)
2024 { 2060 {
2025 g_return_val_if_fail(account != NULL, FALSE); 2061 g_return_val_if_fail(account != NULL, FALSE);
2026 2062