interface: fixed output of forwarded messages

This commit is contained in:
V V 2015-09-30 21:06:40 +03:00
parent 8b0ff90800
commit 17fc871f15

View File

@ -3708,15 +3708,23 @@ void print_encr_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C) {
mpop_color (ev); mpop_color (ev);
} }
void print_encr_chat_name_full (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C) { void print_peer_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C) {
assert (tgl_get_peer_type (id) == TGL_PEER_ENCR_CHAT); switch (tgl_get_peer_type (id)) {
mpush_color (ev, COLOR_MAGENTA); case TGL_PEER_USER:
if (!C || use_ids) { print_user_name (ev, id, C);
mprintf (ev, "encr_chat#%d", tgl_get_peer_id (id)); return;
} else { case TGL_PEER_CHAT:
mprintf (ev, "%s", C->print_name); print_chat_name (ev, id, C);
return;
case TGL_PEER_CHANNEL:
print_channel_name (ev, id, C);
return;
case TGL_PEER_ENCR_CHAT:
print_encr_chat_name (ev, id, C);
return;
default:
assert (0);
} }
mpop_color (ev);
} }
static char *monthes[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; static char *monthes[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
@ -3990,9 +3998,9 @@ void print_message (struct in_ev *ev, struct tgl_message *M) {
mprintf (ev, " »»» "); mprintf (ev, " »»» ");
} }
} }
if (tgl_get_peer_type (M->fwd_from_id) == TGL_PEER_USER) { if (tgl_get_peer_type (M->fwd_from_id) > 0) {
mprintf (ev, "[fwd from "); mprintf (ev, "[fwd from ");
print_user_name (ev, M->fwd_from_id, tgl_peer_get (TLS, M->fwd_from_id)); print_peer_name (ev, M->fwd_from_id, tgl_peer_get (TLS, M->fwd_from_id));
mprintf (ev, "] "); mprintf (ev, "] ");
} }
if (M->reply_id) { if (M->reply_id) {