From 09d89efdb0c5e373fd1ce3c761bcb3f93d81efa0 Mon Sep 17 00:00:00 2001 From: V V Date: Fri, 16 Oct 2015 15:54:08 +0300 Subject: [PATCH] bugfixes --- interface.c | 8 +++++++- loop.c | 7 +++++++ tgl | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/interface.c b/interface.c index df49bdc..f178f45 100644 --- a/interface.c +++ b/interface.c @@ -2564,6 +2564,9 @@ void print_channel_info_gw (struct tgl_state *TLSR, void *extra, int success, st tgl_peer_t *U = (void *)C; mpush_color (ev, COLOR_YELLOW); mprintf (ev, "Channel "); + if (U->flags & TGLCHF_OFFICIAL) { + mprintf (ev, "(official) "); + } print_channel_name (ev, U->id, U); if (C->username) { mprintf (ev, " @%s", C->username); @@ -3234,6 +3237,7 @@ void user_status_upd (struct tgl_state *TLS, struct tgl_user *U) { } void on_login (struct tgl_state *TLS); +void on_failed_login (struct tgl_state *TLS); void on_started (struct tgl_state *TLS); void do_get_values (struct tgl_state *TLS, enum tgl_value_type type, const char *prompt, int num_values, void (*callback)(struct tgl_state *TLS, const char *string[], void *arg), void *arg); @@ -3257,7 +3261,8 @@ struct tgl_update_callback upd_cb = { .secret_chat_update = secret_chat_update_gw, .msg_receive = print_message_gw, .our_id = our_id_gw, - .user_status_update = user_status_upd + .user_status_update = user_status_upd, + .on_failed_login = on_failed_login }; @@ -3520,6 +3525,7 @@ void interpreter_ex (char *line, void *ex) { if (op == ca_string || op == ca_file_name || op == ca_command) { if (cur_token_end_str || cur_token_len < 0) { if (opt) { + args[args_num ++].str = NULL; flags ++; continue; } diff --git a/loop.c b/loop.c index 0dd11cd..45ce448 100644 --- a/loop.c +++ b/loop.c @@ -755,6 +755,13 @@ void on_login (struct tgl_state *TLS) { write_auth_file (); } +void on_failed_login (struct tgl_state *TLS) { + logprintf ("login failed\n"); + logprintf ("login error #%d: %s\n", TLS->error_code, TLS->error); + logprintf ("you can relogin by deleting auth file or running telegram-cli with '-q' flag\n"); + exit (2); +} + void on_started (struct tgl_state *TLS); void clist_cb (struct tgl_state *TLSR, void *callback_extra, int success, int size, tgl_peer_id_t peers[], tgl_message_id_t *last_msg_id[], int unread_count[]) { on_started (TLS); diff --git a/tgl b/tgl index 5b18232..f9534a2 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 5b18232e9ba1ec696843710b851120a2653cc801 +Subproject commit f9534a2a09fe4c89c9fecfd412fd1bfd4bcda8d3