Commit 7d2cac9e authored by Vincent Castellano's avatar Vincent Castellano

Merging to remove bad branch

parent 0f4ceaa2
......@@ -19,7 +19,7 @@ DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${LIB} ${DEP}/auto ${OBJ}/auto
EXE_LIST=${EXE}/telegram-cli
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o ${OBJ}/python-tg.o
INCLUDE=-I. -I${srcdir}
CC=@CC@
......
......@@ -158,6 +158,9 @@
/* use lua */
#undef USE_LUA
/* use python */
#undef USE_PYTHON
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
......
This diff is collapsed.
......@@ -59,6 +59,10 @@
# include "lua-tg.h"
#endif
#ifdef USE_PYTHON
# include "python-tg.h"
#endif
//#include "mtproto-common.h"
#include <tgl/tgl.h>
......@@ -1116,6 +1120,7 @@ extern char *downloads_directory;
extern char *config_directory;
extern char *binlog_file_name;
extern char *lua_file;
extern char *python_file;
extern struct event *term_ev;
void do_clear (int arg_num, struct arg args[], struct in_ev *ev) {
......@@ -1130,6 +1135,7 @@ void do_clear (int arg_num, struct arg args[], struct in_ev *ev) {
free (config_directory);
free (binlog_file_name);
free (lua_file);
free (python_file);
clear_history ();
event_free (term_ev);
event_base_free (TLS->ev_base);
......@@ -1933,6 +1939,9 @@ void print_message_gw (struct tgl_state *TLSR, struct tgl_message *M) {
#ifdef USE_LUA
lua_new_msg (M);
#endif
#ifdef USE_PYTHON
py_new_msg (M);
#endif
if (!binlog_read) { return; }
if (tgl_get_peer_type (M->to_id) == TGL_PEER_ENCR_CHAT) {
write_secret_chat_file ();
......@@ -1952,6 +1961,9 @@ void our_id_gw (struct tgl_state *TLSR, int id) {
#ifdef USE_LUA
lua_our_id (id);
#endif
#ifdef USE_PYTHON
py_our_id (id);
#endif
}
void print_peer_updates (struct in_ev *ev, int flags) {
......@@ -2004,7 +2016,10 @@ void user_update_gw (struct tgl_state *TLSR, struct tgl_user *U, unsigned flags)
#ifdef USE_LUA
lua_user_update (U, flags);
#endif
#ifdef USE_PYTHON
py_user_update (U, flags);
#endif
if (disable_output && !notify_ev) { return; }
if (!binlog_read) { return; }
struct in_ev *ev = notify_ev;
......@@ -2031,7 +2046,10 @@ void chat_update_gw (struct tgl_state *TLSR, struct tgl_chat *U, unsigned flags)
#ifdef USE_LUA
lua_chat_update (U, flags);
#endif
#ifdef USE_PYTHON
py_chat_update (U, flags);
#endif
if (disable_output && !notify_ev) { return; }
if (!binlog_read) { return; }
struct in_ev *ev = notify_ev;
......@@ -2058,7 +2076,12 @@ void secret_chat_update_gw (struct tgl_state *TLSR, struct tgl_secret_chat *U, u
#ifdef USE_LUA
lua_secret_chat_update (U, flags);
#endif
#ifdef USE_PYTHON
py_secret_chat_update (U, flags);
#endif
if ((flags & TGL_UPDATE_WORKING) || (flags & TGL_UPDATE_DELETED)) {
write_secret_chat_file ();
}
......
......@@ -74,6 +74,10 @@
# include "lua-tg.h"
#endif
#ifdef USE_PYTHON
# include "python-tg.h"
#endif
#include <tgl/tgl.h>
#define PROGNAME "telegram-cli"
......@@ -106,6 +110,7 @@ char *downloads_directory;
char *config_directory;
char *binlog_file_name;
char *lua_file;
char *python_file;
int binlog_enabled;
extern int log_level;
int sync_from_start;
......@@ -378,6 +383,10 @@ void parse_config (void) {
parse_config_val (&conf, &lua_file, "lua_script", 0, config_directory);
}
if (!python_file) {
parse_config_val (&conf, &python_file, "python_script", 0, config_directory);
}
strcpy (buf + l, "binlog_enabled");
config_lookup_bool (&conf, buf, &binlog_enabled);
......@@ -640,6 +649,11 @@ void args_parse (int argc, char **argv) {
break;
#endif
case 'W':
#ifdef USE_PYTHON
case 'Z':
python_file = strdup (optarg);
break;
#endif
wait_dialog_list = 1;
break;
case 'C':
......@@ -878,6 +892,12 @@ int main (int argc, char **argv) {
lua_init (lua_file);
}
#endif
#ifdef USE_PYTHON
if (python_file) {
py_init (python_file);
}
#endif
inner_main ();
......
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