AnsweredAssumed Answered

Force "From" attribute in outgoing stanzas

Question asked by Amitoj on Jul 27, 2016
Latest reply on Jul 28, 2016 by Flow

Hi,

It seems like Smack removes 'from' attribute from all outgoing stanzas as per this issue https://issues.igniterealtime.org/browse/SMACK-547 .

 

Generally this behavior works fine, but I'm trying to implement a proposed extension ( https://docs.ejabberd.im/developer/proposed-extensions/muc-sub/ ) . Apparently ejabberd expects 'from' attribute in custom-iq stanza to function properly. Is there a way to force "from" attribute into a particular packet.

 

Here is my code:

public class MucSubIq extends IQ {...}
final MucSubIq mucSubIq = new MucSubIq(this.nick);
mucSubIq.setFrom(myXmppId);
mucSubIq.setTo(groupName);
mucSubIq.setType(IQ.Type.set);
Log.i(TAG,mucSubIq.toXML().toString());  //Prints: <iq to='temproom@conference.gappi.in' from='9739937980@gappi.in' id='M630P-12' type='set'>...</iq>
connection.sendStanza(mucSubIq); //Debug Output: SENT (0): <iq to='temproom@conference.gappi.in' id='M630P-12' type='set'>...</iq>

Outcomes