entry->ref = luaL_ref (L, LUA_REGISTRYINDEX);
if (task->message) {
- memcpy (entry->id, MESSAGE_FIELD (task, digest), sizeof (entry->id));
+ entry->id = GPOINTER_TO_UINT (task->message);
}
}
entry = g_hash_table_lookup (task->lua_cache, key);
if (entry != NULL && (task->message &&
- memcmp (entry->id, MESSAGE_FIELD (task, digest),
- sizeof (entry->id)) == 0)) {
+ entry->id == GPOINTER_TO_UINT (task->message))) {
lua_rawgeti (L, LUA_REGISTRYINDEX, entry->ref);
return TRUE;
if (task != NULL) {
if (task->message) {
- if (!lua_task_get_cached (L, task, "mime_parts")) {
- lua_createtable (L, MESSAGE_FIELD (task, parts)->len, 0);
-
- PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, parts), i, part) {
- ppart = lua_newuserdata (L, sizeof (struct rspamd_mime_part *));
- *ppart = part;
- rspamd_lua_setclass (L, "rspamd{mimepart}", -1);
- /* Make it array */
- lua_rawseti (L, -2, i + 1);
- }
+ lua_createtable (L, MESSAGE_FIELD (task, parts)->len, 0);
- lua_task_set_cached (L, task, "mime_parts", -1);
+ PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, parts), i, part) {
+ ppart = lua_newuserdata (L, sizeof (struct rspamd_mime_part *));
+ *ppart = part;
+ rspamd_lua_setclass (L, "rspamd{mimepart}", -1);
+ /* Make it array */
+ lua_rawseti (L, -2, i + 1);
}
}
else {