Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@silverbucket
Copy link
Member

Problem

This pull request resolves GitHub issue #540 by implementing a new XMPP MUC (Multi-User Chat) room information query feature. Previously, Sockethub's XMPP platform lacked the ability to query room information and features using XMPP service discovery (disco#info), which is essential for clients to understand what capabilities a room supports.

Solution

Added a new room-info verb to the XMPP platform that implements:

  1. New ActivityStream Verb: Created a room-info type that follows the platform's activity stream patterns
  2. Service Discovery Query: Implements XEP-0045 MUC specification using disco#info queries to retrieve room information
  3. Response Handling: Processes disco#info responses and extracts room features and identity information
  4. Schema Validation: Added proper schema definitions for room-info objects with features array and identity structure

Technical Changes

Core Implementation

  • packages/platform-xmpp/src/index.js: Added roomInfo(job, done) method that sends disco#info queries with unique IDs
  • packages/platform-xmpp/src/incoming-handlers.js: Added notifyRoomInfo(stanza) handler for processing disco#info responses
  • packages/platform-xmpp/src/schema.js: Added "room-info" to allowed message types

Schema & Validation

  • packages/schemas/src/helpers/objects.ts: Added complete room-info object schema with features array and identity object validation

Testing

  • packages/platform-xmpp/src/incoming-handlers.test.data.js: Added realistic test data with XMPP disco#info response XML and expected ActivityStream output
  • packages/platform-xmpp/src/index.test.js: Added comprehensive test coverage for the roomInfo method

Usage Example

Request:

{
  context: 'xmpp',
  type: 'room-info', 
  actor: {
    id: '[email protected]/pidgin',
    type: 'person'
  },
  target: {
    id: '[email protected]',
    type: 'room'
  }
}

Response:

{
  context: 'xmpp',
  type: 'room-info',
  actor: {
    id: '[email protected]', 
    type: 'room',
    name: 'Room Display Name'
  },
  target: {
    id: '[email protected]/pidgin',
    type: 'person'
  },
  object: {
    type: 'room-info',
    features: ['http://jabber.org/protocol/muc', 'muc_passwordprotected'],
    identity: {
      category: 'conference',
      type: 'text', 
      name: 'Room Display Name'
    }
  }
}

Testing

All 49 tests pass, including new tests specifically for:

  • Service discovery query generation with unique IDs
  • Disco#info response parsing and ActivityStream conversion
  • Schema validation for room-info objects

🤖 Generated with Claude Code

@silverbucket silverbucket self-assigned this Jul 24, 2025
@silverbucket silverbucket requested a review from Copilot July 24, 2025 21:43
@silverbucket silverbucket added type:feature kredits-2 Medium contribution package:platform-xmpp Issues related to the XMPP platform labels Jul 24, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new XMPP MUC room information query feature that enables clients to discover room capabilities and metadata using XMPP service discovery (disco#info) queries. This implements XEP-0045 MUC specification for querying room features and identity information.

  • Adds a new room-info verb to the XMPP platform with proper schema validation
  • Implements service discovery queries using disco#info to retrieve room information
  • Processes disco#info responses to extract room features and identity metadata

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/schemas/src/helpers/objects.ts Adds schema definition for room-info object with features array and identity structure
packages/platform-xmpp/src/schema.js Adds "room-info" to allowed message types for XMPP platform
packages/platform-xmpp/src/index.js Implements roomInfo method that sends disco#info queries with unique IDs
packages/platform-xmpp/src/incoming-handlers.js Adds notifyRoomInfo handler for processing disco#info responses and converting to ActivityStream format
packages/platform-xmpp/src/index.test.js Adds test coverage for roomInfo method including XML generation and parameter validation
packages/platform-xmpp/src/incoming-handlers.test.data.js Adds test data with realistic XMPP disco#info response XML and expected ActivityStream output

@silverbucket silverbucket force-pushed the feature/xmpp-room-info-query branch 2 times, most recently from 2bdecff to ac72596 Compare September 26, 2025 12:27
silverbucket and others added 4 commits October 14, 2025 13:29
Implements service discovery (disco#info) to query room information and features.
Resolves #540.

🎉 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add room-info to XMPP platform README verb list
- Regenerate API documentation with room-info examples
- Fix validation test data to include room-info in schema error message

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@silverbucket silverbucket force-pushed the feature/xmpp-room-info-query branch from ac72596 to 6074ec4 Compare October 14, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kredits-2 Medium contribution package:platform-xmpp Issues related to the XMPP platform state:ready type:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant