diff --git a/msglog.c b/msglog.c index a2c59f2..029a426 100644 --- a/msglog.c +++ b/msglog.c @@ -10,29 +10,6 @@ #define COLOR_GREEN "\033[32;1m" #define COLOR_NORMAL "\033[0m" -/** - * Log a message to the telegram-cli message log, by - * just writing it to STDOUT and appending '***' - */ -void log_printf(const char *format, va_list ap) -{ - vprintf (format, ap); -} - -/** - * The callback that will log the given msg to the used target - */ -void (*log_cb)(const char* format, va_list ap) = log_printf; - -/** - * Set a custom logging callback to use instead of the regular - * printf to stdout - */ -void set_log_cb(void (*cb)(const char*, va_list ap)) -{ - log_cb = cb; -} - void hexdump (int *in_ptr, int *in_end) { int *ptr = in_ptr; while (ptr < in_end) { printf (" %08x", *(ptr ++)); } diff --git a/msglog.h b/msglog.h index 952b61c..17e324d 100644 --- a/msglog.h +++ b/msglog.h @@ -4,7 +4,6 @@ * Set a custom logging callback to use instead of regular printing * to stdout */ -void set_log_cb(void (*cb)(const char*, va_list ap)); void hexdump (int *in_ptr, int *in_end); void debug(const char* format, ...); diff --git a/purple-plugin/telegram-purple.c b/purple-plugin/telegram-purple.c index 24e9116..0014d95 100644 --- a/purple-plugin/telegram-purple.c +++ b/purple-plugin/telegram-purple.c @@ -61,17 +61,6 @@ PurpleGroup *tggroup; void tgprpl_login_on_connected(); -/** - * Formats the given format string with the given arguments and writes - * it to the libpurple log - */ -void tg_cli_log_cb(const char* format, va_list ap) -{ - char buffer[256]; - vsnprintf(buffer, sizeof(buffer), format, ap); - purple_debug_info(PLUGIN_ID, "%s", buffer); -} - void message_allocated_handler (struct telegram *instance, struct message *M); void peer_allocated_handler (struct telegram *instance, void *user); void user_info_received_handler (struct telegram *instance, struct tgl_user *user, int showInfo); @@ -934,7 +923,6 @@ static GList *tgprpl_status_types(PurpleAccount * acct) static void tgprpl_set_status(PurpleAccount * acct, PurpleStatus * status) { purple_debug_info(PLUGIN_ID, "tgprpl_set_status()\n"); - } /** @@ -1229,10 +1217,7 @@ static void tgprpl_init(PurplePlugin *plugin) PurpleAccountOption *option; PurpleAccountUserSplit *split; GList *verification_values = NULL; - - // Redirect the msglog of the telegram-cli application to the libpurple logger - set_log_cb(&tg_cli_log_cb); - + // Extra Options #define ADD_VALUE(list, desc, v) { \ PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \ diff --git a/structures.c b/structures.c index ed30181..79df0bd 100644 --- a/structures.c +++ b/structures.c @@ -39,7 +39,6 @@ DEFINE_TREE(peer,peer_t *,peer_cmp,0) DEFINE_TREE(peer_by_name,peer_t *,peer_cmp_name,0) DEFINE_TREE(message,struct message *,id_cmp,0) - struct message message_list = { .next_use = &message_list, .prev_use = &message_list diff --git a/telegram.c b/telegram.c index 8c27259..941e9dd 100755 --- a/telegram.c +++ b/telegram.c @@ -454,20 +454,6 @@ void telegram_dl_next (struct telegram *instance) } } -/** - * Login, and perform a registration when needed - */ -int telegram_login(struct telegram *instance) -{ - if (instance->session_state != STATE_AUTHORIZED) { - debug("Cannot log in, invalid state: %d \n", instance->session_state); - return -1; - } - do_help_get_config(instance); - telegram_change_state(instance, STATE_CONFIG_REQUESTED, NULL); - return 0; -} - void on_authorized(struct mtproto_connection *c UU, void *data) { debug ("on_authorized()...\n"); diff --git a/telegram.h b/telegram.h index 5901518..95fdde7 100644 --- a/telegram.h +++ b/telegram.h @@ -331,8 +331,6 @@ void telegram_change_state(struct telegram *instance, int state, void *data); */ void telegram_connect(struct telegram *instance); -int telegram_login (struct telegram *instance); - /** * Read and process all available input from the network */ @@ -425,7 +423,6 @@ struct mtproto_connection *telegram_add_proxy(struct telegram *tg, struct proxy_ int telegram_authenticated (struct telegram *instance); void telegram_flush (struct telegram *instance); - void telegram_dl_add (struct telegram *instance, struct download *dl); void telegram_dl_next (struct telegram *instance);