Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Commit

Permalink
Fix user names not being displayed in group chats
Browse files Browse the repository at this point in the history
Add users to temporary group "Telegram Foreign", to assure that the user
alias is always known to Pidgin. Don't store this group permanently but
drop it when closing.
  • Loading branch information
majn committed Sep 11, 2015
1 parent 0c06c63 commit 1004a40
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tgp-2prpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ void p2tgl_got_chat_left (struct tgl_state *TLS, tgl_peer_id_t chat) {
void p2tgl_got_chat_in (struct tgl_state *TLS, tgl_peer_id_t chat, tgl_peer_id_t who,
const char *message, int flags, time_t when) {
char *name = p2tgl_strdup_id (who);

// Make sure that the participant exists in the blist, so that the correct print name of
// the chat is being displayed by libpurple
connection_data *conn = TLS->ev_base;
PurpleBuddy *buddy = buddy = purple_find_buddy (conn->pa, name);
if (! buddy) {
buddy = purple_buddy_new (conn->pa, name, tgl_peer_get(TLS, who)->print_name);
PurpleGroup *group = purple_find_group ("Telegram Foreign");
if (!group) {
group = purple_group_new ("Telegram Foreign");
purple_blist_add_group (group, NULL);
purple_blist_node_set_flags (&group->node, PURPLE_BLIST_NODE_FLAG_NO_SAVE);
}
purple_blist_add_buddy (buddy, NULL, group, NULL);
purple_blist_node_set_flags (&buddy->node, PURPLE_BLIST_NODE_FLAG_NO_SAVE);
}

serv_got_chat_in (tg_get_conn(TLS), tgl_get_peer_id (chat), name, flags, message, when);

Expand Down

0 comments on commit 1004a40

Please sign in to comment.