void rspamd_message_set_modified_header(struct rspamd_task *task,
struct rspamd_mime_headers_table *hdrs,
const gchar *hdr_name,
- const ucl_object_t *obj)
+ const ucl_object_t *obj,
+ struct rspamd_mime_header **order_ptr)
{
khiter_t k;
khash_t(rspamd_mime_headers_htb) *htb = &hdrs->htb;
k = kh_put(rspamd_mime_headers_htb, htb, hdr_elt->name, &r);
kh_value(htb, k) = hdr_elt;
+
+ if (order_ptr) {
+ DL_APPEND(*order_ptr, hdr_elt);
+ }
}
else {
hdr_elt = kh_value(htb, k);
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
void rspamd_message_set_modified_header(struct rspamd_task *task,
struct rspamd_mime_headers_table *hdrs,
const gchar *hdr_name,
- const ucl_object_t *obj);
+ const ucl_object_t *obj,
+ struct rspamd_mime_header **order_ptr);
/**
* Cleans up hash table of the headers
ucl_object_t *mods = ucl_object_lua_import(L, 3);
rspamd_message_set_modified_header(task,
- MESSAGE_FIELD_CHECK(task, raw_headers), hname, mods);
+ MESSAGE_FIELD(task, raw_headers),
+ hname,
+ mods,
+ &(MESSAGE_FIELD(task, headers_order)));
ucl_object_unref(mods);
lua_pushboolean(L, true);