From 71e5991c596490ebe032de18e9a546a9ee5bf979 Mon Sep 17 00:00:00 2001 From: vysheng Date: Fri, 17 Jan 2014 18:16:35 +0400 Subject: [PATCH 1/2] Fixed load audio --- interface.c | 4 ++-- queries.c | 16 ++++++++++++++++ queries.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/interface.c b/interface.c index 24ac58f..8174a6d 100644 --- a/interface.c +++ b/interface.c @@ -971,7 +971,7 @@ void interpreter (char *line UU) { } struct message *M = message_get (num); if (M && !M->service && M->media.type == (int)CODE_message_media_audio) { - do_load_video (&M->media.video, 1); + do_load_audio (&M->media.video, 1); } else if (M && !M->service && M->media.type == (int)CODE_decrypted_message_media_audio) { do_load_encr_video (&M->media.encr_video, 1); } else { @@ -986,7 +986,7 @@ void interpreter (char *line UU) { } struct message *M = message_get (num); if (M && !M->service && M->media.type == (int)CODE_message_media_audio) { - do_load_video (&M->media.video, 2); + do_load_audio (&M->media.video, 2); } else if (M && !M->service && M->media.type == (int)CODE_decrypted_message_media_audio) { do_load_encr_video (&M->media.encr_video, 2); } else { diff --git a/queries.c b/queries.c index 76fcde9..53bfdcd 100644 --- a/queries.c +++ b/queries.c @@ -1936,6 +1936,22 @@ void do_load_video (struct video *V, int next) { load_next_part (D); } +void do_load_audio (struct video *V, int next) { + assert (V); + assert (next); + struct download *D = talloc0 (sizeof (*D)); + D->offset = 0; + D->size = V->size; + D->id = V->id; + D->access_hash = V->access_hash; + D->dc = V->dc_id; + D->next = next; + D->name = 0; + D->fd = -1; + D->type = CODE_input_audio_file_location; + load_next_part (D); +} + void do_load_document (struct document *V, int next) { assert (V); assert (next); diff --git a/queries.h b/queries.h index bb8f9d6..2f63963 100644 --- a/queries.h +++ b/queries.h @@ -89,6 +89,7 @@ struct photo; struct video; void do_load_photo (struct photo *photo, int next); void do_load_video_thumb (struct video *video, int next); +void do_load_audio (struct video *V, int next); void do_load_video (struct video *V, int next); void do_load_document (struct document *V, int next); void do_load_document_thumb (struct document *video, int next); From 22a81ff87fb3844548e87323b278cfb427e7e674 Mon Sep 17 00:00:00 2001 From: vysheng Date: Fri, 17 Jan 2014 19:46:33 +0000 Subject: [PATCH 2/2] Fixed get_peer from lua --- lua-tg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua-tg.c b/lua-tg.c index 62d9bb7..264d565 100644 --- a/lua-tg.c +++ b/lua-tg.c @@ -343,7 +343,7 @@ static int pos; static peer_t *get_peer (const char *s) { int index = 0; - while (index < peer_num && Peers[index]->print_name && strcmp (Peers[index]->print_name, s)) { + while (index < peer_num && (!Peers[index]->print_name || strcmp (Peers[index]->print_name, s))) { index ++; } return index == peer_num ? 0 : Peers[index];