From 6e86f81e27a02d30147b52e1c6886f8a3a4bb1e1 Mon Sep 17 00:00:00 2001 From: vvaltman Date: Fri, 24 Apr 2015 18:48:54 +0300 Subject: [PATCH] fixed clear. added view command to view urls and geo --- interface.c | 13 +++++++++++-- main.c | 2 +- tgl | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/interface.c b/interface.c index 86fb4d3..1464cb8 100644 --- a/interface.c +++ b/interface.c @@ -756,6 +756,12 @@ void do_ ## act ## _ ## tp (int arg_num, struct arg args[], struct in_ev *ev) { tgl_do_load_document (TLS, &M->media.document, actf, ev);\ } else if (M->media.type == tgl_message_media_photo_encr || M->media.type == tgl_message_media_document_encr) {\ tgl_do_load_encr_document (TLS, &M->media.encr_document, actf, ev); \ + } else if (M->media.type == tgl_message_media_webpage) {\ + actf (TLS, ev, 1, M->media.webpage.url);\ + } else if (M->media.type == tgl_message_media_geo || M->media.type == tgl_message_media_venue) { \ + static char s[1000]; \ + sprintf (s, "https://maps.google.com/?q=%.6lf,%.6lf", M->media.geo.latitude, M->media.geo.longitude);\ + actf (TLS, ev, 1, s);\ }\ }\ } @@ -787,6 +793,7 @@ DO_LOAD_PHOTO(file, open, open_filename_gw) DO_LOAD_PHOTO_THUMB(video, open, open_filename_gw) DO_LOAD_PHOTO_THUMB(document, open, open_filename_gw) DO_LOAD_PHOTO_THUMB(file, open, open_filename_gw) +DO_LOAD_PHOTO(any, open, open_filename_gw) void do_add_contact (int arg_num, struct arg args[], struct in_ev *ev) { assert (arg_num == 3); @@ -1139,7 +1146,7 @@ void do_clear (int arg_num, struct arg args[], struct in_ev *ev) { logprintf ("Do_clear\n"); free (default_username); free (config_filename); - free (prefix); + //free (prefix); free (auth_file_name); free (state_file_name); free (secret_chat_file_name); @@ -1149,8 +1156,9 @@ void do_clear (int arg_num, struct arg args[], struct in_ev *ev) { free (lua_file); clear_history (); event_free (term_ev); - event_base_free (TLS->ev_base); + struct event_base *ev_base = TLS->ev_base; tgl_free_all (TLS); + event_base_free (ev_base); do_halt (0); } @@ -1232,6 +1240,7 @@ struct command commands[] = { {"view_photo", {ca_number, ca_none}, do_open_photo, "view_photo \tDownloads file to downloads dirs. Then tries to open it with system default action"}, {"view_video", {ca_number, ca_none}, do_open_video, "view_video \tDownloads file to downloads dirs. Then tries to open it with system default action"}, {"view_video_thumb", {ca_number, ca_none}, do_open_video_thumb, "view_video_thumb \tDownloads file to downloads dirs. Then tries to open it with system default action"}, + {"view", {ca_number, ca_none}, do_open_any, "view \tTries to view message contents"}, {"visualize_key", {ca_secret_chat, ca_none}, do_visualize_key, "visualize_key \tPrints visualization of encryption key (first 16 bytes sha1 of it in fact}"}, {0, {ca_none}, 0, ""} }; diff --git a/main.c b/main.c index 4caf4ef..c642916 100644 --- a/main.c +++ b/main.c @@ -617,7 +617,7 @@ void args_parse (int argc, char **argv) { config_filename = tstrdup (optarg); break; case 'p': - prefix = tstrdup (optarg); + prefix = optarg; assert (strlen (prefix) <= 100); break; #else diff --git a/tgl b/tgl index a48066b..409a2ba 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit a48066bb6dbfedb74ddbe302c19b5e9ef856fffb +Subproject commit 409a2ba561dfcf8c81e62fa44babce6a805bd811