Skip to content

also send XEP-0425 moderation so Dino (and similar clients) delete locally. #11

@github-actions

Description

@github-actions

Requires bridge component JID to be a MUC moderator.

# Option 1 hack: also send XEP-0425 moderation so Dino (and similar clients) delete locally.
# Requires bridge component JID to be a MUC moderator.

    logger.info("XMPP retraction bridged: room={} author={} message={}", room_jid, nick, target_msg_id)
    comp._bus.publish("xmpp", evt)

    # Option 1 hack: also send XEP-0425 moderation so Dino (and similar clients) delete locally.
    # Requires bridge component JID to be a MUC moderator.
    if cfg.xmpp_promote_retraction_to_moderation and target_msg_id:
        comp._recently_moderated_by_us[dedupe_key] = None
        task = asyncio.create_task(_send_moderation_for_retraction(comp, room_jid, target_msg_id))
        comp._moderation_tasks.add(task)
        task.add_done_callback(comp._moderation_tasks.discard)


def on_moderated_message(comp: XMPPComponent, msg: Any) -> None:
    """Handle XEP-0425 moderator retraction; emit delete to bus."""
    from_jid = str(msg["from"]) if msg["from"] else ""
    # XEP-0425 §5: only moderation from the MUC service (bare room JID) is legitimate
    if "/" in from_jid:
        return  # From occupant; discard (spoofing)
    room_jid = from_jid
    if not room_jid:
        return

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions