[ADD/WIP] Start receiptwerk

This commit is contained in:
LDA 2024-07-06 00:38:10 +02:00
commit 0fc0fdd6f4
9 changed files with 144 additions and 8 deletions

View file

@ -29,6 +29,7 @@
AdvertiseSimple("urn:xmpp:message-correct:0") \
AdvertiseSimple("urn:xmpp:reactions:0") \
AdvertiseSimple("urn:xmpp:styling:0") \
AdvertiseSimple("urn:xmpp:receipts") \
AdvertiseSimple("urn:xmpp:reply:0") \
AdvertiseSimple("jabber:x:oob") \
AdvertiseSimple("vcard-temp") \
@ -443,21 +444,48 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
decode_from = NULL;
from_matrix = NULL;
}
else if (XMLookForTKV(stanza, "active", "xmlns", CHAT_STATES))
if (XMLookForTKV(stanza, "active", "xmlns", CHAT_STATES))
{
char *latest = NULL;
decode_from = ParseeLookupJID(from);
from_matrix = ParseeEncodeJID(args->config, decode_from, true);
mroom_id = ParseeGetBridgedRoom(args, stanza);
latest = ParseeLookupHead(mroom_id);
ASType(args->config, from_matrix, mroom_id, false);
ASPresence(args->config, from_matrix, mroom_id, latest);
Free(decode_from);
Free(from_matrix);
Free(latest);
Free(mroom_id);
mroom_id = NULL;
decode_from = NULL;
from_matrix = NULL;
}
if (XMLookForTKV(stanza, "paused", "xmlns", CHAT_STATES) ||
XMLookForTKV(stanza, "received", "xmlns", "urn:xmpp:receipts"))
{
/* TODO: Use stanza ID if possible */
char *latest = NULL;
decode_from = ParseeLookupJID(from);
from_matrix = ParseeEncodeJID(args->config, decode_from, true);
mroom_id = ParseeGetBridgedRoom(args, stanza);
latest = ParseeLookupHead(mroom_id);
ASPresence(args->config, from_matrix, mroom_id, latest);
Free(decode_from);
Free(from_matrix);
Free(latest);
Free(mroom_id);
mroom_id = NULL;
decode_from = NULL;
from_matrix = NULL;
}
#undef CHAT_STATES
body = XMLookForUnique(stanza, "body");
if (!body)
@ -978,10 +1006,6 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
char *from_matrix = ParseeDecodeMXID(decode_from);
char *affiliation = HashMapGet(item->attrs, "affiliation");
Log(LOG_INFO, "Acting on %s", from_matrix);
Log(LOG_INFO, "OID=%s DF=%s", oid, decode_from);
if (StrEquals(affiliation, "outcast"))
{
ASBan(args->config, room, from_matrix);