Commit 41185472 authored by vvaltman's avatar vvaltman

updated to latest version of tgl

parent 46308629
1.2.0
* layer 22 support
1.0.6
* layer 18 support
1.0.5
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
Copyright Vitaly Valtman 2013-2015
*/
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
Copyright Vitaly Valtman 2013-2015
*/
#ifndef __LOOP_H__
#define __LOOP_H__
......@@ -23,7 +23,6 @@
int loop (void);
void do_halt (int error);
void net_loop (int flags, int (*end)(void));
void write_auth_file (void);
void write_state_file (void);
void write_secret_chat_file (void);
......
......@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
Copyright Vitaly Valtman 2013-2015
*/
#ifdef HAVE_CONFIG_H
......@@ -248,7 +248,7 @@ void push_media (struct tgl_message_media *M) {
lua_newtable (luaState);
lua_add_string_field ("type", "photo");
break;
case tgl_message_media_video:
/*case tgl_message_media_video:
case tgl_message_media_video_encr:
lua_newtable (luaState);
lua_add_string_field ("type", "video");
......@@ -257,7 +257,7 @@ void push_media (struct tgl_message_media *M) {
case tgl_message_media_audio_encr:
lua_newtable (luaState);
lua_add_string_field ("type", "audio");
break;
break;*/
case tgl_message_media_document:
case tgl_message_media_document_encr:
lua_newtable (luaState);
......@@ -491,6 +491,7 @@ enum lua_query_type {
lq_create_group_chat,
lq_send_audio,
lq_send_document,
lq_send_file,
lq_load_audio,
lq_load_document,
lq_load_document_thumb,
......@@ -883,22 +884,27 @@ void lua_do_all (void) {
p += 3;
break;
case lq_send_photo:
tgl_do_send_photo (TLS, tgl_message_media_photo, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
tgl_do_send_document (TLS, -1, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
free (lua_ptr[p + 2]);
p += 3;
break;
case lq_send_video:
tgl_do_send_photo (TLS, tgl_message_media_video, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
tgl_do_send_document (TLS, FLAG_DOCUMENT_VIDEO, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
free (lua_ptr[p + 2]);
p += 3;
break;
case lq_send_audio:
tgl_do_send_photo (TLS, tgl_message_media_audio, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
tgl_do_send_document (TLS, FLAG_DOCUMENT_AUDIO, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
free (lua_ptr[p + 2]);
p += 3;
break;
case lq_send_document:
tgl_do_send_photo (TLS, tgl_message_media_document, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
tgl_do_send_document (TLS, 0, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
free (lua_ptr[p + 2]);
p += 3;
break;
case lq_send_file:
tgl_do_send_document (TLS, -2, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
free (lua_ptr[p + 2]);
p += 3;
break;
......@@ -913,66 +919,24 @@ void lua_do_all (void) {
p += 3;
break;
case lq_load_photo:
M = lua_ptr[p + 1];
if (!M || (M->media.type != tgl_message_media_photo && M->media.type != tgl_message_media_photo_encr)) {
lua_file_cb (TLS, lua_ptr[p], 0, 0);
} else {
if (M->media.type == tgl_message_media_photo) {
tgl_do_load_photo (TLS, &M->media.photo, lua_file_cb, lua_ptr[p]);
} else {
tgl_do_load_encr_video (TLS, &M->media.encr_video, lua_file_cb, lua_ptr[p]);
}
}
p += 2;
break;
case lq_load_video:
M = lua_ptr[p + 1];
if (!M || (M->media.type != tgl_message_media_video && M->media.type != tgl_message_media_video_encr)) {
lua_file_cb (TLS, lua_ptr[p], 0, 0);
} else {
if (M->media.type == tgl_message_media_video) {
tgl_do_load_video (TLS, &M->media.video, lua_file_cb, lua_ptr[p]);
} else {
tgl_do_load_encr_video (TLS, &M->media.encr_video, lua_file_cb, lua_ptr[p]);
}
}
p += 2;
break;
case lq_load_video_thumb:
M = lua_ptr[p + 1];
if (!M || (M->media.type != tgl_message_media_video)) {
lua_file_cb (TLS, lua_ptr[p], 0, 0);
} else {
tgl_do_load_video_thumb (TLS, &M->media.video, lua_file_cb, lua_ptr[p]);
}
p += 2;
break;
case lq_load_audio:
M = lua_ptr[p + 1];
if (!M || (M->media.type != tgl_message_media_audio && M->media.type != tgl_message_media_audio_encr)) {
lua_file_cb (TLS, lua_ptr[p], 0, 0);
} else {
if (M->media.type == tgl_message_media_audio) {
tgl_do_load_audio (TLS, &M->media.audio, lua_file_cb, lua_ptr[p]);
} else {
tgl_do_load_encr_video (TLS, &M->media.encr_video, lua_file_cb, lua_ptr[p]);
}
}
p += 2;
break;
case lq_load_document:
M = lua_ptr[p + 1];
if (!M || (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_photo_encr && 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_document) {
if (M->media.type == tgl_message_media_photo) {
tgl_do_load_photo (TLS, &M->media.photo, lua_file_cb, lua_ptr[p]);
} else if (M->media.type == tgl_message_media_document) {
tgl_do_load_document (TLS, &M->media.document, lua_file_cb, lua_ptr[p]);
} else {
tgl_do_load_encr_video (TLS, &M->media.encr_video, lua_file_cb, lua_ptr[p]);
tgl_do_load_encr_document (TLS, &M->media.encr_document, lua_file_cb, lua_ptr[p]);
}
}
p += 2;
break;
case lq_load_video_thumb:
case lq_load_document_thumb:
M = lua_ptr[p + 1];
if (!M || (M->media.type != tgl_message_media_document)) {
......@@ -1171,6 +1135,7 @@ struct lua_function functions[] = {
{"send_video", lq_send_video, { lfp_peer, lfp_string, lfp_none }},
{"send_audio", lq_send_audio, { lfp_peer, lfp_string, lfp_none }},
{"send_document", lq_send_document, { lfp_peer, lfp_string, lfp_none }},
{"send_file", lq_send_file, { lfp_peer, lfp_string, lfp_none }},
{"send_text", lq_send_text, { lfp_peer, lfp_string, lfp_none }},
{"chat_set_photo", lq_chat_set_photo, { lfp_chat, lfp_string, lfp_none }},
{"load_photo", lq_load_photo, { lfp_msg, lfp_none }},
......
......@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
Copyright Vitaly Valtman 2013-2015
*/
#ifndef __LUA_TG_H__
#define __LUA_TG_H__
......
......@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
Copyright Vitaly Valtman 2013-2015
*/
#ifdef HAVE_CONFIG_H
......@@ -839,10 +839,11 @@ int main (int argc, char **argv) {
if (!disable_output) {
printf (
"Telegram-cli version " TGL_VERSION ", Copyright (C) 2013-2014 Vitaly Valtman\n"
"Telegram-cli version " TELEGRAM_CLI_VERSION ", Copyright (C) 2013-2015 Vitaly Valtman\n"
"Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.\n"
"This is free software, and you are welcome to redistribute it\n"
"under certain conditions; type `show_license' for details.\n"
"Telegram-cli uses libtgl version " TGL_VERSION "\n"
);
}
running_for_first_time ();
......
......@@ -14,9 +14,11 @@
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
Copyright Vitaly Valtman 2013-2015
*/
#ifndef PROG_NAME
#define PROG_NAME "telegram-cli"
#endif
#define TELEGRAM_CLI_VERSION "1.2.0"
Subproject commit 0205b668d3abcf35a348556776d1180439d115d9
Subproject commit 24ed7ee1fa0520dc4e69e845a84281e034b4c482
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