如何使用Xmpp Android更改图像节请求

时间:2017-06-26 10:04:35

标签: android xmpp

我必须在我的代码中传递节,如下面的格式:

<message type="set" id="ANY_ID_NAME" from="919586082989@abc.com" to="919033301266@abc.com" chattype="singlechat"><data xmlns="http://jabber.org/protocol/ibb" seq="1" sid="i781hf64">imgdata</data><timestamp>2017-06-16 17:08:37</timestamp><mediatype>image</mediatype></message>

我怎么能这样做,因为我没有得到节发送请求发送类没有从我编辑代码的地方获得正确的功能。

在代码中我发现了该函数从哪个节生成的字符串:

private synchronized void sendPacket(final AbstractStanza packet) {
    if (stanzasSent == Integer.MAX_VALUE) {
        resetStreamId();
        disconnect(true);
        return;
    }
    synchronized (this.mStanzaQueue) {
        tagWriter.writeStanzaAsync(packet);
        if (packet instanceof AbstractAcknowledgeableStanza) {
            AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
            ++stanzasSent;
            this.mStanzaQueue.append(stanzasSent, stanza);
            if (stanza instanceof MessagePacket && stanza.getId() != null && getFeatures().sm()) {
                if (Config.EXTENDED_SM_LOGGING) {
                    Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": requesting ack for message stanza #" + stanzasSent);
                }
                tagWriter.writeStanzaAsync(new RequestPacket(this.smVersion));
            }
        }
    }
} 

2)并且在XmppConnection类中也发现了这个函数。这是我发现的正确方法

private void sendStartStream() throws IOException {
    final Tag stream = Tag.start("stream:stream");
    stream.setAttribute("to", account.getServer().toString());
    stream.setAttribute("version", "1.0");
    stream.setAttribute("xml:lang", "en");
    stream.setAttribute("xmlns", "jabber:client");
    stream.setAttribute("xmlns:stream", "http://etherx.jabber.org/streams");
    tagWriter.writeTag(stream);
}

请建议我如何更改上面发布的图像节请求。

0 个答案:

没有答案