From f144d3ff30a1ea79f63f82900b3471203e9b580d Mon Sep 17 00:00:00 2001 From: vvaltman Date: Mon, 27 Apr 2015 13:43:31 +0300 Subject: [PATCH] added get message query --- config.h.in | 3 +++ configure | 20 ++++++++++++++++++++ configure.ac | 10 ++++++++++ interface.c | 7 +++++++ tgl | 2 +- 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/config.h.in b/config.h.in index 47e7e60..56902f3 100644 --- a/config.h.in +++ b/config.h.in @@ -158,6 +158,9 @@ /* use lua */ #undef USE_LUA +/* fixed for correct valgrind work */ +#undef VALGRIND_FIXES + /* Define to `int' if doesn't define. */ #undef gid_t diff --git a/configure b/configure index 5cf26fd..288d320 100755 --- a/configure +++ b/configure @@ -695,6 +695,7 @@ enable_libconfig enable_extf enable_liblua with_progname +enable_valgrind ' ac_precious_vars='build_alias host_alias @@ -1320,6 +1321,7 @@ Optional Features: --enable-libconfig/--disable-libconfig --enable-extf/--disable-extf --enable-liblua/--disable-liblua +--enable-valgrind/--disable-valgrind Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -5892,6 +5894,24 @@ $as_echo "default" >&6; } fi +# Check whether --enable-valgrind was given. +if test "${enable_valgrind+set}" = set; then : + enableval=$enable_valgrind; + if test "x$enableval" = "xyes" ; then + ac_fn_c_check_header_mongrel "$LINENO" "valgrind/memcheck.h" "ac_cv_header_valgrind_memcheck_h" "$ac_includes_default" +if test "x$ac_cv_header_valgrind_memcheck_h" = xyes; then : + +$as_echo "#define VALGRIND_FIXES 1" >>confdefs.h + +fi + + + fi + +fi + + + # Checks for header files. for ac_header in execinfo.h fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h do : diff --git a/configure.ac b/configure.ac index 27393e8..44a6767 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,16 @@ AC_ARG_WITH(progname,[--with-progname=], ],[ AC_MSG_RESULT([default]) ]) + +AC_ARG_ENABLE(valgrind,[--enable-valgrind/--disable-valgrind], + [ + if test "x$enableval" = "xyes" ; then + AC_CHECK_HEADER(valgrind/memcheck.h, [AC_DEFINE([VALGRIND_FIXES], [1], [fixed for correct valgrind work])], [ + ]) + fi + ],[ + ]) + # Checks for header files. AC_CHECK_HEADERS([execinfo.h fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h]) diff --git a/interface.c b/interface.c index 1464cb8..9322047 100644 --- a/interface.c +++ b/interface.c @@ -715,6 +715,12 @@ void do_fwd_media (int arg_num, struct arg args[], struct in_ev *ev) { tgl_do_forward_message (TLS, args[0].P->id, args[1].num, print_msg_success_gw, ev); } +void do_get_message (int arg_num, struct arg args[], struct in_ev *ev) { + assert (arg_num == 1); + if (ev) { ev->refcnt ++; } + tgl_do_get_message (TLS, args[0].num, print_msg_gw, ev); +} + void do_msg (int arg_num, struct arg args[], struct in_ev *ev) { assert (arg_num == 2); if (ev) { ev->refcnt ++; } @@ -1189,6 +1195,7 @@ struct command commands[] = { {"export_card", {ca_none}, do_export_card, "export_card\tPrints card that can be imported by another user with import_card method"}, {"fwd", {ca_peer, ca_number, ca_period, ca_none}, do_fwd, "fwd +\tForwards message to peer. Forward to secret chats is forbidden"}, {"fwd_media", {ca_peer, ca_number, ca_none}, do_fwd_media, "fwd \tForwards message media to peer. Forward to secret chats is forbidden. Result slightly differs from fwd"}, + {"get_message", {ca_number, ca_none}, do_get_message, "get_message \tGet message by id"}, {"help", {ca_none}, do_help, "help\tPrints this help"}, {"history", {ca_peer, ca_number | ca_optional, ca_number | ca_optional, ca_none}, do_history, "history [limit] [offset]\tPrints messages with this peer (most recent message lower). Also marks messages as read"}, {"import_card", {ca_string, ca_none}, do_import_card, "import_card \tGets user by card and prints it name. You can then send messages to him as usual"}, diff --git a/tgl b/tgl index 409a2ba..39c853c 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 409a2ba561dfcf8c81e62fa44babce6a805bd811 +Subproject commit 39c853c03f740b7be3a2883145f80346cef2d0ff