diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-02-15 18:26:27 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-02-15 18:26:27 +0300 |
commit | 17a938b2aeffb3448c8d61f3d8dd7d012eb910cc (patch) | |
tree | 066cebe8b625a8b728ba17f1b3be8f2e80dce9c1 /src/lua/lua_message.c | |
parent | beab78097de6a53430bb16310e41b93d74546cb9 (diff) | |
download | rspamd-17a938b2aeffb3448c8d61f3d8dd7d012eb910cc.tar.gz rspamd-17a938b2aeffb3448c8d61f3d8dd7d012eb910cc.zip |
* Add ability to specify 'S' flag to regexp that means that headers checks must be case sensitive
* Add lua function message:get_header_strong
Diffstat (limited to 'src/lua/lua_message.c')
-rw-r--r-- | src/lua/lua_message.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lua/lua_message.c b/src/lua/lua_message.c index 04adec24a..2848e082f 100644 --- a/src/lua/lua_message.c +++ b/src/lua/lua_message.c @@ -66,6 +66,7 @@ LUA_FUNCTION_DEF (message, set_sender); LUA_FUNCTION_DEF (message, get_reply_to); LUA_FUNCTION_DEF (message, set_reply_to); LUA_FUNCTION_DEF (message, get_header); +LUA_FUNCTION_DEF (message, get_header_strong); LUA_FUNCTION_DEF (message, set_header); static const struct luaL_reg msglib_m[] = { @@ -78,6 +79,7 @@ static const struct luaL_reg msglib_m[] = { LUA_INTERFACE_DEF (message, get_reply_to), LUA_INTERFACE_DEF (message, set_reply_to), LUA_INTERFACE_DEF (message, get_header), + LUA_INTERFACE_DEF (message, get_header_strong), LUA_INTERFACE_DEF (message, set_header), {"__tostring", lua_class_tostring}, {NULL, NULL} @@ -106,7 +108,7 @@ LUA_GMIME_BRIDGE_GET (message, get_reply_to, Message) LUA_GMIME_BRIDGE_SET (message, set_reply_to, Message) static gint -lua_message_get_header (lua_State * L) +lua_message_get_header_common (lua_State * L, gboolean strong) { const gchar *headern; GMimeMessage *obj = lua_check_message (L); @@ -116,7 +118,7 @@ lua_message_get_header (lua_State * L) if (obj != NULL) { headern = luaL_checkstring (L, 2); if (headern) { - res = message_get_header (NULL, obj, headern); + res = message_get_header (NULL, obj, headern, strong); if (res) { cur = res; lua_newtable (L); @@ -143,6 +145,17 @@ lua_message_get_header (lua_State * L) return 1; } +static gint +lua_message_get_header (lua_State * L) +{ + return lua_message_get_header_common (L, FALSE); +} + +static gint +lua_message_get_header_strong (lua_State * L) +{ + return lua_message_get_header_common (L, TRUE); +} static gint lua_message_set_header (lua_State * L) |