@@ -647,31 +647,61 @@ void do_dialog_list (int arg_num, struct arg args[], struct in_ev *ev) {
647
647
void do_send_photo (int arg_num , struct arg args [], struct in_ev * ev ) {
648
648
assert (arg_num == 2 );
649
649
if (ev ) { ev -> refcnt ++ ; }
650
- tgl_do_send_document (TLS , -1 , args [0 ].P -> id , args [1 ].str , print_msg_success_gw , ev );
650
+ tgl_do_send_document (TLS , -1 , args [0 ].P -> id , args [1 ].str , 0 , print_msg_success_gw , ev );
651
651
}
652
652
653
653
void do_send_file (int arg_num , struct arg args [], struct in_ev * ev ) {
654
654
assert (arg_num == 2 );
655
655
if (ev ) { ev -> refcnt ++ ; }
656
- tgl_do_send_document (TLS , -2 , args [0 ].P -> id , args [1 ].str , print_msg_success_gw , ev );
656
+ tgl_do_send_document (TLS , -2 , args [0 ].P -> id , args [1 ].str , 0 , print_msg_success_gw , ev );
657
657
}
658
658
659
659
void do_send_audio (int arg_num , struct arg args [], struct in_ev * ev ) {
660
660
assert (arg_num == 2 );
661
661
if (ev ) { ev -> refcnt ++ ; }
662
- tgl_do_send_document (TLS , FLAG_DOCUMENT_AUDIO , args [0 ].P -> id , args [1 ].str , print_msg_success_gw , ev );
662
+ tgl_do_send_document (TLS , FLAG_DOCUMENT_AUDIO , args [0 ].P -> id , args [1 ].str , 0 , print_msg_success_gw , ev );
663
663
}
664
664
665
665
void do_send_video (int arg_num , struct arg args [], struct in_ev * ev ) {
666
666
assert (arg_num == 2 );
667
667
if (ev ) { ev -> refcnt ++ ; }
668
- tgl_do_send_document (TLS , FLAG_DOCUMENT_VIDEO , args [0 ].P -> id , args [1 ].str , print_msg_success_gw , ev );
668
+ tgl_do_send_document (TLS , FLAG_DOCUMENT_VIDEO , args [0 ].P -> id , args [1 ].str , 0 , print_msg_success_gw , ev );
669
669
}
670
670
671
671
void do_send_document (int arg_num , struct arg args [], struct in_ev * ev ) {
672
672
assert (arg_num == 2 );
673
673
if (ev ) { ev -> refcnt ++ ; }
674
- tgl_do_send_document (TLS , 0 , args [0 ].P -> id , args [1 ].str , print_msg_success_gw , ev );
674
+ tgl_do_send_document (TLS , 0 , args [0 ].P -> id , args [1 ].str , 0 , print_msg_success_gw , ev );
675
+ }
676
+
677
+ void do_reply_photo (int arg_num , struct arg args [], struct in_ev * ev ) {
678
+ assert (arg_num == 2 );
679
+ if (ev ) { ev -> refcnt ++ ; }
680
+ tgl_do_reply_document (TLS , -1 , args [0 ].num , args [2 ].str , print_msg_success_gw , ev );
681
+ }
682
+
683
+ void do_reply_file (int arg_num , struct arg args [], struct in_ev * ev ) {
684
+ assert (arg_num == 2 );
685
+ if (ev ) { ev -> refcnt ++ ; }
686
+ tgl_do_reply_document (TLS , -2 , args [0 ].num , args [1 ].str , print_msg_success_gw , ev );
687
+ }
688
+
689
+ void do_reply_audio (int arg_num , struct arg args [], struct in_ev * ev ) {
690
+ assert (arg_num == 2 );
691
+ if (ev ) { ev -> refcnt ++ ; }
692
+ tgl_do_reply_document (TLS , FLAG_DOCUMENT_AUDIO , args [0 ].num , args [1 ].str , print_msg_success_gw , ev );
693
+ }
694
+
695
+ void do_reply_video (int arg_num , struct arg args [], struct in_ev * ev ) {
696
+ assert (arg_num == 2 );
697
+ if (ev ) { ev -> refcnt ++ ; }
698
+ tgl_do_reply_document (TLS , FLAG_DOCUMENT_VIDEO , args [0 ].num , args [1 ].str , print_msg_success_gw , ev );
699
+ }
700
+
701
+ void do_reply_document (int arg_num , struct arg args [], struct in_ev * ev ) {
702
+ assert (arg_num == 2 );
703
+ if (ev ) { ev -> refcnt ++ ; }
704
+ tgl_do_reply_document (TLS , 0 , args [0 ].num , args [1 ].str , print_msg_success_gw , ev );
675
705
}
676
706
677
707
void do_send_text (int arg_num , struct arg args [], struct in_ev * ev ) {
@@ -1107,7 +1137,13 @@ void do_import_card (int arg_num, struct arg args[], struct in_ev *ev) {
1107
1137
void do_send_contact (int arg_num , struct arg args [], struct in_ev * ev ) {
1108
1138
assert (arg_num == 4 );
1109
1139
if (ev ) { ev -> refcnt ++ ; }
1110
- tgl_do_send_contact (TLS , args [0 ].P -> id , args [1 ].str , strlen (args [1 ].str ), args [2 ].str , strlen (args [2 ].str ), args [3 ].str , strlen (args [3 ].str ), print_msg_gw , ev );
1140
+ tgl_do_send_contact (TLS , args [0 ].P -> id , args [1 ].str , strlen (args [1 ].str ), args [2 ].str , strlen (args [2 ].str ), args [3 ].str , strlen (args [3 ].str ), print_msg_success_gw , ev );
1141
+ }
1142
+
1143
+ void do_reply_contact (int arg_num , struct arg args [], struct in_ev * ev ) {
1144
+ assert (arg_num == 4 );
1145
+ if (ev ) { ev -> refcnt ++ ; }
1146
+ tgl_do_reply_contact (TLS , args [0 ].num , args [1 ].str , strlen (args [1 ].str ), args [2 ].str , strlen (args [2 ].str ), args [3 ].str , strlen (args [3 ].str ), print_msg_success_gw , ev );
1111
1147
}
1112
1148
1113
1149
void do_main_session (int arg_num , struct arg args [], struct in_ev * ev ) {
@@ -1174,6 +1210,12 @@ void do_send_location (int arg_num, struct arg args[], struct in_ev *ev) {
1174
1210
tgl_do_send_location (TLS , args [0 ].P -> id , args [1 ].dval , args [2 ].dval , print_msg_success_gw , ev );
1175
1211
}
1176
1212
1213
+ void do_reply_location (int arg_num , struct arg args [], struct in_ev * ev ) {
1214
+ assert (arg_num == 3 );
1215
+ if (ev ) { ev -> refcnt ++ ; }
1216
+ tgl_do_reply_location (TLS , args [0 ].num , args [1 ].dval , args [2 ].dval , print_msg_success_gw , ev );
1217
+ }
1218
+
1177
1219
1178
1220
struct command commands [] = {
1179
1221
{"accept_secret_chat" , {ca_secret_chat , ca_none }, do_accept_secret_chat , "accept_secret_chat <secret chat>\tAccepts secret chat. Only useful with -E option" },
@@ -1214,6 +1256,14 @@ struct command commands[] = {
1214
1256
{"rename_chat" , {ca_chat , ca_string_end , ca_none }, do_rename_chat , "rename_chat <chat> <new name>\tRenames chat" },
1215
1257
{"rename_contact" , {ca_user , ca_string , ca_string , ca_none }, do_rename_contact , "rename_contact <user> <first name> <last name>\tRenames contact" },
1216
1258
{"reply" , {ca_number , ca_string_end , ca_none }, do_reply , "msg <msg-id> <text>\tSends text reply to message" },
1259
+ {"reply_audio" , {ca_number , ca_file_name_end , ca_none }, do_send_audio , "reply_audio <msg-id> <file>\tSends audio to peer" },
1260
+ {"reply_contact" , {ca_number , ca_string , ca_string , ca_string , ca_none }, do_reply_contact , "reply_contact <msg-id> <phone> <first-name> <last-name>\tSends contact (not necessary telegram user)" },
1261
+ {"reply_document" , {ca_number , ca_file_name_end , ca_none }, do_reply_document , "reply_document <msg-id> <file>\tSends document to peer" },
1262
+ {"reply_file" , {ca_number , ca_file_name_end , ca_none }, do_reply_file , "reply_file <msg-id> <file>\tSends document to peer" },
1263
+ {"reply_location" , {ca_number , ca_double , ca_double , ca_none }, do_reply_location , "reply_location <msg-id> <latitude> <longitude>\tSends geo location" },
1264
+ {"reply_photo" , {ca_number , ca_file_name_end , ca_none }, do_reply_photo , "reply_photo <msg-id> <file>\tSends photo to peer" },
1265
+ //{"reply_text", {ca_number, ca_file_name_end, ca_none}, do_reply_text, "reply_text <msg-id> <file>\tSends contents of text file as plain text message"},
1266
+ {"reply_video" , {ca_number , ca_file_name_end , ca_none }, do_reply_video , "reply_video <msg-id> <file>\tSends video to peer" },
1217
1267
// {"restore_msg", {ca_number, ca_none}, do_restore_msg, "restore_msg <msg-id>\tRestores message. Only available shortly (one hour?) after deletion"},
1218
1268
{"safe_quit" , {ca_none }, do_safe_quit , "safe_quit\tWaits for all queries to end, then quits" },
1219
1269
{"search" , {ca_peer | ca_optional , ca_number | ca_optional , ca_number | ca_optional , ca_number | ca_optional , ca_number | ca_optional , ca_string_end }, do_search , "search [peer] [limit] [from] [to] [offset] pattern\tSearch for pattern in messages from date from to date to (unixtime) in messages with peer (if peer not present, in all messages)" },
@@ -3025,6 +3075,9 @@ void print_message (struct in_ev *ev, struct tgl_message *M) {
3025
3075
if (M -> reply_id ) {
3026
3076
mprintf (ev , "[reply to %d] " , M -> reply_id );
3027
3077
}
3078
+ if (M -> flags & TGLMF_MENTION ) {
3079
+ mprintf (ev , "[mention] " );
3080
+ }
3028
3081
if (M -> message && strlen (M -> message )) {
3029
3082
mprintf (ev , "%s" , M -> message );
3030
3083
}
0 commit comments