Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Version 3 (modified by rlaager, 15 years ago) (diff)

--

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?

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. Sadrul proposed _get_local_buddy_alias(). Richard agrees and suggests renaming that to _get_local_alias() in 3.0.0, replacing the currently unused (and newly deprecated) existing _get_local_alias().

(COALESCE is borrowed from SQL to mean "return the first non-NULL item".)

_get_alias_only = COALESCE(alias, server_alias);

NEEDS REVIEW...

Used in OSCAR only:

		./libpurple/protocols/oscar/oscar.c:			aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE);
		./libpurple/protocols/oscar/oscar.c:		aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0);
		./libpurple/protocols/oscar/oscar.c:	if (buddy && (purple_buddy_get_alias_only(buddy)))
		./libpurple/protocols/oscar/oscar.c:		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/oscar/oscar.c:	data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
		./libpurple/protocols/oscar/oscar.c:	data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
		./libpurple/protocols/oscar/oscar.c:			(buddy ? purple_buddy_get_alias_only(buddy) : NULL),
		./libpurple/protocols/oscar/oscar.c:	if (buddy && (purple_buddy_get_alias_only(buddy)))
		./libpurple/protocols/oscar/oscar.c:		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/oscar/oscar.c:	purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL);
		./libpurple/protocols/oscar/oscar.c:	data->nick = g_strdup(purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/oscar/oscar.c:					if (purple_buddy_get_alias_only(buddy))
		./libpurple/protocols/oscar/oscar.c:						nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy));

_get_server_alias = server_alias;

Etan and Richard propose keeping as is.

		./libpurple/plugins/log_reader.c:						} else if ((server_alias = purple_buddy_get_server_alias(buddy))) {
		./libpurple/protocols/msn/msn.c:		if (b->server_alias)
		./libpurple/protocols/msn/msn.c:			char *nicktext = g_markup_escape_text(b->server_alias, -1);
		./libpurple/protocols/sametime/sametime.c:	  mwSametimeUser_setShortName(stu, bdy->server_alias);
		./libpurple/protocols/sametime/sametime.c:    if(b->server_alias) {
		./libpurple/protocols/sametime/sametime.c:		purple_notify_user_info_add_pair(user_info, _("Full Name"), b->server_alias);
		./libpurple/protocols/msnp9/msn.c:		if (b->server_alias)
		./libpurple/protocols/msnp9/msn.c:			char *nicktext = g_markup_escape_text(b->server_alias, -1);
		./libpurple/server.c:		if((b->server_alias == NULL && alias == NULL) ||
		./libpurple/server.c:		    (b->server_alias && alias && !strcmp(b->server_alias, alias)))
		./pidgin/gtkblist.c:		if (full && b->server_alias != NULL && b->server_alias[0] != '\0')
		./pidgin/gtkblist.c:			tmp = g_markup_escape_text(b->server_alias, -1);

_get_contact_alias = COALESCE(alias, parent->alias, server_alias, name);

Etan and Richard propose renaming to _get_display_name().

Used in various places:

		./finch/gntblist.c:		name = purple_buddy_get_contact_alias((PurpleBuddy*)node);
		./finch/gntconv.c:			who = purple_buddy_get_contact_alias(buddy);
		./finch/plugins/gnthistory.c:			alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data);
		./finch/plugins/gnthistory.c:				alias = purple_buddy_get_contact_alias((PurpleBuddy *)node);
		./finch/gntlog.c:				name = purple_buddy_get_contact_alias(buddy);
		./finch/gntlog.c:		name = purple_buddy_get_contact_alias(purple_contact_get_priority_buddy(contact));
		./finch/gntlog.c:			name = purple_buddy_get_contact_alias((PurpleBuddy *)child);
		./libpurple/conversation.c:			text = purple_buddy_get_contact_alias(b);
		./libpurple/conversation.c:				else if (b != NULL && strcmp(b->name, purple_buddy_get_contact_alias(b)))
		./libpurple/conversation.c:					alias = purple_buddy_get_contact_alias(b);
		./libpurple/conversation.c:					alias = purple_buddy_get_contact_alias(b);
		./libpurple/conversation.c:					alias = purple_buddy_get_contact_alias(buddy);
		./libpurple/conversation.c:			new_alias = purple_buddy_get_contact_alias(buddy);
		./libpurple/conversation.c:					old_alias = purple_buddy_get_contact_alias(buddy);
		./libpurple/conversation.c:					new_alias = purple_buddy_get_contact_alias(buddy);
		./libpurple/conversation.c:					alias = purple_buddy_get_contact_alias(buddy);
		./libpurple/protocols/msn/userlist.c: 				buddy ? purple_buddy_get_contact_alias(buddy) : passport);
		./libpurple/protocols/msn/userlist.c:				buddy ? purple_buddy_get_contact_alias(buddy) : passport);
		./libpurple/protocols/sametime/sametime.c:  if(buddy) who = (char *) purple_buddy_get_contact_alias(buddy);
		./libpurple/protocols/msnp9/userlist.c: 				buddy ? purple_buddy_get_contact_alias(buddy) : passport);
		./libpurple/protocols/msnp9/userlist.c:				buddy ? purple_buddy_get_contact_alias(buddy) : passport);
		./libpurple/prpl.c:		alias = purple_buddy_get_contact_alias(buddy);
		./libpurple/prpl.c:		alias = purple_buddy_get_contact_alias(buddy);
		./pidgin/gtkconv.c:		name = purple_buddy_get_contact_alias(buddy);
		./pidgin/gtkconv.c:					alias = purple_buddy_get_contact_alias(buddy2);
		./pidgin/gtkconv.c:		text = purple_buddy_get_contact_alias(buddy);
		./pidgin/gtklog.c:			name = purple_buddy_get_contact_alias(buddy);
		./pidgin/gtklog.c:			name = purple_buddy_get_contact_alias(buddy);
		./pidgin/gtklog.c:		name = purple_buddy_get_contact_alias(contact->priority);
		./pidgin/gtklog.c:			name = purple_buddy_get_contact_alias((PurpleBuddy *) contact->node.child);
		./pidgin/gtkutils.c:														purple_buddy_get_contact_alias(entry.entry.buddy),
		./pidgin/gtkwhiteboard.c:	window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : wb->who, 0, NULL, FALSE);
		./pidgin/plugins/history.c:			alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data);
		./pidgin/plugins/history.c:				alias = purple_buddy_get_contact_alias((PurpleBuddy *)node);

