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
4b4a2053
Commit
4b4a2053
authored
Oct 14, 2015
by
V V
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commented binlog code1
parent
aabdd3d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
12 deletions
+24
-12
config.sample
config.sample
+1
-6
interface.c
interface.c
+4
-0
main.c
main.c
+18
-5
tgl
tgl
+1
-1
No files found.
config.sample
View file @
4b4a2053
...
...
@@ -7,14 +7,12 @@ test_dc1 = {
config_directory = ".telegram/test_dc1";
test = true;
msg_num = true;
binlog_enabled = true;
};
binlog = {
config_directory = ".telegram/binlog";
test = false;
msg_num = true;
binlog_enabled = true;
log_level = 2;
};
...
...
@@ -22,7 +20,6 @@ binlog_mts = {
config_directory = ".telegram/binlog_mts";
test = false;
msg_num = true;
binlog_enabled = true;
log_level = 2;
};
...
...
@@ -30,7 +27,6 @@ mega = {
config_directory = ".telegram/mega";
test = false;
msg_num = true;
binlog_enabled = true;
log_level = 2;
};
...
...
@@ -55,12 +51,11 @@ test = {
test1 = {
config_directory = ".telegram/test1";
msg_num = true;
binlog_enabled = true;
};
test2 = {
config_directory = ".telegram/test2";
msg_num = true;
binlog
_enabled = true;
pfs
_enabled = true;
};
interface.c
View file @
4b4a2053
...
...
@@ -111,6 +111,7 @@ int permanent_peer_id_mode;
int
disable_colors
;
extern
int
alert_sound
;
extern
int
binlog_read
;
extern
char
*
home_directory
;
int
safe_quit
;
...
...
@@ -1589,6 +1590,9 @@ void do_clear (struct command *command, int arg_num, struct arg args[], struct i
tfree_str
(
binlog_file_name
);
tfree_str
(
lua_file
);
tfree_str
(
python_file
);
if
(
home_directory
)
{
tfree_str
(
home_directory
);
}
clear_history
();
event_free
(
term_ev
);
struct
event_base
*
ev_base
=
TLS
->
ev_base
;
...
...
main.c
View file @
4b4a2053
...
...
@@ -121,6 +121,7 @@ int alert_sound;
int
exit_code
;
int
permanent_msg_id_mode
;
int
permanent_peer_id_mode
;
char
*
home_directory
;
struct
tgl_state
*
TLS
;
...
...
@@ -167,11 +168,11 @@ int str_empty (char *str) {
}
char
*
get_home_directory
(
void
)
{
static
char
*
home_directory
=
NULL
;
if
(
home_directory
)
{
return
home_directory
;
}
home_directory
=
getenv
(
"TELEGRAM_HOME"
);
if
(
!
str_empty
(
home_directory
))
{
return
tstrdup
(
home_directory
);
}
if
(
!
str_empty
(
home_directory
))
{
return
home_directory
=
tstrdup
(
home_directory
);
}
home_directory
=
getenv
(
"HOME"
);
if
(
!
str_empty
(
home_directory
))
{
return
tstrdup
(
home_directory
);
}
if
(
!
str_empty
(
home_directory
))
{
return
home_directory
=
tstrdup
(
home_directory
);
}
struct
passwd
*
current_passwd
;
uid_t
user_id
;
setpwent
();
...
...
@@ -372,9 +373,13 @@ void parse_config (void) {
if
(
!
python_file
)
{
parse_config_val
(
&
conf
,
&
python_file
,
"python_script"
,
0
,
config_directory
);
}
#if 0
strcpy (buf + l, "binlog_enabled");
config_lookup_bool (&conf, buf, &binlog_enabled);
#else
binlog_enabled
=
0
;
#endif
int
pfs_enabled
=
0
;
strcpy
(
buf
+
l
,
"pfs_enabled"
);
...
...
@@ -415,7 +420,7 @@ void parse_config (void) {
printf
(
"libconfig not enabled
\n
"
);
}
tasprintf
(
&
downloads_directory
,
"%s/%s/%s"
,
get_home_directory
(),
CONFIG_DIRECTORY
,
DOWNLOADS_DIRECTORY
);
if
(
binlog_enabled
)
{
tasprintf
(
&
binlog_file_name
,
"%s/%s/%s"
,
get_home_directory
(),
CONFIG_DIRECTORY
,
BINLOG_FILE
);
tgl_set_binlog_mode
(
TLS
,
1
);
...
...
@@ -451,8 +456,10 @@ void usage (void) {
printf
(
" --config/-c config file name
\n
"
);
printf
(
" --profile/-p use specified profile
\n
"
);
#else
#if 0
printf (" --enable-binlog/-B enable binlog\n");
#endif
#endif
printf
(
" --log-level/-l log level
\n
"
);
printf
(
" --sync-from-start/-f during authorization fetch all messages since registration
\n
"
);
printf
(
" --disable-auto-accept/-E disable auto accept of encrypted chats
\n
"
);
...
...
@@ -605,7 +612,9 @@ void args_parse (int argc, char **argv) {
{
"config"
,
required_argument
,
0
,
'c'
},
{
"profile"
,
required_argument
,
0
,
'p'
},
#else
#if 0
{"enable-binlog", no_argument, 0, 'B'},
#endif
#endif
{
"log-level"
,
required_argument
,
0
,
'l'
},
{
"sync-from-start"
,
no_argument
,
0
,
'f'
},
...
...
@@ -647,7 +656,9 @@ void args_parse (int argc, char **argv) {
#ifdef HAVE_LIBCONFIG
"c:p:"
#else
#if 0
"B"
#endif
#endif
#ifdef USE_LUA
"s:"
...
...
@@ -694,9 +705,11 @@ void args_parse (int argc, char **argv) {
assert
(
strlen
(
prefix
)
<=
100
);
break
;
#else
#if 0
case 'B':
binlog_enabled = 1;
break;
#endif
#endif
case
'l'
:
log_level
=
atoi
(
optarg
);
...
...
tgl
@
5b18232e
Subproject commit
f8fd296f7cecf6d0ea3a4a7c8d6a9b0fc9ee99e8
Subproject commit
5b18232e9ba1ec696843710b851120a2653cc801
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