Commit c35619f6 authored by vvaltman's avatar vvaltman

updated tgl

parent 4dff2a3f
...@@ -790,10 +790,10 @@ void do_ ## act ## _ ## tp (int arg_num, struct arg args[], struct in_ev *ev) { ...@@ -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);\ tgl_do_load_photo (TLS, M->media.photo, actf, ev);\
} else if (M->media.type == tgl_message_media_document) {\ } else if (M->media.type == tgl_message_media_document) {\
tgl_do_load_document (TLS, M->media.document, actf, ev);\ 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) {\ } else if (M->media.type == tgl_message_media_document_encr) {\
tgl_do_load_encr_document (TLS, &M->media.encr_document, actf, ev); \ tgl_do_load_encr_document (TLS, M->media.encr_document, actf, ev); \
} else if (M->media.type == tgl_message_media_webpage) {\ } 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) { \ } else if (M->media.type == tgl_message_media_geo || M->media.type == tgl_message_media_venue) { \
static char s[1000]; \ static char s[1000]; \
sprintf (s, "https://maps.google.com/?q=%.6lf,%.6lf", M->media.geo.latitude, M->media.geo.longitude);\ 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) { ...@@ -2695,51 +2695,48 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) {
mprintf (ev, "]"); mprintf (ev, "]");
return;
case tgl_message_media_photo_encr:
mprintf (ev, "[photo]");
return; return;
case tgl_message_media_document_encr: case tgl_message_media_document_encr:
mprintf (ev, "["); mprintf (ev, "[");
if (M->encr_document.flags & FLAG_DOCUMENT_IMAGE) { if (M->encr_document->flags & FLAG_DOCUMENT_IMAGE) {
mprintf (ev, "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"); mprintf (ev, "audio");
} else if (M->encr_document.flags & FLAG_DOCUMENT_VIDEO) { } else if (M->encr_document->flags & FLAG_DOCUMENT_VIDEO) {
mprintf (ev, "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"); mprintf (ev, "sticker");
} else { } else {
mprintf (ev, "document"); mprintf (ev, "document");
} }
if (M->encr_document.caption && strlen (M->encr_document.caption)) { if (M->encr_document->caption && strlen (M->encr_document->caption)) {
mprintf (ev, " %s:", M->encr_document.caption); mprintf (ev, " %s:", M->encr_document->caption);
} else { } else {
mprintf (ev, ":"); mprintf (ev, ":");
} }
if (M->encr_document.mime_type) { if (M->encr_document->mime_type) {
mprintf (ev, " type=%s", M->encr_document.mime_type); mprintf (ev, " type=%s", M->encr_document->mime_type);
} }
if (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); mprintf (ev, " size=%dx%d", M->encr_document->w, M->encr_document->h);
} }
if (M->encr_document.duration) { if (M->encr_document->duration) {
mprintf (ev, " duration=%d", M->encr_document.duration); mprintf (ev, " duration=%d", M->encr_document->duration);
} }
mprintf (ev, " size="); mprintf (ev, " size=");
if (M->encr_document.size < (1 << 10)) { if (M->encr_document->size < (1 << 10)) {
mprintf (ev, "%dB", M->encr_document.size); mprintf (ev, "%dB", M->encr_document->size);
} else if (M->encr_document.size < (1 << 20)) { } else if (M->encr_document->size < (1 << 20)) {
mprintf (ev, "%dKiB", M->encr_document.size >> 10); mprintf (ev, "%dKiB", M->encr_document->size >> 10);
} else if (M->encr_document.size < (1 << 30)) { } else if (M->encr_document->size < (1 << 30)) {
mprintf (ev, "%dMiB", M->encr_document.size >> 20); mprintf (ev, "%dMiB", M->encr_document->size >> 20);
} else { } else {
mprintf (ev, "%dGiB", M->encr_document.size >> 30); mprintf (ev, "%dGiB", M->encr_document->size >> 30);
} }
mprintf (ev, "]"); mprintf (ev, "]");
...@@ -2760,17 +2757,17 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) { ...@@ -2760,17 +2757,17 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) {
return; return;
case tgl_message_media_webpage: case tgl_message_media_webpage:
mprintf (ev, "[webpage:"); mprintf (ev, "[webpage:");
if (M->webpage.url) { if (M->webpage->url) {
mprintf (ev, " url:'%s'", M->webpage.url); mprintf (ev, " url:'%s'", M->webpage->url);
} }
if (M->webpage.title) { if (M->webpage->title) {
mprintf (ev, " title:'%s'", M->webpage.title); mprintf (ev, " title:'%s'", M->webpage->title);
} }
if (M->webpage.description) { if (M->webpage->description) {
mprintf (ev, " description:'%s'", M->webpage.description); mprintf (ev, " description:'%s'", M->webpage->description);
} }
if (M->webpage.author) { if (M->webpage->author) {
mprintf (ev, " author:'%s'", M->webpage.author); mprintf (ev, " author:'%s'", M->webpage->author);
} }
mprintf (ev, "]"); mprintf (ev, "]");
break; break;
......
...@@ -243,8 +243,8 @@ void push_media (struct tgl_message_media *M) { ...@@ -243,8 +243,8 @@ void push_media (struct tgl_message_media *M) {
my_lua_checkstack (luaState, 4); my_lua_checkstack (luaState, 4);
switch (M->type) { switch (M->type) {
//case tgl_message_media_photo_encr:
case tgl_message_media_photo: case tgl_message_media_photo:
case tgl_message_media_photo_encr:
lua_newtable (luaState); lua_newtable (luaState);
lua_add_string_field ("type", "photo"); lua_add_string_field ("type", "photo");
break; break;
...@@ -933,7 +933,7 @@ void lua_do_all (void) { ...@@ -933,7 +933,7 @@ void lua_do_all (void) {
case lq_load_audio: case lq_load_audio:
case lq_load_document: case lq_load_document:
M = lua_ptr[p + 1]; 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); lua_file_cb (TLS, lua_ptr[p], 0, 0);
} else { } else {
if (M->media.type == tgl_message_media_photo) { if (M->media.type == tgl_message_media_photo) {
...@@ -943,7 +943,7 @@ void lua_do_all (void) { ...@@ -943,7 +943,7 @@ void lua_do_all (void) {
assert (M->media.document); assert (M->media.document);
tgl_do_load_document (TLS, M->media.document, lua_file_cb, lua_ptr[p]); tgl_do_load_document (TLS, M->media.document, lua_file_cb, lua_ptr[p]);
} else { } 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; p += 2;
......
Subproject commit 69ecf07c45ac100addadc7af00c6252e12d46a49 Subproject commit 03f46aea574f8628ba869192505b7fe76cceccfc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment