From 100edb6628a3bcd0d27af3aa4d00e3557c2e451f Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Fri, 23 Jun 2017 21:57:44 +0100 Subject: [PATCH] Fix some mistakes. The counter was missing the kamokan prefix SelfDestruct was not working --- src/kamokan_impl/retrieve_pastie.lua | 2 +- src/kamokan_impl/storage.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/kamokan_impl/retrieve_pastie.lua b/src/kamokan_impl/retrieve_pastie.lua index 7ee677f..926cbd1 100644 --- a/src/kamokan_impl/retrieve_pastie.lua +++ b/src/kamokan_impl/retrieve_pastie.lua @@ -8,7 +8,7 @@ end local selfdes = 0 local deleted = 0 -if result[2] == 1 then +if result[2] == "1" then deleted = redis.call("DEL", full_token) selfdes = 1 end diff --git a/src/kamokan_impl/storage.cpp b/src/kamokan_impl/storage.cpp index a9085bc..ac3ec8c 100644 --- a/src/kamokan_impl/storage.cpp +++ b/src/kamokan_impl/storage.cpp @@ -30,9 +30,11 @@ #include #include +#define TOKEN_PREFIX "kamokan:{store:}" + namespace kamokan { namespace { - const char g_token_prefix[] = "kamokan:{store:}"; + const char g_token_prefix[] = TOKEN_PREFIX; redis::IncRedis make_incredis (const SettingsBag& parSettings) { using redis::IncRedis; @@ -144,7 +146,7 @@ namespace kamokan { redis::Script retrieve = m_redis->command().make_script(string_view(g_save_script, g_save_script_size)); auto batch = m_redis->command().make_batch(); { - string_view paste_counter_token("{store:}paste_counter"); + string_view paste_counter_token(TOKEN_PREFIX "paste_counter"); std::string prefix(g_token_prefix); const auto expiry = lexical_cast(parExpiry); const auto self_des = string_view(parSelfDestruct ? "1" : "0"); @@ -230,3 +232,5 @@ namespace kamokan { } #endif } //namespace kamokan + +#undef TOKEN_PREFIX