_get_local_alias = COALESCE(alias, parent->alias, name);

Unused, so deprecated just now on im.pidgin.pidgin.next.minor for 2.6.0. Richard proposes that, for 3.0.0, this return !PurpleBuddy::alias.

_get_alias = COALESCE(alias, server_alias, parent->alias, name);

NEEDS REVIEW... Why use this over _get_contact_alias? In other words, why prefer the server_alias over the contact's alias here?

Used all over the place:

		./finch/gntaccount.c:		gnt_entry_set_text(GNT_ENTRY(entry), purple_account_get_alias(account));
		./finch/gntblist.c:		name = purple_buddy_get_alias(buddy);
		./finch/gntblist.c:		name = purple_contact_get_alias((PurpleContact*)node);
		./finch/gntblist.c:		name = purple_contact_get_alias(c);
		./finch/gntblist.c:		title = g_strdup(purple_contact_get_alias((PurpleContact*)node));
		./finch/gntblist.c:	const char *alias = purple_buddy_get_alias(buddy);
		./finch/gntblist.c:			s1 = purple_contact_get_alias((PurpleContact*)n1);
		./finch/gntblist.c:			s2 = purple_contact_get_alias((PurpleContact*)n2);
		./finch/gntconv.c:			who = purple_account_get_alias(account);
		./finch/gntpounce.c:		alias = purple_buddy_get_alias(buddy);
		./finch/gntpounce.c:		if ((name_shown = purple_account_get_alias(account)) == NULL)
		./finch/plugins/gntgf.c:		notify(NULL, _("%s just signed on"), purple_buddy_get_alias(buddy));
		./finch/plugins/gntgf.c:		notify(NULL, _("%s just signed off"), purple_buddy_get_alias(buddy));
		./finch/gntlog.c:	name = purple_contact_get_alias(contact);
		./libpurple/account.c:	if ((tmp = purple_account_get_alias(account)) != NULL)
		./libpurple/account.c:purple_account_get_alias(const PurpleAccount *account)
		./libpurple/conversation.c:				if (purple_account_get_alias(account) != NULL)
		./libpurple/conversation.c:				const char *alias2 = purple_account_get_alias(conv->account);
		./libpurple/conversation.c:			alias = purple_account_get_alias(conv->account);
		./libpurple/ft.c:						  buddy ? purple_buddy_get_alias(buddy) : xfer->who,
		./libpurple/ft.c:						buddy ? purple_buddy_get_alias(buddy) : xfer->who);
		./libpurple/ft.c:				  buddy ? purple_buddy_get_alias(buddy) : xfer->who);
		./libpurple/ft.c:				buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer));
		./libpurple/ft.c:				utf8, buddy ? purple_buddy_get_alias(buddy) : xfer->who);
		./libpurple/ft.c:				xfer->filename, buddy ? purple_buddy_get_alias(buddy) : xfer->who);
		./libpurple/ft.c:				buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer));
		./libpurple/ft.c:				buddy ? purple_buddy_get_alias(buddy) : xfer->who);
		./libpurple/ft.c:			who = purple_buddy_get_alias(buddy);
		./libpurple/plugins/autoaccept.c:					purple_contact_get_alias((PurpleContact *)node));
		./libpurple/plugins/autoaccept.c:						NULL, purple_contact_get_alias((PurpleContact *)node), NULL,
		./libpurple/plugins/log_reader.c:					their_name = purple_buddy_get_alias(buddy);
		./libpurple/plugins/log_reader.c:						char *alias = g_strdup(purple_buddy_get_alias(buddy));
		./libpurple/plugins/log_reader.c:						alias = purple_buddy_get_alias(buddy);
		./libpurple/plugins/log_reader.c:						alias = purple_buddy_get_alias(buddy);
		./libpurple/plugins/log_reader.c:					const char *alias = purple_buddy_get_alias(buddy);
		./libpurple/plugins/log_reader.c:					acct_name = purple_account_get_alias(log->account);
		./libpurple/plugins/log_reader.c:						    (alias = purple_buddy_get_alias(buddy)))
		./libpurple/plugins/log_reader.c:						acct_name = purple_account_get_alias(log->account);
		./libpurple/plugins/mono/loader/blist-glue.c:	ml_set_prop_string(obj, "Alias", (char*)purple_buddy_get_alias(buddy));
		./libpurple/plugins/signals-test.c:					old, purple_account_get_alias(account));
		./libpurple/plugins/signals-test.c:		                  purple_contact_get_alias(p), old_alias);
		./libpurple/plugins/signals-test.c:		                  purple_contact_get_alias(p));
		./libpurple/plugins/statenotify.c:	who = purple_buddy_get_alias(buddy);
		./libpurple/plugins/tcl/tcl_cmds.c:		alias = purple_account_get_alias(account);
		./libpurple/plugins/tcl/tcl_cmds.c:                                         Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1));
		./libpurple/protocols/gg/buddylist.c:				alias = purple_buddy_get_alias(buddy);
		./libpurple/protocols/gg/gg-utils.c:		return g_strdup(purple_buddy_get_alias(buddy));
		./libpurple/protocols/gg/gg.c:			      purple_buddy_get_alias(buddy));
		./libpurple/protocols/jabber/jabber.c:													purple_account_get_alias(js->gc->account), FALSE);
		./libpurple/protocols/jabber/message.c:					who = purple_buddy_get_alias(buddy);
		./libpurple/protocols/jabber/message.c:		username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
		./libpurple/protocols/msn/msn.c:	if ((alias = purple_account_get_alias(buddy->account)) == NULL)
		./libpurple/protocols/msn/notification.c:			username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
		./libpurple/protocols/novell/novell.c:		alias = purple_account_get_alias(user->client_data);
		./libpurple/protocols/novell/novell.c:		alias = purple_buddy_get_alias(buddy);
		./libpurple/protocols/novell/novell.c:					name = purple_account_get_alias(user->client_data);
		./libpurple/protocols/novell/novell.c:	alias = purple_buddy_get_alias(buddy);
		./libpurple/protocols/oscar/oscar.c:			aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE);
		./libpurple/protocols/oscar/oscar.c:		alias = purple_buddy_get_alias(buddy);
		./libpurple/protocols/oscar/oscar.c:		aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0);
		./libpurple/protocols/oscar/oscar.c:	if (buddy && (purple_buddy_get_alias_only(buddy)))
		./libpurple/protocols/oscar/oscar.c:		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/oscar/oscar.c:	data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
		./libpurple/protocols/oscar/oscar.c:	data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL);
		./libpurple/protocols/oscar/oscar.c:			(buddy ? purple_buddy_get_alias_only(buddy) : NULL),
		./libpurple/protocols/oscar/oscar.c:	if (buddy && (purple_buddy_get_alias_only(buddy)))
		./libpurple/protocols/oscar/oscar.c:		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/oscar/oscar.c:	purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL);
		./libpurple/protocols/oscar/oscar.c:	data->nick = g_strdup(purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/oscar/oscar.c:					if (purple_buddy_get_alias_only(buddy))
		./libpurple/protocols/oscar/oscar.c:						nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy));
		./libpurple/protocols/yahoo/yahoo_aliases.c:					const char *buddy_alias = purple_buddy_get_alias(b);
		./libpurple/protocols/yahoo/yahoo_aliases.c:	cb->id = g_strdup(yahoo_friend_get_alias_id(f));
		./libpurple/protocols/yahoo/yahoo_friend.c:const char *yahoo_friend_get_alias_id(YahooFriend *f)
		./libpurple/status.c:		const char *buddy_alias = purple_buddy_get_alias(buddy);
		./libpurple/status.c:				purple_buddy_get_alias(buddy));
		./libpurple/status.c:				purple_buddy_get_alias(buddy), current_time, tmp2);
		./libpurple/status.c:				purple_buddy_get_alias(buddy));
		./libpurple/status.c:				purple_buddy_get_alias(buddy), current_time, tmp2);
		./pidgin/gtkaccount.c:		if (purple_account_get_alias(dialog->account))
		./pidgin/gtkaccount.c:							   purple_account_get_alias(dialog->account));
		./pidgin/gtkblist.c:		text = purple_contact_get_alias((PurpleContact *)node);
		./pidgin/gtkblist.c:		text = purple_buddy_get_alias((PurpleBuddy *)node);
		./pidgin/gtkblist.c:		node_alias = g_utf8_casefold(purple_contact_get_alias((PurpleContact *)contact), -1);
		./pidgin/gtkblist.c:			node_alias = g_utf8_casefold(purple_buddy_get_alias((PurpleBuddy *)buddy), -1);
		./pidgin/gtkblist.c:		name = purple_buddy_get_alias(b);
		./pidgin/gtkblist.c:			mark = g_markup_escape_text(purple_contact_get_alias(contact), -1);
		./pidgin/gtkblist.c:		my_name = purple_contact_get_alias((PurpleContact*)node);
		./pidgin/gtkblist.c:			this_name = purple_contact_get_alias((PurpleContact*)n);
		./pidgin/gtkblist.c:			purple_contact_get_alias(purple_buddy_get_contact(my_buddy)),
		./pidgin/gtkblist.c:			 ? purple_contact_get_alias(purple_buddy_get_contact(this_buddy))
		./pidgin/gtkblist.c:		buddy_name = purple_contact_get_alias((PurpleContact*)node);
		./pidgin/gtkblist.c:			this_buddy_name = purple_contact_get_alias((PurpleContact*)n);
		./pidgin/gtkdialogs.c:					   NULL, purple_contact_get_alias(contact), NULL,
		./pidgin/gtkdialogs.c:				NULL, purple_contact_get_alias(contact), NULL,
		./pidgin/gtkpounce.c:		alias = purple_buddy_get_alias(buddy);
		./pidgin/gtkpounce.c:		if ((name_shown = purple_account_get_alias(account)) == NULL)
		./pidgin/gtkutils.c:		if (purple_account_get_alias(account)) {
		./pidgin/gtkutils.c:					   purple_account_get_alias(account),
		./pidgin/plugins/ticker/ticker.c:	td->label = gtk_label_new(purple_contact_get_alias(contact));
		./pidgin/plugins/ticker/ticker.c:		gtk_label_set_text(GTK_LABEL(td->label), purple_contact_get_alias(contact));
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!