From c35619f6970c966b155ced9acc78e3ffea39543c Mon Sep 17 00:00:00 2001 From: vvaltman Date: Thu, 30 Apr 2015 13:43:48 +0300 Subject: [PATCH] updated tgl --- interface.c | 63 +++++++++++++++++++++++++---------------------------- lua-tg.c | 6 ++--- tgl | 2 +- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/interface.c b/interface.c index af1da99..78e6e5c 100644 --- a/interface.c +++ b/interface.c @@ -790,10 +790,10 @@ void do_ ## act ## _ ## tp (int arg_num, struct arg args[], struct in_ev *ev) { tgl_do_load_photo (TLS, M->media.photo, actf, ev);\ } else if (M->media.type == tgl_message_media_document) {\ tgl_do_load_document (TLS, M->media.document, actf, ev);\ - } else if (M->media.type == tgl_message_media_photo_encr || M->media.type == tgl_message_media_document_encr) {\ - tgl_do_load_encr_document (TLS, &M->media.encr_document, actf, ev); \ + } else if (M->media.type == tgl_message_media_document_encr) {\ + tgl_do_load_encr_document (TLS, M->media.encr_document, actf, ev); \ } else if (M->media.type == tgl_message_media_webpage) {\ - actf (TLS, ev, 1, M->media.webpage.url);\ + actf (TLS, ev, 1, M->media.webpage->url);\ } else if (M->media.type == tgl_message_media_geo || M->media.type == tgl_message_media_venue) { \ static char s[1000]; \ sprintf (s, "https://maps.google.com/?q=%.6lf,%.6lf", M->media.geo.latitude, M->media.geo.longitude);\ @@ -2695,51 +2695,48 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) { mprintf (ev, "]"); - return; - case tgl_message_media_photo_encr: - mprintf (ev, "[photo]"); return; case tgl_message_media_document_encr: mprintf (ev, "["); - if (M->encr_document.flags & FLAG_DOCUMENT_IMAGE) { + if (M->encr_document->flags & FLAG_DOCUMENT_IMAGE) { mprintf (ev, "image"); - } else if (M->encr_document.flags & FLAG_DOCUMENT_AUDIO) { + } else if (M->encr_document->flags & FLAG_DOCUMENT_AUDIO) { mprintf (ev, "audio"); - } else if (M->encr_document.flags & FLAG_DOCUMENT_VIDEO) { + } else if (M->encr_document->flags & FLAG_DOCUMENT_VIDEO) { mprintf (ev, "video"); - } else if (M->encr_document.flags & FLAG_DOCUMENT_STICKER) { + } else if (M->encr_document->flags & FLAG_DOCUMENT_STICKER) { mprintf (ev, "sticker"); } else { mprintf (ev, "document"); } - if (M->encr_document.caption && strlen (M->encr_document.caption)) { - mprintf (ev, " %s:", M->encr_document.caption); + if (M->encr_document->caption && strlen (M->encr_document->caption)) { + mprintf (ev, " %s:", M->encr_document->caption); } else { mprintf (ev, ":"); } - if (M->encr_document.mime_type) { - mprintf (ev, " type=%s", M->encr_document.mime_type); + if (M->encr_document->mime_type) { + mprintf (ev, " type=%s", M->encr_document->mime_type); } - if (M->encr_document.w && M->encr_document.h) { - mprintf (ev, " size=%dx%d", M->encr_document.w, M->encr_document.h); + if (M->encr_document->w && M->encr_document->h) { + mprintf (ev, " size=%dx%d", M->encr_document->w, M->encr_document->h); } - if (M->encr_document.duration) { - mprintf (ev, " duration=%d", M->encr_document.duration); + if (M->encr_document->duration) { + mprintf (ev, " duration=%d", M->encr_document->duration); } mprintf (ev, " size="); - if (M->encr_document.size < (1 << 10)) { - mprintf (ev, "%dB", M->encr_document.size); - } else if (M->encr_document.size < (1 << 20)) { - mprintf (ev, "%dKiB", M->encr_document.size >> 10); - } else if (M->encr_document.size < (1 << 30)) { - mprintf (ev, "%dMiB", M->encr_document.size >> 20); + if (M->encr_document->size < (1 << 10)) { + mprintf (ev, "%dB", M->encr_document->size); + } else if (M->encr_document->size < (1 << 20)) { + mprintf (ev, "%dKiB", M->encr_document->size >> 10); + } else if (M->encr_document->size < (1 << 30)) { + mprintf (ev, "%dMiB", M->encr_document->size >> 20); } else { - mprintf (ev, "%dGiB", M->encr_document.size >> 30); + mprintf (ev, "%dGiB", M->encr_document->size >> 30); } mprintf (ev, "]"); @@ -2760,17 +2757,17 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) { return; case tgl_message_media_webpage: mprintf (ev, "[webpage:"); - if (M->webpage.url) { - mprintf (ev, " url:'%s'", M->webpage.url); + if (M->webpage->url) { + mprintf (ev, " url:'%s'", M->webpage->url); } - if (M->webpage.title) { - mprintf (ev, " title:'%s'", M->webpage.title); + if (M->webpage->title) { + mprintf (ev, " title:'%s'", M->webpage->title); } - if (M->webpage.description) { - mprintf (ev, " description:'%s'", M->webpage.description); + if (M->webpage->description) { + mprintf (ev, " description:'%s'", M->webpage->description); } - if (M->webpage.author) { - mprintf (ev, " author:'%s'", M->webpage.author); + if (M->webpage->author) { + mprintf (ev, " author:'%s'", M->webpage->author); } mprintf (ev, "]"); break; diff --git a/lua-tg.c b/lua-tg.c index c6d7e25..7c1dbc3 100644 --- a/lua-tg.c +++ b/lua-tg.c @@ -243,8 +243,8 @@ void push_media (struct tgl_message_media *M) { my_lua_checkstack (luaState, 4); switch (M->type) { + //case tgl_message_media_photo_encr: case tgl_message_media_photo: - case tgl_message_media_photo_encr: lua_newtable (luaState); lua_add_string_field ("type", "photo"); break; @@ -933,7 +933,7 @@ void lua_do_all (void) { case lq_load_audio: case lq_load_document: M = lua_ptr[p + 1]; - if (!M || (M->media.type != tgl_message_media_photo && M->media.type != tgl_message_media_photo_encr && M->media.type != tgl_message_media_document && M->media.type != tgl_message_media_document_encr)) { + if (!M || (M->media.type != tgl_message_media_photo && M->media.type != tgl_message_media_document && M->media.type != tgl_message_media_document_encr)) { lua_file_cb (TLS, lua_ptr[p], 0, 0); } else { if (M->media.type == tgl_message_media_photo) { @@ -943,7 +943,7 @@ void lua_do_all (void) { assert (M->media.document); tgl_do_load_document (TLS, M->media.document, lua_file_cb, lua_ptr[p]); } else { - tgl_do_load_encr_document (TLS, &M->media.encr_document, lua_file_cb, lua_ptr[p]); + tgl_do_load_encr_document (TLS, M->media.encr_document, lua_file_cb, lua_ptr[p]); } } p += 2; diff --git a/tgl b/tgl index 69ecf07..03f46ae 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 69ecf07c45ac100addadc7af00c6252e12d46a49 +Subproject commit 03f46aea574f8628ba869192505b7fe76cceccfc