Skip to content

Commit

Permalink
Add reply_audio, reply_document, reply_file, reply_photo and reply_vi…
Browse files Browse the repository at this point in the history
…deo to lua binding.
  • Loading branch information
Sahri Riza Umami committed Apr 18, 2016
1 parent 20488b1 commit a70cd2a
Showing 1 changed file with 63 additions and 6 deletions.
69 changes: 63 additions & 6 deletions patches/merbot.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- tg/lua-tg.c 2016-03-17 22:21:55.993798604 +0700
+++ patches/lua-tg_merbot.c 2016-03-17 22:21:32.806638374 +0700
--- tg/lua-tg.c 2016-04-18 18:53:21.344792927 +0700
+++ /tmp/lua-tg.c 2016-04-18 19:04:00.845334720 +0700
@@ -161,6 +161,7 @@
my_lua_checkstack (luaState, 4);
lua_add_string_field ("title", P->channel.title);
Expand Down Expand Up @@ -34,7 +34,20 @@
break;
case tgl_message_media_unsupported:
lua_newtable (luaState);
@@ -718,7 +732,24 @@
@@ -680,6 +694,12 @@
lq_send_video,
lq_send_text,
lq_reply,
+ lq_reply_audio,
+ lq_reply_document,
+ lq_reply_file,
+ lq_reply_location,
+ lq_reply_photo,
+ lq_reply_video,
lq_fwd,
lq_fwd_media,
lq_load_photo,
@@ -718,7 +738,24 @@
lq_channel_invite_user,
lq_channel_kick_user,
lq_channel_get_admins,
Expand All @@ -60,7 +73,7 @@
};

struct lua_query_extra {
@@ -1138,6 +1169,38 @@
@@ -1138,6 +1175,38 @@
free (cb);
}

Expand Down Expand Up @@ -99,7 +112,38 @@
#define LUA_STR_ARG(n) lua_ptr[n].str, strlen (lua_ptr[n].str)

void lua_do_all (void) {
@@ -1363,6 +1426,73 @@
@@ -1238,6 +1307,30 @@
tgl_do_reply_message (TLS, &lua_ptr[p + 1].msg_id, LUA_STR_ARG (p + 2), 0, lua_msg_cb, lua_ptr[p].ptr);
p += 3;
break;
+ case lq_reply_audio:
+ tgl_do_reply_document (TLS, &lua_ptr[p + 1].msg_id, lua_ptr[p + 2].str, NULL, 0, TGL_SEND_MSG_FLAG_DOCUMENT_AUDIO, lua_msg_cb, lua_ptr[p].ptr);
+ p += 3;
+ break;
+ case lq_reply_document:
+ tgl_do_reply_document (TLS, &lua_ptr[p + 1].msg_id, lua_ptr[p + 2].str, NULL, 0, 0, lua_msg_cb, lua_ptr[p].ptr);
+ p += 3;
+ break;
+ case lq_reply_file:
+ tgl_do_reply_document (TLS, &lua_ptr[p + 1].msg_id, lua_ptr[p + 2].str, NULL, 0, TGL_SEND_MSG_FLAG_DOCUMENT_AUTO, lua_msg_cb, lua_ptr[p].ptr);
+ p += 3;
+ break;
+ case lq_reply_location: // TODO - I DON'T UNDERSTAND WHY IT'S NOT WORKING
+ tgl_do_reply_location (TLS, &lua_ptr[p + 1].msg_id, lua_ptr[p + 2].dnum, lua_ptr[p + 3].dnum, 0, lua_msg_cb, lua_ptr[p].ptr);
+ p += 4;
+ break;
+ case lq_reply_photo:
+ tgl_do_reply_document (TLS, &lua_ptr[p + 1].msg_id, lua_ptr[p + 2].str, NULL, 0, TGL_SEND_MSG_FLAG_DOCUMENT_PHOTO, lua_msg_cb, lua_ptr[p].ptr);
+ p += 3;
+ break;
+ case lq_reply_video:
+ tgl_do_reply_document (TLS, &lua_ptr[p + 1].msg_id, lua_ptr[p + 2].str, NULL, 0, TGL_SEND_MSG_FLAG_DOCUMENT_VIDEO, lua_msg_cb, lua_ptr[p].ptr);
+ p += 3;
+ break;
case lq_fwd:
tmp_msg_id = &lua_ptr[p + 2].msg_id;
tgl_do_forward_messages (TLS, lua_ptr[p + 1].peer_id, 1, (void *)&tmp_msg_id, 0, lua_one_msg_cb, lua_ptr[p].ptr);
@@ -1363,6 +1456,73 @@
tgl_do_channel_get_members (TLS, lua_ptr[p + 1].peer_id, 100, 0, 0, lua_contact_list_cb, lua_ptr[p].ptr);
p += 2;
break;
Expand Down Expand Up @@ -173,7 +217,20 @@
/*
lq_delete_msg,
lq_restore_msg,
@@ -1468,6 +1598,25 @@
@@ -1436,6 +1596,12 @@
{"load_document", lq_load_document, { lfp_msg, lfp_none }},
{"load_document_thumb", lq_load_document_thumb, { lfp_msg, lfp_none }},
{"reply_msg", lq_reply, { lfp_msg, lfp_string, lfp_none }},
+ {"reply_file", lq_reply_file, {lfp_msg, lfp_string, lfp_none}},
+ {"reply_audio", lq_send_audio, {lfp_msg, lfp_string, lfp_none}},
+ {"reply_location", lq_reply_location, { lfp_msg, lfp_double, lfp_double, lfp_none }},
+ {"reply_document", lq_reply_document, {lfp_msg, lfp_string, lfp_none}},
+ {"reply_photo", lq_reply_photo, {lfp_msg, lfp_string, lfp_none}},
+ {"reply_video", lq_reply_video, {lfp_msg, lfp_string, lfp_none}},
{"fwd_msg", lq_fwd, { lfp_peer, lfp_msg, lfp_none }},
{"fwd_media", lq_fwd_media, { lfp_peer, lfp_msg, lfp_none }},
{"chat_info", lq_chat_info, { lfp_chat, lfp_none }},
@@ -1468,6 +1634,25 @@
{"channel_kick_user", lq_channel_kick_user, { lfp_channel, lfp_user, lfp_none }},
{"channel_get_admins", lq_channel_get_admins, { lfp_channel, lfp_none }},
{"channel_get_users", lq_channel_get_users, { lfp_channel, lfp_none }},
Expand Down

0 comments on commit a70cd2a

Please sign in to comment.