diff --git a/src/XMPPThread.c b/src/XMPPThread.c index 24e858d..ff0ece0 100644 --- a/src/XMPPThread.c +++ b/src/XMPPThread.c @@ -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);