[ejabberd] MUC - add a JID programmatically to chat "users"

Daniel Dormont dan at greywallsoftware.com
Fri Sep 2 03:02:56 MSD 2011

Hi folks,

I have a use case where I would like, every time a particular MUC
sends out packets to all its users (for example, if a user joins or
leaves, a groupchat message is posted, etc) to also send it to a
particular JID that I can designate. But I want it treated more like a
system account (in fact, it will probably be an external component). I
don't want this JID listed among the participants so everyone can see
it, I don't want the groupchat notified if this JID goes offline or
anything like that. If it *is* offline, I want the messages routed to
it to silently fail, just like any message routed to an invalid JID.

Basically something similar to mod_service_log, except for instead of
when the user sends the packet, I want it called with the MUC sends
the packet. I know I could use mod_service_log itself, but that would
be called for each packet the MUC sends to each user. That is not what
I want. I want each packet from the MUC to reach the special JID only

Looking at the code for mod_muc_room, the only thing I can think of is
to somehow inject the value in to state.users and modify
send_existing_presences to somehow exclude this special JID. But that
seems a little tacky. Is there any better way?


More information about the ejabberd mailing list