diff --git a/telldus-gui/Plugins/Live/LiveMessageToken.cpp b/telldus-gui/Plugins/Live/LiveMessageToken.cpp index 0c4ace81..9c64f6d0 100644 --- a/telldus-gui/Plugins/Live/LiveMessageToken.cpp +++ b/telldus-gui/Plugins/Live/LiveMessageToken.cpp @@ -137,6 +137,16 @@ int LiveMessageTokenScriptWrapper::getInt(const QString &key, int defaultValue) return p_token.dictVal[key].intVal; } +QString LiveMessageTokenScriptWrapper::getString(const QString &key, const QString &defaultValue) const { + if (p_token.valueType != LiveMessageToken::Dictionary) { + return defaultValue; + } + if (!p_token.dictVal.contains(key)) { + return defaultValue; + } + return p_token.dictVal[key].stringVal; +} + int LiveMessageTokenScriptWrapper::intVal() const { return p_token.intVal; } diff --git a/telldus-gui/Plugins/Live/LiveMessageToken.h b/telldus-gui/Plugins/Live/LiveMessageToken.h index 5aed1f33..a94f476d 100644 --- a/telldus-gui/Plugins/Live/LiveMessageToken.h +++ b/telldus-gui/Plugins/Live/LiveMessageToken.h @@ -36,6 +36,7 @@ public slots: void add(LiveMessageTokenScriptWrapper *token); int getInt(const QString &key, int defaultValue = 0) const; + QString getString(const QString &key, const QString &defaultValue = "") const; int intVal() const;