mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 16:45:10 +00:00
[ADD/WIP/AYA] Sending errors, voice reqs, Ayawork.
Ayaya!
This commit is contained in:
parent
aa71c5cfeb
commit
8588a6fb5c
7 changed files with 197 additions and 5 deletions
|
|
@ -24,7 +24,8 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
|||
char *retracted = XMPPGetRetractedID(stanza);
|
||||
char *reply_to = XMPPGetReply(stanza);
|
||||
char *moderated = XMPPGetModeration(stanza);
|
||||
bool chat = StrEquals(HashMapGet(stanza->attrs, "type"), "chat");
|
||||
char *type = HashMapGet(stanza->attrs, "type");
|
||||
bool chat = StrEquals(type, "chat");
|
||||
size_t i;
|
||||
|
||||
to = NULL;
|
||||
|
|
@ -39,6 +40,45 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (StrEquals(type, "error"))
|
||||
{
|
||||
char *type, *text, *user, *parsee;
|
||||
char *message, *room;
|
||||
|
||||
from = HashMapGet(stanza->attrs, "from");
|
||||
to = HashMapGet(stanza->attrs, "to");
|
||||
|
||||
/* Tiny little trick. */
|
||||
XMLAddAttr(stanza, "type", "groupchat");
|
||||
|
||||
parsee = ParseeMXID(args);
|
||||
type = XMPPGetErrtype(stanza);
|
||||
text = XMPPGetErrtext(stanza);
|
||||
user = ParseeDecodeMXID(to);
|
||||
|
||||
/* Avoid fun hypothetical cases of looping. */
|
||||
if (StrEquals(parsee, user))
|
||||
{
|
||||
goto end_error;
|
||||
}
|
||||
|
||||
message = StrConcat(3, type, ": ", text);
|
||||
room = ParseeGetBridgedRoom(args, stanza);
|
||||
Free(ASSend(
|
||||
args->config, room, parsee,
|
||||
"m.room.message",
|
||||
MatrixCreateNotice(message)
|
||||
));
|
||||
|
||||
end_error:
|
||||
XMLFreeElement(stanza);
|
||||
Free(message);
|
||||
Free(parsee);
|
||||
Free(room);
|
||||
Free(user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (moderated)
|
||||
{
|
||||
/* TODO: Parsee MUST check if it is a valid MUC */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue