Fetch MUC participant avatars#1480
Conversation
|
Here are some points for discussion:
<field var="allow_query_users" type="boolean" label="Allow users to query other users">
<value>1</value>
</field>Should we skip fetching avatars if we detect that this config option is set to |
|
See my answers inline.
Why do avatar fetches block mam? I don't think this is something we want.
Well, since different mucs could have different policies for direct communication, I think that optimization would cause more confusion than do good (its hard to understand for ordinary users, why a muc shows only avatars of some users and not others).
No, it should even be the other way round: we need to differentiate by account. My own affiliation might influence, if I'm able to retrieve the avatar or even see the jid of participants. Since the avatar hash of every participant is stored in the db, using something like this:
No, no. That simply means that we should return an empty string rather than nil to indicate a missing hash. Having
Yes, I think that would be beneficial, even if that is rarely used. |
tmolitor-stud-tu
left a comment
There was a problem hiding this comment.
I did only a quick scroll-through
This is a bug, that I was hoping you'd have some insights about. my guess is it's somehow related to the sendQueue having too many iqs, because the mam query seems to be added to the sendQueue after the avatar queries. I'll investigate the issue more.
If by policies for direct communication you mean blocking iqs, my last suggestion already covers this point. we can detect that policy and avoid copying the avatar files for MUCs that block iqs
I get that my affiliation influences if I can see the jid of participants. But I don't get how it influences if I'm able to retrieve avatars. |
yes and no. allowing iqs between participants isn't mandated by the spec and that ejabberd exposes the fact that it blocks them is entirely an implementation detail. other servers might block iqs but not expose it as such. especially bridges to other chat networks like biboumi. --> you can't rely on this field to detect this. |
Because servers could choose to allow moderators/admins to send iqs to participants, but not ordinary users. Or allow it for members, but not for participants having no affiliation. |
518a17d to
eaba046
Compare
bc01177 to
6e8eeac
Compare
7062588 to
95af060
Compare
7ab5202 to
5dd212f
Compare
d41e71c to
a160ec8
Compare
It is neither the server's rate limit nor the parsing of incoming stanzas. The problem is: we send a bunch of vcard iqs, and then send a MAM iq. And answering vcard queries takes a lot of time because it involves contacting many other servers. |
|
I updated the PR.
I did not implement a generic abstraction for this. Because I don't think this is needed in other situations. Fetching channel participant avatars is the only time where you can send dozens or hunderds of iqs at the same time. (plus answering them takes several minutes) I'd like to optimize things to reduce the number of avatar fetches:
What changed: since version 26.01, ejabberd no longer blocks avatar IQs, even when |
|
Notes:
|
| // Ignore the vcard response if we're no longer joined to the room | ||
| // We send the next pending avatar query even in this case because the next query | ||
| // might be for a participant in another room | ||
| if(![self isJoined:iqNode.fromUser] && ![self isJoining:iqNode.fromUser]) |
There was a problem hiding this comment.
Is this the correct way to check that we're no longer joined to the room?
| DDLogError(@"Error deleting orphan avatar file: %@", error); | ||
| } | ||
|
|
||
| //clean up orphan hashes and orphan avatar files of muc participants |
There was a problem hiding this comment.
I think the entire cleanupHashes method can / should be removed.
I initially followed the existing code for contact avatars.
These are the only situations that I'm aware of where a hash does not have a corresponding avatar file:
- The PEP node of the participant avatar does not have
openaccess model. as per XEP-0398, the server would still inject the hash to the presence in this case:
services MUST include the hash on behalf of their users in every available presence that does not contain an empty photo element wrapped in an x element qualified by the 'vcard-temp:x:update' namespace.
- The participant avatar is in a file format that Monal doesn't understand. For example I know a user who has an AVIF avatar. At least as of now, Monal tries to load the avatar image (in order to resize it, make it circular and convert it to PNG) and if it can't do that, it doesn't save the file
In both of these cases, if cleanupHashes removes the hash, the next time we receive a presence from the participant, the hash will get saved again, and the avatar will try to be fetched again, which is wasteful since we know it will fail.
As for situations where we have the avatar file but don't have a corresponding hash, I added separate commits that address them:
- When removing a contact
- When leaving a room
- When removing / deleting an account
To conclude, I think we should remove cleanupHashes, even the part concerning contact avatars, unless you have an objection.
Have only one participant avatar query in flight at a time (per account) This avoids flooding the server with iqs. Flooding would significantly delay other iqs sent afterwards e.g. MAM queries
In ChannelMemberList, store participants' info in an array of dictionaries rather than a dictionary of dictionaries. This makes the code simpler. Also, simplify ContactEntry initializers by using optional parameters
The avatars are only deleted in the case of the removal of the room from buddylist
Add support for fetching MUC participant avatars, using vcard-temp (XEP-0153)
And display the avatars in the ChatView, and in ChannelMemberList.
Fixes #699