summaryrefslogtreecommitdiffstats
path: root/Sluift
diff options
context:
space:
mode:
Diffstat (limited to 'Sluift')
-rw-r--r--Sluift/ElementConvertors/CommandConvertor.cpp3
-rw-r--r--Sluift/Response.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/Sluift/ElementConvertors/CommandConvertor.cpp b/Sluift/ElementConvertors/CommandConvertor.cpp
index 7fb7b22..9a2aa5f 100644
--- a/Sluift/ElementConvertors/CommandConvertor.cpp
+++ b/Sluift/ElementConvertors/CommandConvertor.cpp
@@ -157,39 +157,40 @@ void CommandConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<Command> p
Lua::Table noteTable;
if (!note.note.empty()) {
noteTable["note"] = Lua::valueRef(note.note);
}
switch (note.type) {
case Command::Note::Info: noteTable["type"] = Lua::valueRef("info"); break;
case Command::Note::Warn: noteTable["type"] = Lua::valueRef("warn"); break;
case Command::Note::Error: noteTable["type"] = Lua::valueRef("error"); break;
}
notes.push_back(noteTable);
}
result["notes"] = Lua::valueRef(notes);
}
if (payload->getAction() != Command::NoAction) {
result["action"] = Lua::valueRef(convertActionToString(payload->getAction()));
}
if (payload->getExecuteAction() != Command::NoAction) {
result["execute_action"] = Lua::valueRef(convertActionToString(payload->getAction()));
}
if (!payload->getAvailableActions().empty()) {
std::vector<Lua::Value> availableActions;
foreach (const Command::Action& action, payload->getAvailableActions()) {
if (action != Command::NoAction) {
availableActions.push_back(convertActionToString(action));
}
}
result["available_actions"] = Lua::valueRef(availableActions);
}
Lua::pushValue(L, result);
if (payload->getForm()) {
- convertors->convertToLuaUntyped(L, payload->getForm());
+ bool result = convertors->convertToLuaUntyped(L, payload->getForm());
+ assert(result);
lua_setfield(L, -2, "form");
}
}
diff --git a/Sluift/Response.cpp b/Sluift/Response.cpp
index 519379c..5c36a8e 100644
--- a/Sluift/Response.cpp
+++ b/Sluift/Response.cpp
@@ -27,52 +27,54 @@ static std::string getErrorString(boost::shared_ptr<ErrorPayload> error) {
case ErrorPayload::BadRequest: return "Bad request";
case ErrorPayload::Conflict: return "Conflict";
case ErrorPayload::FeatureNotImplemented: return "This feature is not implemented";
case ErrorPayload::Forbidden: return "Forbidden";
case ErrorPayload::Gone: return "Recipient can no longer be contacted";
case ErrorPayload::InternalServerError: return "Internal server error";
case ErrorPayload::ItemNotFound: return "Item not found";
case ErrorPayload::JIDMalformed: return "JID Malformed";
case ErrorPayload::NotAcceptable: return "Message was rejected";
case ErrorPayload::NotAllowed: return "Not allowed";
case ErrorPayload::NotAuthorized: return "Not authorized";
case ErrorPayload::PaymentRequired: return "Payment is required";
case ErrorPayload::RecipientUnavailable: return "Recipient is unavailable";
case ErrorPayload::Redirect: return "Redirect";
case ErrorPayload::RegistrationRequired: return "Registration required";
case ErrorPayload::RemoteServerNotFound: return "Recipient's server not found";
case ErrorPayload::RemoteServerTimeout: return "Remote server timeout";
case ErrorPayload::ResourceConstraint: return "The server is low on resources";
case ErrorPayload::ServiceUnavailable: return "The service is unavailable";
case ErrorPayload::SubscriptionRequired: return "A subscription is required";
case ErrorPayload::UndefinedCondition: return "Undefined condition";
case ErrorPayload::UnexpectedRequest: return "Unexpected request";
}
}
assert(false);
return defaultMessage;
}
Response::~Response() {
}
int Response::convertToLuaResult(lua_State* L) {
if (error) {
lua_pushnil(L);
lua_pushstring(L, getErrorString(error).c_str());
- Sluift::globals.elementConvertor.convertToLuaUntyped(L, error);
+ bool converted = Sluift::globals.elementConvertor.convertToLuaUntyped(L, error);
+ assert(converted);
Lua::registerTableToString(L, -1);
return 3;
}
else {
if (result) {
- Sluift::globals.elementConvertor.convertToLuaUntyped(L, result);
+ bool converted = Sluift::globals.elementConvertor.convertToLuaUntyped(L, result);
+ assert(converted);
Lua::registerTableToString(L, -1);
}
else {
lua_pushboolean(L, 1);
}
return 1;
}
}