Fix adding foreign buddy

Fix user info and user status not being correctly fetched.
This commit is contained in:
mjentsch 2015-11-18 01:19:40 +01:00
parent b721e8d217
commit 81cf092554
2 changed files with 4 additions and 1 deletions

View file

@ -732,9 +732,11 @@ static void tgprpl_set_status (PurpleAccount *acct, PurpleStatus *status) {
}
static void tgprpl_add_buddy (PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
tgl_peer_t *peer = tgp_blist_buddy_get_peer (buddy);
tgl_peer_t *peer = tgl_peer_get_by_name (gc_get_conn(gc)->TLS, buddy->name);
if (peer) {
_update_buddy (gc_get_conn (gc)->TLS, peer, TGL_UPDATE_PHOTO);
tgp_blist_buddy_set_id (buddy, peer->id);
p2tgl_prpl_got_user_status (gc_get_conn(gc)->TLS, peer->id, &peer->user.status);
}
}

View file

@ -95,6 +95,7 @@ tgl_peer_id_t tgp_blist_buddy_get_id (PurpleBuddy *buddy) {
tgl_peer_t *tgp_blist_buddy_get_peer (PurpleBuddy *buddy) {
if (! tgp_blist_buddy_has_id (buddy)) {
g_warn_if_reached();
return NULL;
}
return tgl_peer_get (pbn_get_conn (&buddy->node)->TLS, tgp_blist_buddy_get_id (buddy));