Creating Custom Stanza in smack 4.2

时间:2017-08-04 11:56:32

标签: android xmpp smack multiuserchat

How can I sent a custom IQ Stanza using smack 4.2 in android. I tried to convert the following stanza in smack IQ but unsuccessful

<iq type="set" to="mygrp-2bf4a6cf@muclight.mydmain.org.com" from="+6500000000@mydmain.org.com" id="modarchive-22317496CE4C">
    <query
        xmlns="urn:xmpp:mam:1" queryid="queryId-1FF4671B-183F-4CEA-BF84-CAAA5BA3293A"/>  </iq>

My smack Code

 public IQ getCustomStanza(String group , String user){



        IQ miQ= new IQ ("query") {
            @Override
            protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {

                return (IQChildElementXmlStringBuilder) xml.append ("<query xmlns= urn:xmpp:mam:1 queryid=queryId-1FF4671B-183F-4CEA-BF84-CAAA5BA3293A/>");

            }
        };
        try {
            miQ.setFrom (JidCreate.bareFrom (user));
            miQ.setType (IQ.Type.set);
            miQ.setTo (JidCreate.bareFrom (group));
            miQ.setStanzaId ();
        } catch (XmppStringprepException e) {
            e.printStackTrace ( );
        }
        return miQ;
    }

but getting null

1 个答案:

答案 0 :(得分:0)

查看此人如何构造他的class ....尝试对其进行反向工程以满足您的需求