| 1 | Currently, libpurple has a number of functions (in blist.h) that take a !PurpleBuddy and return some string based on one or more aliases. Some differ only slightly. Is it necessary to have all of these functions? |
| 2 | |
| 3 | This came up because we almost certainly need to add some function to return !PurpleBuddy::alias only. The names we were picking clashed with the existing functions: |
| 4 | |
| 5 | (COALESCE is borrowed from SQL to mean "return the first non-NULL item".) |
| 6 | |
| 7 | _get_alias_only = COALESCE(alias, server_alias); |
| 8 | NEEDS REVIEW... |
| 9 | |
| 10 | Used in OSCAR only: |
| 11 | {{{ |
| 12 | ./libpurple/protocols/oscar/oscar.c: aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); |
| 13 | ./libpurple/protocols/oscar/oscar.c: aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); |
| 14 | ./libpurple/protocols/oscar/oscar.c: if (buddy && (purple_buddy_get_alias_only(buddy))) |
| 15 | ./libpurple/protocols/oscar/oscar.c: nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy)); |
| 16 | ./libpurple/protocols/oscar/oscar.c: data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); |
| 17 | ./libpurple/protocols/oscar/oscar.c: data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); |
| 18 | ./libpurple/protocols/oscar/oscar.c: (buddy ? purple_buddy_get_alias_only(buddy) : NULL), |
| 19 | ./libpurple/protocols/oscar/oscar.c: if (buddy && (purple_buddy_get_alias_only(buddy))) |
| 20 | ./libpurple/protocols/oscar/oscar.c: nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy)); |
| 21 | ./libpurple/protocols/oscar/oscar.c: purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL); |
| 22 | ./libpurple/protocols/oscar/oscar.c: data->nick = g_strdup(purple_buddy_get_alias_only(buddy)); |
| 23 | ./libpurple/protocols/oscar/oscar.c: if (purple_buddy_get_alias_only(buddy)) |
| 24 | ./libpurple/protocols/oscar/oscar.c: nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy)); |
| 25 | |
| 26 | _get_server_alias = server_alias; |
| 27 | Etan and Richard propose keeping as is. |
| 28 | ./libpurple/plugins/log_reader.c: } else if ((server_alias = purple_buddy_get_server_alias(buddy))) { |
| 29 | ./libpurple/protocols/msn/msn.c: if (b->server_alias) |
| 30 | ./libpurple/protocols/msn/msn.c: char *nicktext = g_markup_escape_text(b->server_alias, -1); |
| 31 | ./libpurple/protocols/sametime/sametime.c: mwSametimeUser_setShortName(stu, bdy->server_alias); |
| 32 | ./libpurple/protocols/sametime/sametime.c: if(b->server_alias) { |
| 33 | ./libpurple/protocols/sametime/sametime.c: purple_notify_user_info_add_pair(user_info, _("Full Name"), b->server_alias); |
| 34 | ./libpurple/protocols/msnp9/msn.c: if (b->server_alias) |
| 35 | ./libpurple/protocols/msnp9/msn.c: char *nicktext = g_markup_escape_text(b->server_alias, -1); |
| 36 | ./libpurple/server.c: if((b->server_alias == NULL && alias == NULL) || |
| 37 | ./libpurple/server.c: (b->server_alias && alias && !strcmp(b->server_alias, alias))) |
| 38 | ./pidgin/gtkblist.c: if (full && b->server_alias != NULL && b->server_alias[0] != '\0') |
| 39 | ./pidgin/gtkblist.c: tmp = g_markup_escape_text(b->server_alias, -1); |
| 40 | }}} |
| 41 | |
| 42 | _get_contact_alias = COALESCE(alias, parent->alias, server_alias, name); |
| 43 | Etan and Richard propose renaming to _get_display_name(). |
| 44 | |
| 45 | Used in various places: |
| 46 | {{{ |
| 47 | ./finch/gntblist.c: name = purple_buddy_get_contact_alias((PurpleBuddy*)node); |
| 48 | ./finch/gntconv.c: who = purple_buddy_get_contact_alias(buddy); |
| 49 | ./finch/plugins/gnthistory.c: alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data); |
| 50 | ./finch/plugins/gnthistory.c: alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); |
| 51 | ./finch/gntlog.c: name = purple_buddy_get_contact_alias(buddy); |
| 52 | ./finch/gntlog.c: name = purple_buddy_get_contact_alias(purple_contact_get_priority_buddy(contact)); |
| 53 | ./finch/gntlog.c: name = purple_buddy_get_contact_alias((PurpleBuddy *)child); |
| 54 | ./libpurple/conversation.c: text = purple_buddy_get_contact_alias(b); |
| 55 | ./libpurple/conversation.c: else if (b != NULL && strcmp(b->name, purple_buddy_get_contact_alias(b))) |
| 56 | ./libpurple/conversation.c: alias = purple_buddy_get_contact_alias(b); |
| 57 | ./libpurple/conversation.c: alias = purple_buddy_get_contact_alias(b); |
| 58 | ./libpurple/conversation.c: alias = purple_buddy_get_contact_alias(buddy); |
| 59 | ./libpurple/conversation.c: new_alias = purple_buddy_get_contact_alias(buddy); |
| 60 | ./libpurple/conversation.c: old_alias = purple_buddy_get_contact_alias(buddy); |
| 61 | ./libpurple/conversation.c: new_alias = purple_buddy_get_contact_alias(buddy); |
| 62 | ./libpurple/conversation.c: alias = purple_buddy_get_contact_alias(buddy); |
| 63 | ./libpurple/protocols/msn/userlist.c: buddy ? purple_buddy_get_contact_alias(buddy) : passport); |
| 64 | ./libpurple/protocols/msn/userlist.c: buddy ? purple_buddy_get_contact_alias(buddy) : passport); |
| 65 | ./libpurple/protocols/sametime/sametime.c: if(buddy) who = (char *) purple_buddy_get_contact_alias(buddy); |
| 66 | ./libpurple/protocols/msnp9/userlist.c: buddy ? purple_buddy_get_contact_alias(buddy) : passport); |
| 67 | ./libpurple/protocols/msnp9/userlist.c: buddy ? purple_buddy_get_contact_alias(buddy) : passport); |
| 68 | ./libpurple/prpl.c: alias = purple_buddy_get_contact_alias(buddy); |
| 69 | ./libpurple/prpl.c: alias = purple_buddy_get_contact_alias(buddy); |
| 70 | ./pidgin/gtkconv.c: name = purple_buddy_get_contact_alias(buddy); |
| 71 | ./pidgin/gtkconv.c: alias = purple_buddy_get_contact_alias(buddy2); |
| 72 | ./pidgin/gtkconv.c: text = purple_buddy_get_contact_alias(buddy); |
| 73 | ./pidgin/gtklog.c: name = purple_buddy_get_contact_alias(buddy); |
| 74 | ./pidgin/gtklog.c: name = purple_buddy_get_contact_alias(buddy); |
| 75 | ./pidgin/gtklog.c: name = purple_buddy_get_contact_alias(contact->priority); |
| 76 | ./pidgin/gtklog.c: name = purple_buddy_get_contact_alias((PurpleBuddy *) contact->node.child); |
| 77 | ./pidgin/gtkutils.c: purple_buddy_get_contact_alias(entry.entry.buddy), |
| 78 | ./pidgin/gtkwhiteboard.c: window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : wb->who, 0, NULL, FALSE); |
| 79 | ./pidgin/plugins/history.c: alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data); |
| 80 | ./pidgin/plugins/history.c: alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); |
| 81 | }}} |
| 82 | |
| 83 | _get_local_alias = COALESCE(alias, parent->alias, name); |
| 84 | Unused, so deprecated just now on im.pidgin.pidgin.next.minor for 2.6.0. |
| 85 | |
| 86 | _get_alias = COALESCE(alias, server_alias, parent->alias, name); |
| 87 | NEEDS REVIEW... Why use this over _get_contact_alias? In other words, |
| 88 | why prefer the server_alias over the contact's alias here? |
| 89 | |
| 90 | Used all over the place: |
| 91 | {{{ |
| 92 | ./finch/gntaccount.c: gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_alias(account)); |
| 93 | ./finch/gntblist.c: name = purple_buddy_get_alias(buddy); |
| 94 | ./finch/gntblist.c: name = purple_contact_get_alias((PurpleContact*)node); |
| 95 | ./finch/gntblist.c: name = purple_contact_get_alias(c); |
| 96 | ./finch/gntblist.c: title = g_strdup(purple_contact_get_alias((PurpleContact*)node)); |
| 97 | ./finch/gntblist.c: const char *alias = purple_buddy_get_alias(buddy); |
| 98 | ./finch/gntblist.c: s1 = purple_contact_get_alias((PurpleContact*)n1); |
| 99 | ./finch/gntblist.c: s2 = purple_contact_get_alias((PurpleContact*)n2); |
| 100 | ./finch/gntconv.c: who = purple_account_get_alias(account); |
| 101 | ./finch/gntpounce.c: alias = purple_buddy_get_alias(buddy); |
| 102 | ./finch/gntpounce.c: if ((name_shown = purple_account_get_alias(account)) == NULL) |
| 103 | ./finch/plugins/gntgf.c: notify(NULL, _("%s just signed on"), purple_buddy_get_alias(buddy)); |
| 104 | ./finch/plugins/gntgf.c: notify(NULL, _("%s just signed off"), purple_buddy_get_alias(buddy)); |
| 105 | ./finch/gntlog.c: name = purple_contact_get_alias(contact); |
| 106 | ./libpurple/account.c: if ((tmp = purple_account_get_alias(account)) != NULL) |
| 107 | ./libpurple/account.c:purple_account_get_alias(const PurpleAccount *account) |
| 108 | ./libpurple/conversation.c: if (purple_account_get_alias(account) != NULL) |
| 109 | ./libpurple/conversation.c: const char *alias2 = purple_account_get_alias(conv->account); |
| 110 | ./libpurple/conversation.c: alias = purple_account_get_alias(conv->account); |
| 111 | ./libpurple/ft.c: buddy ? purple_buddy_get_alias(buddy) : xfer->who, |
| 112 | ./libpurple/ft.c: buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
| 113 | ./libpurple/ft.c: buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
| 114 | ./libpurple/ft.c: buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer)); |
| 115 | ./libpurple/ft.c: utf8, buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
| 116 | ./libpurple/ft.c: xfer->filename, buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
| 117 | ./libpurple/ft.c: buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer)); |
| 118 | ./libpurple/ft.c: buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
| 119 | ./libpurple/ft.c: who = purple_buddy_get_alias(buddy); |
| 120 | ./libpurple/plugins/autoaccept.c: purple_contact_get_alias((PurpleContact *)node)); |
| 121 | ./libpurple/plugins/autoaccept.c: NULL, purple_contact_get_alias((PurpleContact *)node), NULL, |
| 122 | ./libpurple/plugins/log_reader.c: their_name = purple_buddy_get_alias(buddy); |
| 123 | ./libpurple/plugins/log_reader.c: char *alias = g_strdup(purple_buddy_get_alias(buddy)); |
| 124 | ./libpurple/plugins/log_reader.c: alias = purple_buddy_get_alias(buddy); |
| 125 | ./libpurple/plugins/log_reader.c: alias = purple_buddy_get_alias(buddy); |
| 126 | ./libpurple/plugins/log_reader.c: const char *alias = purple_buddy_get_alias(buddy); |
| 127 | ./libpurple/plugins/log_reader.c: acct_name = purple_account_get_alias(log->account); |
| 128 | ./libpurple/plugins/log_reader.c: (alias = purple_buddy_get_alias(buddy))) |
| 129 | ./libpurple/plugins/log_reader.c: acct_name = purple_account_get_alias(log->account); |
| 130 | ./libpurple/plugins/mono/loader/blist-glue.c: ml_set_prop_string(obj, "Alias", (char*)purple_buddy_get_alias(buddy)); |
| 131 | ./libpurple/plugins/signals-test.c: old, purple_account_get_alias(account)); |
| 132 | ./libpurple/plugins/signals-test.c: purple_contact_get_alias(p), old_alias); |
| 133 | ./libpurple/plugins/signals-test.c: purple_contact_get_alias(p)); |
| 134 | ./libpurple/plugins/statenotify.c: who = purple_buddy_get_alias(buddy); |
| 135 | ./libpurple/plugins/tcl/tcl_cmds.c: alias = purple_account_get_alias(account); |
| 136 | ./libpurple/plugins/tcl/tcl_cmds.c: Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1)); |
| 137 | ./libpurple/protocols/gg/buddylist.c: alias = purple_buddy_get_alias(buddy); |
| 138 | ./libpurple/protocols/gg/gg-utils.c: return g_strdup(purple_buddy_get_alias(buddy)); |
| 139 | ./libpurple/protocols/gg/gg.c: purple_buddy_get_alias(buddy)); |
| 140 | ./libpurple/protocols/jabber/jabber.c: purple_account_get_alias(js->gc->account), FALSE); |
| 141 | ./libpurple/protocols/jabber/message.c: who = purple_buddy_get_alias(buddy); |
| 142 | ./libpurple/protocols/jabber/message.c: username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1); |
| 143 | ./libpurple/protocols/msn/msn.c: if ((alias = purple_account_get_alias(buddy->account)) == NULL) |
| 144 | ./libpurple/protocols/msn/notification.c: username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1); |
| 145 | ./libpurple/protocols/novell/novell.c: alias = purple_account_get_alias(user->client_data); |
| 146 | ./libpurple/protocols/novell/novell.c: alias = purple_buddy_get_alias(buddy); |
| 147 | ./libpurple/protocols/novell/novell.c: name = purple_account_get_alias(user->client_data); |
| 148 | ./libpurple/protocols/novell/novell.c: alias = purple_buddy_get_alias(buddy); |
| 149 | ./libpurple/protocols/oscar/oscar.c: aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); |
| 150 | ./libpurple/protocols/oscar/oscar.c: alias = purple_buddy_get_alias(buddy); |
| 151 | ./libpurple/protocols/oscar/oscar.c: aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); |
| 152 | ./libpurple/protocols/oscar/oscar.c: if (buddy && (purple_buddy_get_alias_only(buddy))) |
| 153 | ./libpurple/protocols/oscar/oscar.c: nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy)); |
| 154 | ./libpurple/protocols/oscar/oscar.c: data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); |
| 155 | ./libpurple/protocols/oscar/oscar.c: data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); |
| 156 | ./libpurple/protocols/oscar/oscar.c: (buddy ? purple_buddy_get_alias_only(buddy) : NULL), |
| 157 | ./libpurple/protocols/oscar/oscar.c: if (buddy && (purple_buddy_get_alias_only(buddy))) |
| 158 | ./libpurple/protocols/oscar/oscar.c: nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy)); |
| 159 | ./libpurple/protocols/oscar/oscar.c: purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL); |
| 160 | ./libpurple/protocols/oscar/oscar.c: data->nick = g_strdup(purple_buddy_get_alias_only(buddy)); |
| 161 | ./libpurple/protocols/oscar/oscar.c: if (purple_buddy_get_alias_only(buddy)) |
| 162 | ./libpurple/protocols/oscar/oscar.c: nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy)); |
| 163 | ./libpurple/protocols/yahoo/yahoo_aliases.c: const char *buddy_alias = purple_buddy_get_alias(b); |
| 164 | ./libpurple/protocols/yahoo/yahoo_aliases.c: cb->id = g_strdup(yahoo_friend_get_alias_id(f)); |
| 165 | ./libpurple/protocols/yahoo/yahoo_friend.c:const char *yahoo_friend_get_alias_id(YahooFriend *f) |
| 166 | ./libpurple/status.c: const char *buddy_alias = purple_buddy_get_alias(buddy); |
| 167 | ./libpurple/status.c: purple_buddy_get_alias(buddy)); |
| 168 | ./libpurple/status.c: purple_buddy_get_alias(buddy), current_time, tmp2); |
| 169 | ./libpurple/status.c: purple_buddy_get_alias(buddy)); |
| 170 | ./libpurple/status.c: purple_buddy_get_alias(buddy), current_time, tmp2); |
| 171 | ./pidgin/gtkaccount.c: if (purple_account_get_alias(dialog->account)) |
| 172 | ./pidgin/gtkaccount.c: purple_account_get_alias(dialog->account)); |
| 173 | ./pidgin/gtkblist.c: text = purple_contact_get_alias((PurpleContact *)node); |
| 174 | ./pidgin/gtkblist.c: text = purple_buddy_get_alias((PurpleBuddy *)node); |
| 175 | ./pidgin/gtkblist.c: node_alias = g_utf8_casefold(purple_contact_get_alias((PurpleContact *)contact), -1); |
| 176 | ./pidgin/gtkblist.c: node_alias = g_utf8_casefold(purple_buddy_get_alias((PurpleBuddy *)buddy), -1); |
| 177 | ./pidgin/gtkblist.c: name = purple_buddy_get_alias(b); |
| 178 | ./pidgin/gtkblist.c: mark = g_markup_escape_text(purple_contact_get_alias(contact), -1); |
| 179 | ./pidgin/gtkblist.c: my_name = purple_contact_get_alias((PurpleContact*)node); |
| 180 | ./pidgin/gtkblist.c: this_name = purple_contact_get_alias((PurpleContact*)n); |
| 181 | ./pidgin/gtkblist.c: purple_contact_get_alias(purple_buddy_get_contact(my_buddy)), |
| 182 | ./pidgin/gtkblist.c: ? purple_contact_get_alias(purple_buddy_get_contact(this_buddy)) |
| 183 | ./pidgin/gtkblist.c: buddy_name = purple_contact_get_alias((PurpleContact*)node); |
| 184 | ./pidgin/gtkblist.c: this_buddy_name = purple_contact_get_alias((PurpleContact*)n); |
| 185 | ./pidgin/gtkdialogs.c: NULL, purple_contact_get_alias(contact), NULL, |
| 186 | ./pidgin/gtkdialogs.c: NULL, purple_contact_get_alias(contact), NULL, |
| 187 | ./pidgin/gtkpounce.c: alias = purple_buddy_get_alias(buddy); |
| 188 | ./pidgin/gtkpounce.c: if ((name_shown = purple_account_get_alias(account)) == NULL) |
| 189 | ./pidgin/gtkutils.c: if (purple_account_get_alias(account)) { |
| 190 | ./pidgin/gtkutils.c: purple_account_get_alias(account), |
| 191 | ./pidgin/plugins/ticker/ticker.c: td->label = gtk_label_new(purple_contact_get_alias(contact)); |
| 192 | ./pidgin/plugins/ticker/ticker.c: gtk_label_set_text(GTK_LABEL(td->label), purple_contact_get_alias(contact)); |
| 193 | }}} |