diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-22 14:00:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-22 14:53:23 +0000 |
commit | fe8991aac2ac1db108489fbcd42a8bdf7bd804c3 (patch) | |
tree | 444b5bb059529da06f90d485e60d6e9b26e9f9f1 /src | |
parent | 2947d94f9cf8a04436e47fdef4f258ff3c15ca8f (diff) | |
download | rspamd-fe8991aac2ac1db108489fbcd42a8bdf7bd804c3.tar.gz rspamd-fe8991aac2ac1db108489fbcd42a8bdf7bd804c3.zip |
[Minor] Slightly rework lua specific
Diffstat (limited to 'src')
-rw-r--r-- | src/libmime/message.c | 5 | ||||
-rw-r--r-- | src/libmime/message.h | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c index 7c7609cf8..7d2d81a7f 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1069,10 +1069,11 @@ rspamd_message_dtor (struct rspamd_message *msg) } } - if (p->part_type == RSPAMD_MIME_PART_CUSTOM_LUA && p->specific.lua_ref != -1) { + if (p->part_type == RSPAMD_MIME_PART_CUSTOM_LUA && + p->specific.lua_specific.cbref != -1) { luaL_unref (msg->task->cfg->lua_state, LUA_REGISTRYINDEX, - p->specific.lua_ref); + p->specific.lua_specific.cbref); } } diff --git a/src/libmime/message.h b/src/libmime/message.h index 7f6ea86dd..c11b273eb 100644 --- a/src/libmime/message.h +++ b/src/libmime/message.h @@ -65,6 +65,19 @@ struct rspamd_mime_multipart { rspamd_ftok_t boundary; }; +enum rspamd_lua_specific_type { + RSPAMD_LUA_PART_TEXT, + RSPAMD_LUA_PART_STRING, + RSPAMD_LUA_PART_TABLE, + RSPAMD_LUA_PART_FUNCTION, + RSPAMD_LUA_PART_UNKNOWN, +}; + +struct rspamd_lua_specific_part { + gint cbref; + enum rspamd_lua_specific_type type; +}; + struct rspamd_mime_part { struct rspamd_content_type *ct; struct rspamd_content_type *detected_ct; @@ -91,7 +104,7 @@ struct rspamd_mime_part { struct rspamd_mime_text_part *txt; struct rspamd_image *img; struct rspamd_archive *arch; - gint lua_ref; + struct rspamd_lua_specific_part lua_specific; } specific; guchar digest[rspamd_cryptobox_HASHBYTES]; |