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

OF-2607: Add support for XEP-0421: Occupant identifiers for semi-anonymous MUCs #2714

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guusdk
Copy link
Member

@guusdk guusdk commented Mar 11, 2025

This adds support for XEP-0421, which in turn opens up a bunch of client functionality (like message reactions).

I'm not to sure about the approach taken in this commit. In particular, the database installation and update script changes do not sit well with me (also, they will require extensive testing, for each database type)

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @guusdk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces support for XEP-0421: Occupant identifiers for semi-anonymous MUCs. This involves adding a privateKey column to the ofMucService table in the database, generating occupant IDs based on this key, and including the occupant ID in presence stanzas. The database schema changes are applied to various database types (DB2, HSQLDB, MySQL, Oracle, PostgreSQL, SQL Server, and Sybase). Additionally, the Openfire version is updated from 37 to 38 in the database scripts. The MUCOccupant class is modified to include the occupant ID, and the MultiUserChatServiceImpl class is updated to handle the new privateKey field.

Highlights

  • XEP-0421 Support: Adds support for XEP-0421, enabling features like message reactions in semi-anonymous MUCs.
  • Database Schema Changes: Introduces a privateKey column to the ofMucService table across multiple database types.
  • Occupant ID Generation: Implements occupant ID generation based on a service-specific private key and includes it in presence stanzas.
  • Version Update: Updates the Openfire version in the database scripts from 37 to 38.

Changelog

Click here to see the changelog
  • distribution/src/database/openfire_db2.sql
    • Added privateKey column to ofMucService table.
    • Updated Openfire version to 38.
    • Added a random private key for the default conference service.
  • distribution/src/database/openfire_hsqldb.sql
    • Added privateKey column to ofMucService table.
    • Updated Openfire version to 38.
    • Added a random private key for the default conference service.
  • distribution/src/database/openfire_mysql.sql
    • Added privateKey column to ofMucService table.
    • Updated Openfire version to 38.
    • Added a random private key for the default conference service.
  • distribution/src/database/openfire_oracle.sql
    • Added privateKey column to ofMucService table.
    • Updated Openfire version to 38.
    • Added a random private key for the default conference service.
  • distribution/src/database/openfire_postgresql.sql
    • Added privateKey column to ofMucService table.
    • Updated Openfire version to 38.
    • Added a random private key for the default conference service.
  • distribution/src/database/openfire_sqlserver.sql
    • Added privateKey column to ofMucService table.
    • Added a random private key for the default conference service.
  • distribution/src/database/openfire_sybase.sql
    • Added privateKey column to ofMucService table.
    • Added a random private key for the default conference service.
  • distribution/src/database/upgrade/38/openfire_db2.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • distribution/src/database/upgrade/38/openfire_hsqldb.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • distribution/src/database/upgrade/38/openfire_mysql.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • distribution/src/database/upgrade/38/openfire_oracle.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • distribution/src/database/upgrade/38/openfire_postgresql.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • distribution/src/database/upgrade/38/openfire_sqlserver.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • distribution/src/database/upgrade/38/openfire_sybase.sql
    • Added privateKey column to ofMucService table.
    • Generated a random private key for existing MUC services.
    • Updated Openfire version to 38.
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCOccupant.java
    • Added occupantId field to store the user's occupant ID.
    • Modified constructor to generate and set the occupant ID.
    • Added getter method for occupantId.
    • Modified writeExternal and readExternal methods to serialize and deserialize the occupantId.
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java
    • Added generateOccupantId method to create an Occupant ID based on XEP-0421.
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/MultiUserChatManager.java
    • Modified SQL queries to include privateKey for MUC service management.
    • Updated createMultiUserChatService to generate and store a private key for new services.
    • Updated updateMultiUserChatService to propagate the private key.
    • Updated loadServices to load the private key from the database.
    • Updated insertService to include the private key when creating a new service.
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/MultiUserChatService.java
    • Added getPrivateKey method to retrieve the private key for a MUC service.
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/cluster/ServiceAddedEvent.java
    • Added privateKey field to ServiceAddedEvent for cluster communication.
    • Modified constructor and writeExternal/readExternal methods to handle the privateKey.
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
    • Added privateKey field to store the MUC service's private key.
    • Modified constructor to accept and set the privateKey.
    • Modified processRegularStanza to add the occupant-id to presence and message packets.
    • Added getPrivateKey method to retrieve the private key.
    • Added "urn:xmpp:occupant-id:0" to the feature list.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

The SHA-256 algorithm, used in HMAC for occupant ID generation, was designed by the National Security Agency (NSA).

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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