-
Notifications
You must be signed in to change notification settings - Fork 28
Adding support for private MUC messages to MAM #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for private MUC messages to MAM #144
Conversation
0c575d1
to
1154b97
Compare
…for MUC archive The archived MUC messages are persisted to the database more than once: Openfire stores them in ofMucConversationLog, the Monitoring plugin in ofMessageArchive. This commit introduces a configuration option to switch between the two: conversation.database.use-openfire-tables The default for this new option is to use the database table provided by the Monitoring plugin, which is a change from the behavior prior to this commit.
…change The property 'conversation.metadataArchiving' controls wether the plugin is considered 'enabled'. A restart of the plugin shouldn't be required for a change to the value of that property to become effective.
In MUCs, Private Messages (PMs) can be exchanged between two participants. When a participant retrieves its MUC messages, the PMs that they were involved in should also be returned. The pre-existing implementation stores PMs as regular one-to-one messages. By doing this, the context of them being exchanged in a MUC is lost. This commit additionally stores the PMs in context of a MUC (an additional database column is created for this). To be able to query for PMs, it is needed to provide, aside of the archive that's being queried, the person for which messages are queried. Note that this is specific to queries of MUC archives, as for Personal archives, these values are equal (the person owning the archive is the one querying it).
This switches to the replacement API, which makes available a new field. This does not have functional changes, as the existing code doesn't use the new data.
…able Historically, Private Messages sent through MUC rooms are stored as if they were one-on-one messages (in the personal archives of users). With igniterealtime#133 these PMs are now also stored in the MUC archive. Existing functionality might depend on these messages to be stored in the personal archives, or might break when these messages start showing up in the MUC archives. The changes in igniterealtime#133 retain the old functionality, but also adds the messages to the MUC archives (there's duplication now). Configuration options should be made available to control this behavior. Two new properties to be introduced, both take boolean values, both default to true: - conversation.roomArchiving.PMinPersonalArchive - conversation.roomArchiving.PMinRoomArchive
When there's an issue interacting with the database while retrieving messages, those issues are currently ignored. This leads to results that are incomplete. Fail-fast behavior is desired here: when there's a database error, thrown an exception. It's probably best to make this configurable, to allow administrators to fall back to ignoring errors, for those instances where, for a reason that's currently beyond me, have significant amounts of database issues. The property that can be used to control this behavior is archive.ignore-retrieval-exceptions. It's value is a boolean. false, which will be the new default, will cause XMPP errors to be generated, while true restores the old behavior of ignoring errors.
05ed02f
to
385effc
Compare
This branch is currently largely finished, with the notable exception of Lucene. That needs to be modified to work with private messages. |
Issue: DMs are recorded twice in the database Setup:
When looking at the ofMessageArchive table, the MUC messages are stored once, but the DMs are stored twice with slightly different information in some columns, but the same stanzas. The effect of this is that when a user queries their personal archive, both copies are returned. |
Issue: Using RSM "after" gets no results and only a count. Setup: As above Steps:
Relevant OF log lines:
|
Issue: The storage of DMs is inconsistent Setup: as above Steps: None Looking at the data stored in ofMessageArchive, there's an inconsistency in the data written to the archive. DM from User 1 to User 2Sent from user1's client:
Stored in the archive:
DM from User 2 to User 3Sent from user2's client:
Stored in the archive:
|
…in MUC archives This adds text-based search for archived messages that were exchanged as private messages in a MUC. This commit restructures the Lucene index that's used for this purpose, meaning that the index must be rebuild before usage!
With the changes for igniterealtime#146, the database table used for MUC queries is configurable. This commit makes sure that the correct table is used for lookups of some metadata (SSID, first and last date).
This is intended behavior: Private Messages were initially stored in the personal archives (as if they were regular one-on-one messages). In this branch, I added them to the MUC archives as well, but choose to retain existing functionality (in the hope of not breaking something). In #147 this was made configurable - having both enabled by default. This causes the duplication (but retains backwards compatibility. Maybe we should choose to have only one enabled by default?
This was caused by the lookup for a database ID based on the SSID to be based on an incorrect table. This has been fixed in fc2a0d0. The count being fixed is, I believe, desired behavior. You're paging to a result set, but you're not limiting the results in the (complete) resultset (which you'd do if you added a filter, like a 'query' or 'with' field). XEP-0059 RSM specifies: "The responding entity SHOULD also include the number of items in the full result set (which MAY be approximate) encapsulated in a element." That's what I think is happening - the complete result set is 5 messages large, which is still the case even if you request only the last few elements from the result set.
On a single server, I'm seeing that the stanza is saved using the real JID in the I agree that this should be consistent, but I'm not sure what variant to prefer. What makes you prefer one over the other? Of more importance (to the implementation that retrieves messages like this from the database) is the addressing in the other database columns. Are those consistent across the cluster? |
Tested Tested Testing "with" values return appropriate results, and return the same MAM results for a MUC regardless of whether a real JID or room JID is used. |
The inconsistent addressing is undesirable, as it might leak the 'real' JID of an occupant to the sender (that can retrieve the modified message from the archive). This issue is to be addressed in Openfire. See OF-2163 / igniterealtime/Openfire#1770 |
With igniterealtime#133, private messages sent in a MUC are now stored as part of the MUC archive. The old behavior, storing them in the personal archive, is still supported, but has been made configurable. This commit toggles the default value for that setting (`conversation.roomArchiving.PMinPersonalArchive`) from 'true' to 'false'.
…ional value The 'is PM for JID' value is optional (not all messages are private messages), so it can be null. Null values cannot be parsed as JIDs.
The Openfire admin console allows administrators to look at a transcript of a conversation. This already includes private messages. Messages that are private messages should be annotated as such, otherwise, things get confusing.
No functional changes, other than that the PDFs that are generated might look slightly different.
Performed further testing on semi-anonymous MUCs, the effect of upgrades on clients, archiving completely disabled, and another pass looking for any leaked personal info. Nothing untoward at all. With all previous issues resolved, this is ready to merge 👍 |
No description provided.