diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 22:39:37 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 22:39:37 +0100 |
commit | f29ecb6a74cd7aea7c67682b5b6172c4094253dd (patch) | |
tree | ee86889dff5d06de6b6cdc4dbc4980af540e6b12 /src/lua/lua_regexp.c | |
parent | cdd553cc27cc230662025663e353a9a7c8ce5e8a (diff) | |
download | rspamd-f29ecb6a74cd7aea7c67682b5b6172c4094253dd.tar.gz rspamd-f29ecb6a74cd7aea7c67682b5b6172c4094253dd.zip |
Use rspamd{text} for storing task content.
Diffstat (limited to 'src/lua/lua_regexp.c')
-rw-r--r-- | src/lua/lua_regexp.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c index ba5281299..fa7389537 100644 --- a/src/lua/lua_regexp.c +++ b/src/lua/lua_regexp.c @@ -285,12 +285,22 @@ static int lua_regexp_match (lua_State *L) { struct rspamd_lua_regexp *re = lua_check_regexp (L); - const gchar *data; - gsize len; + struct rspamd_lua_text *t; + const gchar *data = NULL; + gsize len = 0; gboolean raw = FALSE; if (re) { - data = luaL_checklstring (L, 2, &len); + if (lua_type (L, 2) == LUA_TSTRING) { + data = luaL_checklstring (L, 2, &len); + } + else if (lua_type (L, 2) == LUA_TUSERDATA) { + t = lua_check_text (L, 2); + if (t != NULL) { + data = t->start; + len = t->len; + } + } if (lua_gettop (L) == 3) { raw = lua_toboolean (L, 3); |