commented binlog code1

This commit is contained in:
V V 2015-10-14 18:13:43 +03:00
parent aabdd3d6e2
commit 4b4a2053ad
4 changed files with 24 additions and 12 deletions

View File

@ -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;
};

View File

@ -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;

19
main.c
View File

@ -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 ();
@ -373,8 +374,12 @@ void parse_config (void) {
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");
@ -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,8 +612,10 @@ 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'},
{"disable-auto-accept", no_argument, 0, 'E'},
@ -647,8 +656,10 @@ void args_parse (int argc, char **argv) {
#ifdef HAVE_LIBCONFIG
"c:p:"
#else
#if 0
"B"
#endif
#endif
#ifdef USE_LUA
"s:"
#endif
@ -694,10 +705,12 @@ 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);
break;

2
tgl

@ -1 +1 @@
Subproject commit f8fd296f7cecf6d0ea3a4a7c8d6a9b0fc9ee99e8
Subproject commit 5b18232e9ba1ec696843710b851120a2653cc801