Project

General

Profile

Messages for domain are always delivered to admins

Daniele Ricci
Added almost 2 years ago

Hello,

before reporting this as an issue, I'd like to be sure that it is indeed one.

I can see that messages delivered to the local domain host are also copied to admins. Is that intended?

There is a method in class SessionManager called processAdminsOrDomains which handles this specific case, but it is called from two points, both in SessionManager:

  • from void processPacket(Packet packet, XMPPResourceConnection conn) which I is fine

  • from void processPacket(final Packet packet)

The latter is where processAdminsOrDomains() is called indiscriminately, without checking if the packet was already processed.

I'd be grateful for any clarification on the matter.

Best


Replies (5)

Added by Wojciech Kapcia TigaseTeam almost 2 years ago

Daniele Ricci wrote:

I can see that messages delivered to the local domain host are also copied to admins. Is that intended?

Not really:

<message  to="firefly" id="domain-msg">
<body>test-domain</body>
</message>

<message from="firefly" type="error" to="tigase_1@firefly/Psi+/1" id="domain-msg">
<body>test-domain</body>
<error type="auth" code="401">
<not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">You must authorize session first.</text>
</error>
</message>

Is it happening on the default Tigase installation or with a server with some customizations?

Added by Daniele Ricci almost 2 years ago

I'm using a custom plugin for these kind of messages:

https://github.com/kontalk/tigase-extension/blob/master/src/main/java/org/kontalk/xmppserver/ExtendedAddressing.java

It's kind of a multicast message (using XEP-0033: Extended Stanza Addressing), but the "to" attribute of the original message is set to the XMPP service name by the recipient.

JID to = JID.jidInstance(jid);  // jid is looped from the extended addressing elements
Packet fwd = packet.copyElementOnly();
fwd.initVars(packet.getStanzaFrom(), to);
stripAddresses(fwd);  // this removes the extended addressing elements

packet.processedBy(ID);
results.offer(fwd);

Am I doing something wrong?

Thanks

P.S. I know these kind of things should be implemented by a component, but there were some issues with designing it as a component so I went for a plugin.

Added by Wojciech Kapcia TigaseTeam almost 2 years ago

You are right - it would be better to implement it as component with distinct addressing - I would say you could modify from void processPacket(final Packet packet) and add same check for packet.wasProcessed() in the condition.

Added by Daniele Ricci almost 2 years ago

Thanks for your reply!

I would say you could modify from void processPacket(final Packet packet) and add same check for packet.wasProcessed() in the condition.

I'm not following, sorry. Are you talking about a plugin or a component?

Added by Daniele Ricci almost 2 years ago

No worries, I succeeded in converting it to a component finally :)

Thanks!

    (1-5/5)