[MOD] Die on loopback stanza

Dirty hack to a memory problem.
This commit is contained in:
LDA 2024-06-19 13:45:26 +02:00
commit 14ebef53ce
7 changed files with 77 additions and 16 deletions

View file

@ -35,6 +35,14 @@ ParseeXMPPThread(void *argp)
if (StrEquals(stanza->name, "message"))
{
size_t i;
if (StrEquals(HashMapGet(stanza->attrs, "from"),
HashMapGet(stanza->attrs, "to")))
{
/* There's not a lot of scenarios where we loopback */
Log(LOG_INFO, "Dropping thread...");
XMLFreeElement(stanza);
break;
}
for (i = 0; i < ArraySize(stanza->children); i++)
{
XMLElement *child = ArrayGet(stanza->children, i);
@ -55,11 +63,10 @@ ParseeXMPPThread(void *argp)
room = ParseeFindDMRoom(args, to, from);
data = ArrayGet(body->children, 0);
/* TODO: Manage that out. $[to] corresponds to a Matrix
* user, which we need to find the */
/* TODO: Consider having rich messages */
ASSend(
args->config, room, from_matrix,
"m.room.message", MatrixCreateNotice(data->data)
"m.room.message", MatrixCreateMessage(data->data)
);
Free(from_matrix);
Free(room);