Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
3c6b54c6
Commit
3c6b54c6
authored
May 02, 2015
by
Vincent Castellano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merging to remove bad branch
parent
5fcb8254
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
564 additions
and
4 deletions
+564
-4
Makefile.in
Makefile.in
+1
-1
config.h.in
config.h.in
+3
-0
configure
configure
+515
-1
interface.c
interface.c
+25
-2
main.c
main.c
+20
-0
No files found.
Makefile.in
View file @
3c6b54c6
...
...
@@ -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
${
OBJ
}
/json-tg.o
TG_OBJECTS
=
${
OBJ
}
/main.o
${
OBJ
}
/loop.o
${
OBJ
}
/interface.o
${
OBJ
}
/lua-tg.o
${
OBJ
}
/json-tg.o
${
OBJ
}
/python-tg.o
INCLUDE
=
-I
.
-I
${
srcdir
}
-I
${
srcdir
}
/tgl
CC
=
@CC@
...
...
config.h.in
View file @
3c6b54c6
...
...
@@ -167,6 +167,9 @@
/* fixed for correct valgrind work */
#undef VALGRIND_FIXES
/* use python */
#undef USE_PYTHON
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
...
...
configure
View file @
3c6b54c6
This diff is collapsed.
Click to expand it.
interface.c
View file @
3c6b54c6
...
...
@@ -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>
...
...
@@ -1265,6 +1269,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
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
...
...
@@ -1279,6 +1284,7 @@ void do_clear (struct command *command, int arg_num, struct arg args[], struct i
free
(
config_directory
);
free
(
binlog_file_name
);
free
(
lua_file
);
free
(
python_file
);
clear_history
();
event_free
(
term_ev
);
struct
event_base
*
ev_base
=
TLS
->
ev_base
;
...
...
@@ -2307,6 +2313,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
();
...
...
@@ -2336,6 +2345,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
)
{
...
...
@@ -2401,7 +2413,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
;
...
...
@@ -2432,7 +2447,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
;
...
...
@@ -2463,7 +2481,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
();
}
...
...
main.c
View file @
3c6b54c6
...
...
@@ -75,6 +75,10 @@
# include "lua-tg.h"
#endif
#ifdef USE_PYTHON
# include "python-tg.h"
#endif
#include <tgl/tgl.h>
#define PROGNAME "telegram-cli"
...
...
@@ -107,6 +111,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
;
...
...
@@ -381,6 +386,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
);
...
...
@@ -698,6 +707,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'
:
...
...
@@ -942,6 +956,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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment