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) {
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;
......
......@@ -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;
......
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