ipv6 support

This commit is contained in:
Vysheng 2015-01-12 16:58:43 +03:00
parent f59c2a8441
commit 723416d333
3 changed files with 11 additions and 2 deletions

4
loop.c
View File

@ -97,6 +97,7 @@ extern volatile int sigterm_cnt;
extern char *start_command; extern char *start_command;
extern struct tgl_state *TLS; extern struct tgl_state *TLS;
extern int ipv6_enabled;
struct event *term_ev = 0; struct event *term_ev = 0;
int read_one_string; int read_one_string;
@ -675,6 +676,9 @@ int loop (void) {
tgl_set_download_directory (TLS, get_downloads_directory ()); tgl_set_download_directory (TLS, get_downloads_directory ());
tgl_register_app_id (TLS, TELEGRAM_CLI_APP_ID, TELEGRAM_CLI_APP_HASH); tgl_register_app_id (TLS, TELEGRAM_CLI_APP_ID, TELEGRAM_CLI_APP_HASH);
tgl_set_app_version (TLS, "Telegram-cli " TELEGRAM_CLI_VERSION); tgl_set_app_version (TLS, "Telegram-cli " TELEGRAM_CLI_VERSION);
if (ipv6_enabled) {
tgl_enable_ipv6 (TLS);
}
tgl_init (TLS); tgl_init (TLS);
if (binlog_enabled) { if (binlog_enabled) {

7
main.c
View File

@ -116,6 +116,7 @@ int disable_output;
int reset_authorization; int reset_authorization;
int port; int port;
int use_ids; int use_ids;
int ipv6_enabled;
char *start_command; char *start_command;
struct tgl_state *TLS; struct tgl_state *TLS;
@ -473,6 +474,7 @@ void usage (void) {
printf (" -S <socket-name> unix socket to create\n"); printf (" -S <socket-name> unix socket to create\n");
printf (" -e <commands> make commands end exit\n"); printf (" -e <commands> make commands end exit\n");
printf (" -I use user and chat IDs in updates instead of names\n"); printf (" -I use user and chat IDs in updates instead of names\n");
printf (" -6 use ipv6 (may be unstable)\n");
exit (1); exit (1);
} }
@ -576,7 +578,7 @@ char *unix_socket;
void args_parse (int argc, char **argv) { void args_parse (int argc, char **argv) {
TLS = tgl_state_alloc (); TLS = tgl_state_alloc ();
int opt = 0; int opt = 0;
while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:I" while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:I6"
#ifdef HAVE_LIBCONFIG #ifdef HAVE_LIBCONFIG
"c:p:" "c:p:"
#else #else
@ -671,6 +673,9 @@ void args_parse (int argc, char **argv) {
case 'I': case 'I':
use_ids ++; use_ids ++;
break; break;
case '6':
ipv6_enabled = 1;
break;
case 'h': case 'h':
default: default:
usage (); usage ();

2
tgl

@ -1 +1 @@
Subproject commit 7f370266688aed5329ea576e9795bb27e74b2bfe Subproject commit 354f2064fcb1dd9de1e1abdb091daf532d735b4a