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
7d2cac9e
Commit
7d2cac9e
authored
May 02, 2015
by
Vincent Castellano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merging to remove bad branch
parent
0f4ceaa2
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
563 additions
and
4 deletions
+563
-4
Makefile.in
Makefile.in
+1
-1
config.h.in
config.h.in
+3
-0
configure
configure
+514
-1
interface.c
interface.c
+25
-2
main.c
main.c
+20
-0
No files found.
Makefile.in
View file @
7d2cac9e
...
@@ -19,7 +19,7 @@ DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${LIB} ${DEP}/auto ${OBJ}/auto
...
@@ -19,7 +19,7 @@ DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${LIB} ${DEP}/auto ${OBJ}/auto
EXE_LIST
=
${
EXE
}
/telegram-cli
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
}
INCLUDE
=
-I
.
-I
${
srcdir
}
CC
=
@CC@
CC
=
@CC@
...
...
config.h.in
View file @
7d2cac9e
...
@@ -158,6 +158,9 @@
...
@@ -158,6 +158,9 @@
/* use lua */
/* use lua */
#undef USE_LUA
#undef USE_LUA
/* use python */
#undef USE_PYTHON
/* Define to `int' if <sys/types.h> doesn't define. */
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
#undef gid_t
...
...
configure
View file @
7d2cac9e
This diff is collapsed.
Click to expand it.
interface.c
View file @
7d2cac9e
...
@@ -59,6 +59,10 @@
...
@@ -59,6 +59,10 @@
# include "lua-tg.h"
# include "lua-tg.h"
#endif
#endif
#ifdef USE_PYTHON
# include "python-tg.h"
#endif
//#include "mtproto-common.h"
//#include "mtproto-common.h"
#include <tgl/tgl.h>
#include <tgl/tgl.h>
...
@@ -1116,6 +1120,7 @@ extern char *downloads_directory;
...
@@ -1116,6 +1120,7 @@ extern char *downloads_directory;
extern
char
*
config_directory
;
extern
char
*
config_directory
;
extern
char
*
binlog_file_name
;
extern
char
*
binlog_file_name
;
extern
char
*
lua_file
;
extern
char
*
lua_file
;
extern
char
*
python_file
;
extern
struct
event
*
term_ev
;
extern
struct
event
*
term_ev
;
void
do_clear
(
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
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) {
...
@@ -1130,6 +1135,7 @@ void do_clear (int arg_num, struct arg args[], struct in_ev *ev) {
free
(
config_directory
);
free
(
config_directory
);
free
(
binlog_file_name
);
free
(
binlog_file_name
);
free
(
lua_file
);
free
(
lua_file
);
free
(
python_file
);
clear_history
();
clear_history
();
event_free
(
term_ev
);
event_free
(
term_ev
);
event_base_free
(
TLS
->
ev_base
);
event_base_free
(
TLS
->
ev_base
);
...
@@ -1933,6 +1939,9 @@ void print_message_gw (struct tgl_state *TLSR, struct tgl_message *M) {
...
@@ -1933,6 +1939,9 @@ void print_message_gw (struct tgl_state *TLSR, struct tgl_message *M) {
#ifdef USE_LUA
#ifdef USE_LUA
lua_new_msg
(
M
);
lua_new_msg
(
M
);
#endif
#endif
#ifdef USE_PYTHON
py_new_msg
(
M
);
#endif
if
(
!
binlog_read
)
{
return
;
}
if
(
!
binlog_read
)
{
return
;
}
if
(
tgl_get_peer_type
(
M
->
to_id
)
==
TGL_PEER_ENCR_CHAT
)
{
if
(
tgl_get_peer_type
(
M
->
to_id
)
==
TGL_PEER_ENCR_CHAT
)
{
write_secret_chat_file
();
write_secret_chat_file
();
...
@@ -1952,6 +1961,9 @@ void our_id_gw (struct tgl_state *TLSR, int id) {
...
@@ -1952,6 +1961,9 @@ void our_id_gw (struct tgl_state *TLSR, int id) {
#ifdef USE_LUA
#ifdef USE_LUA
lua_our_id
(
id
);
lua_our_id
(
id
);
#endif
#endif
#ifdef USE_PYTHON
py_our_id
(
id
);
#endif
}
}
void
print_peer_updates
(
struct
in_ev
*
ev
,
int
flags
)
{
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)
...
@@ -2004,7 +2016,10 @@ void user_update_gw (struct tgl_state *TLSR, struct tgl_user *U, unsigned flags)
#ifdef USE_LUA
#ifdef USE_LUA
lua_user_update
(
U
,
flags
);
lua_user_update
(
U
,
flags
);
#endif
#endif
#ifdef USE_PYTHON
py_user_update
(
U
,
flags
);
#endif
if
(
disable_output
&&
!
notify_ev
)
{
return
;
}
if
(
disable_output
&&
!
notify_ev
)
{
return
;
}
if
(
!
binlog_read
)
{
return
;
}
if
(
!
binlog_read
)
{
return
;
}
struct
in_ev
*
ev
=
notify_ev
;
struct
in_ev
*
ev
=
notify_ev
;
...
@@ -2031,7 +2046,10 @@ void chat_update_gw (struct tgl_state *TLSR, struct tgl_chat *U, unsigned flags)
...
@@ -2031,7 +2046,10 @@ void chat_update_gw (struct tgl_state *TLSR, struct tgl_chat *U, unsigned flags)
#ifdef USE_LUA
#ifdef USE_LUA
lua_chat_update
(
U
,
flags
);
lua_chat_update
(
U
,
flags
);
#endif
#endif
#ifdef USE_PYTHON
py_chat_update
(
U
,
flags
);
#endif
if
(
disable_output
&&
!
notify_ev
)
{
return
;
}
if
(
disable_output
&&
!
notify_ev
)
{
return
;
}
if
(
!
binlog_read
)
{
return
;
}
if
(
!
binlog_read
)
{
return
;
}
struct
in_ev
*
ev
=
notify_ev
;
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
...
@@ -2058,7 +2076,12 @@ void secret_chat_update_gw (struct tgl_state *TLSR, struct tgl_secret_chat *U, u
#ifdef USE_LUA
#ifdef USE_LUA
lua_secret_chat_update
(
U
,
flags
);
lua_secret_chat_update
(
U
,
flags
);
#endif
#endif
#ifdef USE_PYTHON
py_secret_chat_update
(
U
,
flags
);
#endif
if
((
flags
&
TGL_UPDATE_WORKING
)
||
(
flags
&
TGL_UPDATE_DELETED
))
{
if
((
flags
&
TGL_UPDATE_WORKING
)
||
(
flags
&
TGL_UPDATE_DELETED
))
{
write_secret_chat_file
();
write_secret_chat_file
();
}
}
...
...
main.c
View file @
7d2cac9e
...
@@ -74,6 +74,10 @@
...
@@ -74,6 +74,10 @@
# include "lua-tg.h"
# include "lua-tg.h"
#endif
#endif
#ifdef USE_PYTHON
# include "python-tg.h"
#endif
#include <tgl/tgl.h>
#include <tgl/tgl.h>
#define PROGNAME "telegram-cli"
#define PROGNAME "telegram-cli"
...
@@ -106,6 +110,7 @@ char *downloads_directory;
...
@@ -106,6 +110,7 @@ char *downloads_directory;
char
*
config_directory
;
char
*
config_directory
;
char
*
binlog_file_name
;
char
*
binlog_file_name
;
char
*
lua_file
;
char
*
lua_file
;
char
*
python_file
;
int
binlog_enabled
;
int
binlog_enabled
;
extern
int
log_level
;
extern
int
log_level
;
int
sync_from_start
;
int
sync_from_start
;
...
@@ -378,6 +383,10 @@ void parse_config (void) {
...
@@ -378,6 +383,10 @@ void parse_config (void) {
parse_config_val
(
&
conf
,
&
lua_file
,
"lua_script"
,
0
,
config_directory
);
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"
);
strcpy
(
buf
+
l
,
"binlog_enabled"
);
config_lookup_bool
(
&
conf
,
buf
,
&
binlog_enabled
);
config_lookup_bool
(
&
conf
,
buf
,
&
binlog_enabled
);
...
@@ -640,6 +649,11 @@ void args_parse (int argc, char **argv) {
...
@@ -640,6 +649,11 @@ void args_parse (int argc, char **argv) {
break
;
break
;
#endif
#endif
case
'W'
:
case
'W'
:
#ifdef USE_PYTHON
case
'Z'
:
python_file
=
strdup
(
optarg
);
break
;
#endif
wait_dialog_list
=
1
;
wait_dialog_list
=
1
;
break
;
break
;
case
'C'
:
case
'C'
:
...
@@ -878,6 +892,12 @@ int main (int argc, char **argv) {
...
@@ -878,6 +892,12 @@ int main (int argc, char **argv) {
lua_init
(
lua_file
);
lua_init
(
lua_file
);
}
}
#endif
#endif
#ifdef USE_PYTHON
if
(
python_file
)
{
py_init
(
python_file
);
}
#endif
inner_main
();
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