From 681b8e790055c557533183b31b48774bb98fdc0b Mon Sep 17 00:00:00 2001 From: Marcelo Fuentes Date: Mon, 2 Nov 2015 21:05:23 -0300 Subject: [PATCH 1/4] use str_format_time function on user_info command --- json-tg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/json-tg.c b/json-tg.c index fece57f..57e33c8 100644 --- a/json-tg.c +++ b/json-tg.c @@ -32,11 +32,23 @@ void json_pack_peer_type (json_t *res, tgl_peer_id_t id) { } } +int str_format_time(long when, char* string) +{ + struct tm *tm = localtime ((void *)&when); + return sprintf (string, "%04d-%02d-%02d %02d:%02d:%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); +} void json_pack_user (json_t *res, tgl_peer_t *P) { if (P->user.first_name) { assert (json_object_set (res, "first_name", json_string (P->user.first_name)) >= 0); } + + if (P->user.status.when) { + static char s[20]; + str_format_time(P->user.status.when, s); + assert (json_object_set (res, "when", json_string (s)) >= 0); + } + if (P->user.last_name) { assert (json_object_set (res, "last_name", json_string (P->user.last_name)) >= 0); } @@ -436,12 +448,6 @@ json_t *json_pack_read (struct tgl_message *M) { return res; } -int str_format_time(long when, char* string) -{ - struct tm *tm = localtime ((void *)&when); - return sprintf (string, "%04d-%02d-%02d %02d:%02d:%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); -} - json_t *json_pack_user_status (struct tgl_user *U) { json_t *res = json_object (); assert (json_object_set (res, "user", json_pack_peer (U->id)) >= 0); From bde3a39be9b6366fe93da623db1ceadd80666bd0 Mon Sep 17 00:00:00 2001 From: V V Date: Tue, 22 Dec 2015 15:55:02 +0300 Subject: [PATCH 2/4] updated tgl --- tgl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgl b/tgl index 418f81b..08b6340 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 418f81be448fdebb04c3809795f8c160ee13280c +Subproject commit 08b6340c1cbf1ef59690007b0207de9d5c904c07 From a7ade1b76e83e3a79fef9cdc1f3ae27e9f70e48e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 28 Dec 2015 13:45:24 +0100 Subject: [PATCH 3/4] Trying to fix travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 51df285..711752f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ compiler: - clang install: + - sudo apt-get update - sudo apt-get install libconfig8-dev - sudo apt-get install libreadline6-dev - sudo apt-get install libssl-dev From c16ad44d5e0f69c2b6c854e8aff55497595998d5 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 28 Dec 2015 13:47:17 +0100 Subject: [PATCH 4/4] Trigger travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 711752f..0f293e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,3 +18,4 @@ script: - git submodule update --init --recursive - ./configure - make +