From: Nathan W. <fac...@us...> - 2003-10-22 03:04:33
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1:/tmp/cvs-serv6584/src Modified Files: blist.c blist.h gtkblist.c Log Message: Kevin Stange mentioned that we weren't using contact aliases right when sorting, so I fixinated it. Index: blist.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/blist.c,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -p -r1.104 -r1.105 --- blist.c 14 Oct 2003 05:07:37 -0000 1.104 +++ blist.c 22 Oct 2003 02:01:30 -0000 1.105 @@ -106,7 +106,7 @@ static void blist_pref_cb(const char *na } } -static GaimContact *gaim_buddy_get_contact(GaimBuddy *buddy) +GaimContact *gaim_buddy_get_contact(GaimBuddy *buddy) { return (GaimContact*)((GaimBlistNode*)buddy)->parent; } @@ -775,7 +775,13 @@ void gaim_contact_set_alias(GaimContact* const char *gaim_contact_get_alias(GaimContact* contact) { - return contact ? contact->alias : NULL; + if(!contact) + return NULL; + + if(contact->alias) + return contact->alias; + + return gaim_get_buddy_alias(contact->priority); } GaimGroup *gaim_group_new(const char *name) Index: blist.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/blist.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -p -r1.38 -r1.39 --- blist.h 13 Oct 2003 03:48:36 -0000 1.38 +++ blist.h 22 Oct 2003 02:01:30 -0000 1.39 @@ -378,6 +378,15 @@ void gaim_buddy_set_icon(GaimBuddy *budd GaimBuddyIcon *gaim_buddy_get_icon(const GaimBuddy *buddy); /** + * Returns a buddy's contact. + * + * @param buddy The buddy. + * + * @return The buddy's contact. + */ +GaimContact *gaim_buddy_get_contact(GaimBuddy *buddy); + +/** * Adds a new buddy to the buddy list. * * The buddy will be inserted right after node or prepended to the Index: gtkblist.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkblist.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -d -p -r1.116 -r1.117 --- gtkblist.c 20 Oct 2003 14:00:11 -0000 1.116 +++ gtkblist.c 22 Oct 2003 02:01:30 -0000 1.117 @@ -2702,10 +2702,7 @@ static void gaim_gtk_blist_update_contac (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL)); - if(contact->alias) - mark = g_markup_escape_text(contact->alias, -1); - else - mark = g_markup_escape_text(gaim_get_buddy_alias(buddy), -1); + mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1); gtk_tree_store_set(gtkblist->treemodel, &iter, STATUS_ICON_COLUMN, status, @@ -3655,7 +3652,7 @@ static GtkTreeIter sort_method_alphabeti const char *my_name; if(GAIM_BLIST_NODE_IS_CONTACT(node)) { - my_name = gaim_get_buddy_alias(gaim_contact_get_priority_buddy((GaimContact*)node)); + my_name = gaim_contact_get_alias((GaimContact*)node); } else if(GAIM_BLIST_NODE_IS_CHAT(node)) { my_name = gaim_chat_get_name((GaimChat*)node); } else { @@ -3676,7 +3673,7 @@ static GtkTreeIter sort_method_alphabeti n = g_value_get_pointer(&val); if(GAIM_BLIST_NODE_IS_CONTACT(n)) { - this_name = gaim_get_buddy_alias(gaim_contact_get_priority_buddy((GaimContact*)n)); + this_name = gaim_contact_get_alias((GaimContact*)n); } else if(GAIM_BLIST_NODE_IS_CHAT(n)) { this_name = gaim_chat_get_name((GaimChat*)n); } else { @@ -3745,8 +3742,11 @@ static GtkTreeIter sort_method_status(Ga this_buddy = NULL; } - cmp = gaim_utf8_strcasecmp(gaim_get_buddy_alias(my_buddy), - gaim_get_buddy_alias(this_buddy)); + cmp = gaim_utf8_strcasecmp(my_buddy ? + gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy)) + : NULL, this_buddy ? + gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy)) + : NULL); /* Hideous */ if(!this_buddy || @@ -3808,7 +3808,7 @@ static GtkTreeIter sort_method_log(GaimB if(GAIM_BLIST_NODE_IS_CONTACT(node)) { for (n = node->child; n; n = n->next) log_size += get_log_size(((GaimBuddy*)(n))->name); - buddy_name = gaim_get_buddy_alias(gaim_contact_get_priority_buddy((GaimContact*)node)); + buddy_name = gaim_contact_get_alias((GaimContact*)node); } else if(GAIM_BLIST_NODE_IS_CHAT(node)) { /* we don't have a reliable way of getting the log filename * from the chat info in the blist, yet */ @@ -3837,7 +3837,7 @@ static GtkTreeIter sort_method_log(GaimB if(GAIM_BLIST_NODE_IS_CONTACT(n)) { for (n2 = n->child; n2; n2 = n2->next) this_log_size += get_log_size(((GaimBuddy*)(n2))->name); - this_buddy_name = gaim_get_buddy_alias(gaim_contact_get_priority_buddy((GaimContact*)n)); + this_buddy_name = gaim_contact_get_alias((GaimContact*)n); } else { this_buddy_name = NULL; } |