[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

@ -678,7 +678,6 @@ ASUpload(const ParseeConfig *c, Stream *from, unsigned int size, char *mime)
{ {
JsonEncode(reply, StreamStdout(), JSON_PRETTY); JsonEncode(reply, StreamStdout(), JSON_PRETTY);
StreamFlush(StreamStdout()); StreamFlush(StreamStdout());
Log(LOG_INFO, "Less obvious upload fail");
} }
HttpClientContextFree(ctx); HttpClientContextFree(ctx);
JsonFree(reply); JsonFree(reply);
@ -953,7 +952,7 @@ ASSetStatus(const ParseeConfig *c, char *user, UserStatus status, char *msg)
HashMap *request; HashMap *request;
char *path; char *path;
char *status_str = NULL; char *status_str = NULL;
if (!c || !user || !msg) if (!c || !user)
{ {
return; return;
} }

View file

@ -1160,31 +1160,6 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
XMLElement *status = XMLookForUnique(stanza, "status"); XMLElement *status = XMLookForUnique(stanza, "status");
char *oid = HashMapGet(stanza->attrs, "from"); 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))) if ((user_info = XMLookForTKV(stanza, "x", "xmlns", MUC_USER_NS)))
{ {
XMLElement *item = XMLookForUnique(user_info, "item"); XMLElement *item = XMLookForUnique(user_info, "item");
@ -1296,6 +1271,29 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
Free(parsee); Free(parsee);
Free(room); 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) if (vc)
{ {
XMLElement *photo = XMLookForUnique(vc, "photo"); XMLElement *photo = XMLookForUnique(vc, "photo");
@ -1459,7 +1457,7 @@ ParseeXMPPThread(void *argp)
pthread_mutex_init(&info.lock, NULL); pthread_mutex_init(&info.lock, NULL);
/* TODO: Make that configurable. */ /* TODO: Make that configurable. */
info.available_dispatchers = 8; info.available_dispatchers = 16;
info.dispatchers = Malloc( info.dispatchers = Malloc(
sizeof(*info.dispatchers) * info.available_dispatchers sizeof(*info.dispatchers) * info.available_dispatchers
); );