diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-21 12:35:58 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-21 12:35:58 +0000 |
commit | 3c772979bbcfee948054e853aa8325b8e43ac944 (patch) | |
tree | 8a25b12e7fa3f5d1389b004cd4a131ca717dd26c /src/lua/lua_mimepart.c | |
parent | cb5fa030df56eb424d832b99009816989072124c (diff) | |
download | rspamd-3c772979bbcfee948054e853aa8325b8e43ac944.tar.gz rspamd-3c772979bbcfee948054e853aa8325b8e43ac944.zip |
[Rework] Change mime part specifics handling
Diffstat (limited to 'src/lua/lua_mimepart.c')
-rw-r--r-- | src/lua/lua_mimepart.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c index 01c64ae64..f706b360f 100644 --- a/src/lua/lua_mimepart.c +++ b/src/lua/lua_mimepart.c @@ -1564,14 +1564,14 @@ lua_mimepart_get_boundary (lua_State * L) return luaL_error (L, "invalid arguments"); } - if (IS_CT_MULTIPART (part->ct)) { + if (IS_PART_MULTIPART (part)) { lua_pushlstring (L, part->specific.mp->boundary.begin, part->specific.mp->boundary.len); } else { parent = part->parent_part; - if (!parent || !IS_CT_MULTIPART (parent->ct)) { + if (!parent || !IS_PART_MULTIPART (parent)) { lua_pushnil (L); } else { @@ -1670,7 +1670,7 @@ lua_mimepart_is_image (lua_State * L) return luaL_error (L, "invalid arguments"); } - lua_pushboolean (L, (part->flags & RSPAMD_MIME_PART_IMAGE) ? true : false); + lua_pushboolean (L, part->part_type == RSPAMD_MIME_PART_IMAGE); return 1; } @@ -1685,7 +1685,7 @@ lua_mimepart_is_archive (lua_State * L) return luaL_error (L, "invalid arguments"); } - lua_pushboolean (L, (part->flags & RSPAMD_MIME_PART_ARCHIVE) ? true : false); + lua_pushboolean (L, part->part_type == RSPAMD_MIME_PART_ARCHIVE); return 1; } @@ -1700,7 +1700,7 @@ lua_mimepart_is_multipart (lua_State * L) return luaL_error (L, "invalid arguments"); } - lua_pushboolean (L, IS_CT_MULTIPART (part->ct) ? true : false); + lua_pushboolean (L, IS_PART_MULTIPART (part) ? true : false); return 1; } @@ -1715,7 +1715,7 @@ lua_mimepart_is_message (lua_State * L) return luaL_error (L, "invalid arguments"); } - lua_pushboolean (L, IS_CT_MESSAGE (part->ct) ? true : false); + lua_pushboolean (L, IS_PART_MESSAGE (part) ? true : false); return 1; } @@ -1730,7 +1730,7 @@ lua_mimepart_is_attachment (lua_State * L) return luaL_error (L, "invalid arguments"); } - if (!(part->flags & (RSPAMD_MIME_PART_IMAGE))) { + if (part->part_type != RSPAMD_MIME_PART_IMAGE) { if (part->cd && part->cd->type == RSPAMD_CT_ATTACHMENT) { lua_pushboolean (L, true); } @@ -1761,7 +1761,7 @@ lua_mimepart_is_text (lua_State * L) return luaL_error (L, "invalid arguments"); } - lua_pushboolean (L, (part->flags & RSPAMD_MIME_PART_TEXT) ? true : false); + lua_pushboolean (L, part->part_type == RSPAMD_MIME_PART_TEXT); return 1; } @@ -1798,7 +1798,7 @@ lua_mimepart_get_image (lua_State * L) return luaL_error (L, "invalid arguments"); } - if (!(part->flags & RSPAMD_MIME_PART_IMAGE) || part->specific.img == NULL) { + if (part->part_type != RSPAMD_MIME_PART_IMAGE || part->specific.img == NULL) { lua_pushnil (L); } else { @@ -1821,7 +1821,7 @@ lua_mimepart_get_archive (lua_State * L) return luaL_error (L, "invalid arguments"); } - if (!(part->flags & RSPAMD_MIME_PART_ARCHIVE) || part->specific.arch == NULL) { + if (part->part_type != RSPAMD_MIME_PART_ARCHIVE || part->specific.arch == NULL) { lua_pushnil (L); } else { @@ -1845,7 +1845,7 @@ lua_mimepart_get_children (lua_State * L) return luaL_error (L, "invalid arguments"); } - if (!IS_CT_MULTIPART (part->ct) || part->specific.mp->children == NULL) { + if (!IS_PART_MULTIPART (part) || part->specific.mp->children == NULL) { lua_pushnil (L); } else { @@ -1897,7 +1897,7 @@ lua_mimepart_get_text (lua_State * L) return luaL_error (L, "invalid arguments"); } - if (!(part->flags & RSPAMD_MIME_PART_TEXT) || part->specific.txt == NULL) { + if (part->part_type != RSPAMD_MIME_PART_TEXT || part->specific.txt == NULL) { lua_pushnil (L); } else { |