static void *ucl_null;
+struct _rspamd_lua_text {
+ const char *start;
+ unsigned int len;
+ unsigned int flags;
+};
enum lua_ucl_push_flags {
LUA_UCL_DEFAULT_FLAGS = 0,
if (lua_topointer (L, idx) == ucl_null) {
obj = ucl_object_typed_new (UCL_NULL);
}
+ else {
+ /* Assume it is a text like object */
+ struct _rspamd_lua_text *t = lua_touserdata (L, idx);
+
+ if (t) {
+ obj = ucl_object_fromstring_common(t->start, t->len, 0);
+ }
+ }
break;
case LUA_TTABLE:
case LUA_TFUNCTION:
return ret;
}
-struct _rspamd_lua_text {
- const char *start;
- unsigned int len;
- unsigned int flags;
-};
-
/***
* @method parser:parse_text(input)
* Parse UCL object from text object (Rspamd specific).
format = UCL_EMIT_YAML;
}
else if (strcasecmp (strtype, "config") == 0 ||
- strcasecmp (strtype, "ucl") == 0) {
+ strcasecmp (strtype, "ucl") == 0) {
format = UCL_EMIT_CONFIG;
}
- else if (strcasecmp (strtype, "msgpack") == 0) {
+ else if (strcasecmp (strtype, "msgpack") == 0 ||
+ strcasecmp (strtype, "messagepack") == 0) {
format = UCL_EMIT_MSGPACK;
}
}