From a8a655a19d7b81de052613108761a9008142c161 Mon Sep 17 00:00:00 2001 From: Trapenok Victor Date: Tue, 1 Aug 2017 17:38:31 +1000 Subject: [PATCH 1/3] fix for track_pipe_users function --- src/Client_connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client_connection.cpp b/src/Client_connection.cpp index 2623f02..d0c2c65 100644 --- a/src/Client_connection.cpp +++ b/src/Client_connection.cpp @@ -987,7 +987,7 @@ int Client_connection::track_pipe_users(thread_data* local_buf, char* event_data } - std::string usersstr("{\"event_name\":\"answer\",\"data\":{"); + std::string usersstr("{\"event_name\":\"answer\",\"data\":{\"users\":["); char strtmp[200]; TagLoger::log(Log_ClientServer, 0, "track_pipe_users pipe:%s\n", name); @@ -1016,7 +1016,7 @@ int Client_connection::track_pipe_users(thread_data* local_buf, char* event_data } } - usersstr.append("},\"marker\":\"").append(marker).append("\""); + usersstr.append("]},\"marker\":\"").append(marker).append("\""); std::string rdname("_answer_to_"); rdname.append(name); From 7d2e62c4da5afedf1693d7ea903f9c00f881290c Mon Sep 17 00:00:00 2001 From: Trapenok Victor Date: Tue, 1 Aug 2017 18:00:04 +1000 Subject: [PATCH 2/3] fix for track_pipe_users function --- src/Client_connection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client_connection.cpp b/src/Client_connection.cpp index d0c2c65..0ea33fe 100644 --- a/src/Client_connection.cpp +++ b/src/Client_connection.cpp @@ -1016,7 +1016,7 @@ int Client_connection::track_pipe_users(thread_data* local_buf, char* event_data } } - usersstr.append("]},\"marker\":\"").append(marker).append("\""); + usersstr.append("]},\"marker\":\"").append(marker).append("\"}"); std::string rdname("_answer_to_"); rdname.append(name); From e655121376171f94bb18458c98ae5a4176e19c0b Mon Sep 17 00:00:00 2001 From: Trapenok Victor Date: Mon, 7 Aug 2017 14:56:09 +1000 Subject: [PATCH 3/3] complete function track_pipe_users --- CHANGELOG.md | 1 + src/Client_connection.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7334ebd..1d19345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ BUG FIXES: BUG FIXES: * Js Api version 3.28 (Fix bug in auth callbacks) * Fix bug in auth callbacks + * complete api function getTrackPipeUsers ## v3.1 diff --git a/src/Client_connection.cpp b/src/Client_connection.cpp index 0ea33fe..437c281 100644 --- a/src/Client_connection.cpp +++ b/src/Client_connection.cpp @@ -1003,8 +1003,9 @@ int Client_connection::track_pipe_users(thread_data* local_buf, char* event_data CP r = tcpServer ::instance()->get(conection_id); if(r) { + // @todo отдавать всем не uuid а его солёный хеш. bzero(strtmp, 200); - snprintf(strtmp, 200, "{\"user_id\":\"%d\",\"uuid\":\"%s\"}", r->web_user_id, r->web_user_uuid); + snprintf(strtmp, 200, "{\"user_id\":%d,\"uuid\":\"%s\"}", r->web_user_id, r->web_user_uuid); usersstr.append(strtmp); } @@ -1016,13 +1017,15 @@ int Client_connection::track_pipe_users(thread_data* local_buf, char* event_data } } - usersstr.append("]},\"marker\":\"").append(marker).append("\"}"); + usersstr.append("]}}"); std::string rdname("_answer_to_"); rdname.append(name); + std::string addData("\"marker\":\""); + addData.append(marker).append("\""); TagLoger::log(Log_ClientServer, 0, "answer:%s\n", usersstr.data()); - if(message(local_buf, base64_encode( (const char*)usersstr.data()).data() , rdname.data()) < 0) + if(message(local_buf, base64_encode( (const char*)usersstr.data()).data() , rdname.data(), MESSAGE_TEXT, addData.data()) < 0) { return -1; }