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 6 (modified by sadrul, 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 used here as pseudocode 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/gntblist.c:             name = purple_buddy_get_alias(buddy);
./finch/gntblist.c:     const char *alias = purple_buddy_get_alias(buddy);
./finch/gntpounce.c:            alias = purple_buddy_get_alias(buddy);
./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));
./libpurple/blist.c:    return purple_buddy_get_alias(purple_contact_get_priority_buddy(contact));
./libpurple/blist.c:const char *purple_buddy_get_alias(PurpleBuddy *buddy)
./libpurple/blist.h:const char *purple_buddy_get_alias(PurpleBuddy *buddy);
./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/gaim-compat.h:#define gaim_buddy_get_alias          purple_buddy_get_alias
./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:                                                   (alias = purple_buddy_get_alias(buddy)))
./libpurple/plugins/mono/loader/blist-glue.c:   ml_set_prop_string(obj, "Alias", (char*)purple_buddy_get_alias(buddy));
./libpurple/plugins/perl/common/BuddyList.xs:purple_buddy_get_alias(buddy)
./libpurple/plugins/perl/common/BuddyList.c:    RETVAL = purple_buddy_get_alias(buddy);
./libpurple/plugins/statenotify.c:      who = purple_buddy_get_alias(buddy);
./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/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/notification.c:                       username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
./libpurple/protocols/novell/novell.c:          alias = purple_buddy_get_alias(buddy);
./libpurple/protocols/novell/novell.c:  alias = purple_buddy_get_alias(buddy);
./libpurple/protocols/oscar/oscar.c:            alias = purple_buddy_get_alias(buddy);
./libpurple/protocols/yahoo/yahoo_aliases.c:                                    const char *buddy_alias = purple_buddy_get_alias(b);
./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);
./libpurple/dbus-bindings.c:    if ((RESULT = purple_buddy_get_alias(buddy)) == NULL)
./libpurple/purple-client-bindings.c:char* purple_buddy_get_alias(const PurpleBuddy *buddy) {
./libpurple/purple-client-bindings.h:char* purple_buddy_get_alias(const PurpleBuddy *buddy) ;
./pidgin/gtkblist.c:            text = purple_buddy_get_alias((PurpleBuddy *)node);
./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/gtkpounce.c:           alias = purple_buddy_get_alias(buddy);
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!