mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-14 01:55:16 +00:00
[ADD/WIP] XMPP->Matrix user statuses
Still untested because of performance reasons around statuses. Also, how is presence basically a spec feature, and yet somehow manages to be implemented by _no one_? Please, _implement it_ into yall's clients.
This commit is contained in:
parent
e7c44a05e2
commit
e4c6994f61
3 changed files with 92 additions and 2 deletions
|
|
@ -1091,7 +1091,34 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
|
|||
#define MUC_USER_NS "http://jabber.org/protocol/muc#user"
|
||||
XMLElement *user_info;
|
||||
XMLElement *vc = XMLookForTKV(stanza, "x", "xmlns", "vcard-temp:x:update");
|
||||
XMLElement *status = XMLookForUnique(stanza, "status");
|
||||
char *oid = HashMapGet(stanza->attrs, "from");
|
||||
|
||||
if (status)
|
||||
{
|
||||
XMLElement *status_data = ArrayGet(status->children, 0);
|
||||
char *decode_from = ParseeLookupJID(oid);
|
||||
char *from_matrix = ParseeDecodeMXID(decode_from);
|
||||
if (!from_matrix || *from_matrix != '@')
|
||||
{
|
||||
Free(from_matrix);
|
||||
from_matrix = ParseeEncodeJID(args->config, decode_from, false);
|
||||
}
|
||||
if (status_data)
|
||||
{
|
||||
char *status_str = status_data->data;
|
||||
|
||||
/* TODO: Verify whenever this code works as soon as I can get
|
||||
* my own instance (kappach.at) with presence enabled. */
|
||||
ASSetStatus(
|
||||
args->config, from_matrix,
|
||||
USER_STATUS_ONLINE, status_str
|
||||
);
|
||||
}
|
||||
|
||||
Free(decode_from);
|
||||
Free(from_matrix);
|
||||
}
|
||||
if ((user_info = XMLookForTKV(stanza, "x", "xmlns", MUC_USER_NS)))
|
||||
{
|
||||
XMLElement *item = XMLookForUnique(user_info, "item");
|
||||
|
|
@ -1180,7 +1207,6 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
|
|||
{
|
||||
ASLeave(args->config, room, from_matrix);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (jid)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue