[FIX] Fix statuses

This commit is contained in:
LDA 2024-07-11 00:43:44 +02:00
commit c349b37f60
2 changed files with 25 additions and 28 deletions

View file

@ -1160,31 +1160,6 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
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,
GuessStatus(stanza), status_str
);
}
Free(decode_from);
Free(from_matrix);
}
if ((user_info = XMLookForTKV(stanza, "x", "xmlns", MUC_USER_NS)))
{
XMLElement *item = XMLookForUnique(user_info, "item");
@ -1296,6 +1271,29 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
Free(parsee);
Free(room);
}
if (status)
{
XMLElement *status_data = ArrayGet(status->children, 0);
char *decode_from = ParseeLookupJID(oid);
char *trimmed = ParseeTrimJID(decode_from);
char *from_matrix = ParseeEncodeJID(args->config, trimmed, false);
char *status_str = NULL;
if (status_data)
{
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,
GuessStatus(stanza), status_str
);
Free(decode_from);
Free(from_matrix);
Free(trimmed);
}
if (vc)
{
XMLElement *photo = XMLookForUnique(vc, "photo");
@ -1459,7 +1457,7 @@ ParseeXMPPThread(void *argp)
pthread_mutex_init(&info.lock, NULL);
/* TODO: Make that configurable. */
info.available_dispatchers = 8;
info.available_dispatchers = 16;
info.dispatchers = Malloc(
sizeof(*info.dispatchers) * info.available_dispatchers
);