diff --git a/telegram-base.c b/telegram-base.c index 6cb26f1..c48b9de 100644 --- a/telegram-base.c +++ b/telegram-base.c @@ -140,10 +140,10 @@ void write_dc (struct tgl_dc *DC, void *extra) { assert (DC->flags & TGLDCF_LOGGED_IN); - assert (write (auth_file_fd, &DC->port, 4) == 4); - int l = strlen (DC->ip); + assert (write (auth_file_fd, &DC->options[0]->port, 4) == 4); + int l = strlen (DC->options[0]->ip); assert (write (auth_file_fd, &l, 4) == 4); - assert (write (auth_file_fd, DC->ip, l) == l); + assert (write (auth_file_fd, DC->options[0]->ip, l) == l); assert (write (auth_file_fd, &DC->auth_key_id, 8) == 8); assert (write (auth_file_fd, DC->auth_key, 256) == 256); } @@ -637,7 +637,7 @@ static void telegram_send_sms (struct tgl_state *TLS) { static int all_authorized (struct tgl_state *TLS) { int i; for (i = 0; i <= TLS->max_dc_num; i++) if (TLS->DC_list[i]) { - if (!tgl_authorized_dc (TLS, TLS->DC_list[i])) { + if (!tgl_signed_dc(TLS, TLS->DC_list[i]) && !tgl_authorized_dc (TLS, TLS->DC_list[i])) { return 0; } } diff --git a/tgl b/tgl index 195b2bc..7bfaae1 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 195b2bcccdefd63282654c4d827315a48b677f97 +Subproject commit 7bfaae149a08d1e205e5188d548c3d54e5a1ce64 diff --git a/tgp-msg.c b/tgp-msg.c index ea3beb2..431f67b 100644 --- a/tgp-msg.c +++ b/tgp-msg.c @@ -162,7 +162,7 @@ static gboolean tgp_msg_send_schedule_cb (gpointer data) { g_queue_pop_head (conn->out_messages); // TODO: option for disable_msg_preview - tgl_do_send_message(D->TLS, D->to, D->msg, (int)strlen (D->msg), 0, tgp_msg_send_done, NULL); + tgl_do_send_message (D->TLS, D->to, D->msg, (int)strlen (D->msg), 0, NULL, tgp_msg_send_done, NULL); tgp_msg_sending_free (D); } return FALSE; diff --git a/tgp-net.c b/tgp-net.c index 3b057af..7e3412b 100644 --- a/tgp-net.c +++ b/tgp-net.c @@ -313,6 +313,7 @@ static void restart_connection (struct connection *c) { struct tgl_state *TLS = c->TLS; connection_data *conn = TLS->ev_base; + /* if (strcmp (c->ip, c->dc->ip) != 0 || c->port != c->dc->port) { info ("DC%d address changed from %s:%d to %s:%d, updating settings.\n", c->dc->id, c->ip, c->port, c->dc->ip, c->dc->port); @@ -322,6 +323,7 @@ static void restart_connection (struct connection *c) { c->ip = strdup (c->dc->ip); c->port = c->dc->port; } + */ if (tglt_get_double_time () - c->last_receive_time > 6 * PING_TIMEOUT) { purple_connection_error_reason (conn->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,