[FIX] Somewhat fix semianon avatars

This commit is contained in:
LDA 2024-07-16 18:32:08 +02:00
commit a4b8141f4a

View file

@ -802,7 +802,6 @@ IQGenerateQuery(void)
} \
while (0);
/* TODO: Advertise more things */
IQ_ADVERT
#undef AdvertiseSimple
}
@ -953,15 +952,7 @@ IQResult(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
if (vcard)
{
XMLElement *photo = XMLookForUnique(vcard, "PHOTO");
XMLElement *nickname = XMLookForUnique(vcard, "NICKNAME");
if (nickname)
{
XMLElement *data = ArrayGet(nickname->children, 0);
/* TODO: Use the nickname for something.
* And the rest of the vCard, somewhere. */
(void) data;
}
if (photo)
{
XMLElement *binval = XMLookForUnique(photo, "BINVAL");
@ -974,7 +965,8 @@ IQResult(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
size_t length, b64len;
Stream *datastream;
char *mxc = NULL, *from_matrix = NULL, *jid = NULL;
char *room = NULL;
char *room = NULL, *resource;
char *from = HashMapGet(stanza->attrs, "from");
if (!data || !data->data)
{
Log(LOG_ERR, "%s NOT FOUND", HashMapGet(stanza->attrs, "from"));
@ -1000,17 +992,18 @@ IQResult(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
room = ParseeGetBridgedRoom(args, stanza);
jid = ParseeLookupJID(HashMapGet(stanza->attrs, "from"));
if (jid && !StrEquals(jid, HashMapGet(stanza->attrs, "from")))
resource = ParseeTrimJID(from);
/* TODO: More reliable system for telling the difference appart */
if (jid && !StrEquals(from, resource))
{
from_matrix = ParseeEncodeJID(args->config, jid, false);
ASSetAvatar(args->config, from_matrix, mxc);
}
else if (room)
{
char *mask = StrConcat(4,
"@", args->config->sender_localpart,
":", args->config->homeserver_host
);
char *mask = ParseeMXID(args);
HashMap *obj = HashMapCreate();
HashMapSet(obj, "url", JsonValueString(mxc));
@ -1023,6 +1016,7 @@ IQResult(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
}
Free(from_matrix);
Free(resource);
Free(room);
Free(jid);
Free(mxc);