diff options
Diffstat (limited to 'server/src/widgetgenerator.cc')
-rw-r--r-- | server/src/widgetgenerator.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/server/src/widgetgenerator.cc b/server/src/widgetgenerator.cc index 32fdaba..e9a8fee 100644 --- a/server/src/widgetgenerator.cc +++ b/server/src/widgetgenerator.cc @@ -26,6 +26,8 @@ */ #include "widgetgenerator.h" +#include "configuration.h" + static std::string send_macro_widget(Macro ¯o, Widget &widget, std::string tabs, @@ -57,9 +59,11 @@ static std::string send_macro_widget(Macro ¯o, if(luamap != "") { Value value = mapper.map(luamap); - widget.attributes["value"] = value.value; - timestamp = value.timestamp; - prefilled = "pentominos"; + if(value.timestamp > time(NULL) - Conf::pentominos_max_ttl) { + widget.attributes["value"] = value.value; + timestamp = value.timestamp; + prefilled = "pentominos"; + } } // widget.attributes.erase(widget.attributes.find("map")); } @@ -67,8 +71,10 @@ static std::string send_macro_widget(Macro ¯o, // Check if there is a previously stored value in the db... if(values.find(widget.attributes["name"]) != values.end() && (prefilled == "" || values[widget.attributes["name"]].timestamp > timestamp)) { - widget.attributes["value"] = values[widget.attributes["name"]].value; - prefilled = "pracro"; + if(values[widget.attributes["name"]].timestamp > time(NULL) - Conf::db_max_ttl) { + widget.attributes["value"] = values[widget.attributes["name"]].value; + prefilled = "pracro"; + } } while(p != widget.attributes.end()) { |