t = lua_newuserdata (L, sizeof (*t));
rspamd_lua_setclass (L, "rspamd{text}", -1);
- t->start = part->orig->data;
- t->len = part->orig->len;
+ t->start = part->raw.begin;
+ t->len = part->raw.len;
t->flags = 0;
return 1;
return 1;
}
- if (part->orig == NULL) {
- lua_pushnumber (L, 0);
- }
- else {
- lua_pushnumber (L, part->orig->len);
- }
+ lua_pushnumber (L, part->raw.len);
return 1;
}
t = lua_newuserdata (L, sizeof (*t));
rspamd_lua_setclass (L, "rspamd{text}", -1);
- t->start = part->content->data;
- t->len = part->content->len;
+ t->start = part->parsed_data.begin;
+ t->len = part->parsed_data.len;
t->flags = 0;
return 1;
return 1;
}
- lua_pushinteger (L, part->content->len);
+ lua_pushinteger (L, part->parsed_data.len);
return 1;
}
lua_pushnil (L);
return 2;
}
-#ifndef GMIME24
- lua_pushstring (L, part->type->type);
- lua_pushstring (L, part->type->subtype);
-#else
- lua_pushstring (L, g_mime_content_type_get_media_type (part->type));
- lua_pushstring (L, g_mime_content_type_get_media_subtype (part->type));
-#endif
+
+ lua_pushlstring (L, part->ct->type.begin, part->ct->type.len);
+ lua_pushlstring (L, part->ct->subtype.begin, part->ct->subtype.len);
return 2;
}
{
struct rspamd_mime_part *part = lua_check_mimepart (L);
- if (part == NULL || part->filename == NULL) {
+ if (part == NULL || part->cd == NULL || part->cd->filename.len == 0) {
lua_pushnil (L);
return 1;
}
- lua_pushstring (L, part->filename);
+ lua_pushlstring (L, part->cd->filename.begin, part->cd->filename.len);
return 1;
}
return luaL_error (L, "invalid arguments");
}
- if (!(part->flags & RSPAMD_MIME_PART_IMAGE)) {
+ if (!(part->flags & RSPAMD_MIME_PART_IMAGE) || part->specific.img == NULL) {
lua_pushnil (L);
}
else {
pimg = lua_newuserdata (L, sizeof (*pimg));
- *pimg = part->specific_data;
+ *pimg = part->specific.img;
rspamd_lua_setclass (L, "rspamd{image}", -1);
}
return luaL_error (L, "invalid arguments");
}
- if (!(part->flags & RSPAMD_MIME_PART_ARCHIVE)) {
+ if (!(part->flags & RSPAMD_MIME_PART_ARCHIVE) || part->specific.arch == NULL) {
lua_pushnil (L);
}
else {
parch = lua_newuserdata (L, sizeof (*parch));
- *parch = part->specific_data;
+ *parch = part->specific.arch;
rspamd_lua_setclass (L, "rspamd{archive}", -1);
}
return luaL_error (L, "invalid arguments");
}
- if (!(part->flags & RSPAMD_MIME_PART_TEXT)) {
+ if (!(part->flags & RSPAMD_MIME_PART_TEXT) || part->specific.txt == NULL) {
lua_pushnil (L);
}
else {
ppart = lua_newuserdata (L, sizeof (*ppart));
- *ppart = part->specific_data;
+ *ppart = part->specific.txt;
rspamd_lua_setclass (L, "rspamd{textpart}", -1);
}