Skip to content
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

#369 and #370: Add support for the clear chat room history event #411

Merged
merged 9 commits into from
Jan 7, 2025

Conversation

guusdk
Copy link
Member

@guusdk guusdk commented Jan 2, 2025

We can address both #369 and #370 by implementing the handling of the "clear chat history" event from Openfire. Openfire sends a "clear chat history" event in the following scenarios:

  • A room is destroyed, and no chat history should be preserved.
  • A "clear room history" command is issued during the lifetime of a chat room.

This intends to replace #408

The approach in this PR differs from the one in 408 in that it does not attempt to introduce a new unique identifier for a room. Instead, an Openfire-provided identifier (roomID) is re-used. This intends to:

  • better separates concerns: responsibility for generating a unique value now is located in only one piece of functionality (that pre-exists).
  • avoids issues when the plugin was not loaded when a room was created
  • reduces code complexity

Prior to the changes introduced here, the Monitoring plugin did not distinguish between different 'incarnations' of a room (a room can be deleted, then recreated with the same JID). With the changes in this PR, the plugin now does - but only for data that is recorded 'from now on'. This PR contains a database update script that explicitly relates all preexisting data to the last incarnation of a chat room (if one still exists). This isn't quite right, but it is not 'more wrong' than what was functionally going on prior to these changes.

guusdk added 2 commits January 2, 2025 21:25
The room ID differs from a room JID in the following way: when a room gets destroyed, and is recreated, it can be recreated using the same JID. The numeric identifier however, will be unique.

The room ID can therefor be used to differentiate between data recorded for various 'reincarnations' of a room with the same name.

The database update scripts will populate the room ID for existing rooms with the latest ID as recorded in the Openfire table `ofMucRoom`. This is not necessarily correct (as data recorded by the Monitoring plugin may relate to earlier versions of a room). This behavior does, however, reflect the current behavior of the Monitoring plugin, that currently always associates data with the 'latest' reincarnation of the room.

Starting with this commit, new incarnations of the room will receive distinct IDs.

This is a prerequisite for fixing issues igniterealtime#369 and igniterealtime#370.
Openfire 5.0.0 introduces a 'clear room history' event. In this commit, the monitoring plugin implements that event, by:
- deleting associated database content
- removing deleted content from the Lucene indices.

Fixes igniterealtime#369
Fixes igniterealtime#370
@guusdk
Copy link
Member Author

guusdk commented Jan 2, 2025

I have not tested any of this yet, which is why I'm opening this PR in 'draft' status.

@guusdk guusdk requested review from dwd and Fishbowler January 2, 2025 20:39
@guusdk
Copy link
Member Author

guusdk commented Jan 2, 2025

The continuous integration will fail until API changes in Openfire are available through a published dependency.

guusdk added 6 commits January 3, 2025 16:47
This prevents messages to be 'lost', as they're registered to a conversation that no longer gets processed. By properly ending the old conversation, new messages will cause a new conversation to be started.
@guusdk guusdk marked this pull request as ready for review January 6, 2025 15:50
@guusdk
Copy link
Member Author

guusdk commented Jan 6, 2025

I've tested the install and upgrade scripts for MySQL, HSQLDB and Postgres.

@guusdk guusdk merged commit a9c962e into igniterealtime:main Jan 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant