/pidgin/main: dbebc1ee96aa: facebook: use locally defined aliase...

James Geboski <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: dbebc1ee96aa1baa9fdd8285ba4bd497ef3f3b86
Author:	 James Geboski <[email protected]>
Date:	 2016-01-14 17:05 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/dbebc1ee96aa

Description:

facebook: use locally defined aliases in the group chat list

diffstat:

 libpurple/protocols/facebook/facebook.c |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (53 lines):

diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c
+++ b/libpurple/protocols/facebook/facebook.c
@@ -663,13 +663,18 @@ fb_cb_api_thread_create(FbApi *api, FbId
 static void
 fb_cb_api_threads(FbApi *api, GSList *thrds, gpointer data)
 {
+	const gchar *alias;
 	FbApiUser *user;
 	FbData *fata = data;
 	gchar tid[FB_ID_STRMAX];
+	gchar uid[FB_ID_STRMAX];
 	GSList *l;
 	GSList *m;
 	GString *gstr;
 	FbApiThread *thrd;
+	PurpleAccount *acct;
+	PurpleBuddy *bdy;
+	PurpleConnection *gc;
 	PurpleRoomlist *list;
 	PurpleRoomlistRoom *room;
 
@@ -679,6 +684,8 @@ fb_cb_api_threads(FbApi *api, GSList *th
 		return;
 	}
 
+	gc = fb_data_get_connection(fata);
+	acct = purple_connection_get_account(gc);
 	gstr = g_string_new(NULL);
 
 	for (l = thrds; l != NULL; l = l->next) {
@@ -688,12 +695,20 @@ fb_cb_api_threads(FbApi *api, GSList *th
 
 		for (m = thrd->users; m != NULL; m = m->next) {
 			user = m->data;
+			FB_ID_TO_STR(user->uid, uid);
+			bdy = purple_blist_find_buddy(acct, uid);
+
+			if (bdy != NULL) {
+				alias = purple_buddy_get_alias(bdy);
+			} else {
+				alias = user->name;
+			}
 
 			if (gstr->len > 0) {
 				g_string_append(gstr, ", ");
 			}
 
-			g_string_append(gstr, user->name);
+			g_string_append(gstr, alias);
 		}
 
 		room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM,

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.