mod_privacy: honor the 'order' attribute
When checking a packet against the active privacy list, make sure that the items in the list are sorted according to the 'order' attribute.
Bug-url: https://github.com/processone/ejabberd/issues/2529 Signed-off-by: Eugene Crosser [email protected]
No, this is not efficient. The list should be sorted during iq-set.
Then you would need to guarantee that the backend preserves the order. Is there such guarantee, including possible future backends?
In any case, my concern is the bug #2529 . If it is fixed in some other way, I'll be perfectly happy.
@zinid , I think that I can make ordering O(N) and still used at application-time. Will that be acceptable? If so, I'll resubmit this PR.
(I think pre-sorting is not a good design. Imagine that you keep it in an SQL and someone decides to modify the data directly in the backend. Then sorting will be lost. I actually did that before, because user-side privacy list editor(s?) suck.)
@zinid , I pushed a new version of the patch that does not use lists:sort(). (But the code is more difficult to read, unfortunately :( ). Please see if this is more acceptable. Thanks.
Hi @crosser, many thanks for your contribution!
In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.
You did it @crosser!
Thank you for signing the ProcessOne Contribution License Agreement.
We will have a look at your contribution!
@prefiks: What do you think about this PR and Issue?