如何使用XMPP客户端获取Messages(标准Apple聊天应用程序)发送的内嵌图像?

时间:2017-02-06 18:44:49

标签: ios xmpp ejabberd xmppframework ichat

我有一个ios xmpp客户端,我希望能够获取从iMessage(ichat)发送的图像。 我正在实施XEP-0137以便能够从iChat获取文件。

当User1使用iMessage将图像发送到用我的xmpp客户端登录的user2时,它得到了(我与这部分无关,我完全无法控制它,因为它是由Apple标准聊天应用程序创建的,我只是想处理这个消息):

<message xmlns="jabber:client" from="user1@ejabberd.com/Sakj2019MacBookPro" to="user2@ejabberd.com"
type="chat" id="E399E1FF-8D8D-4220-83DD-B8615E6DF277">
    <x xmlns="http://www.apple.com/xmpp/message-attachments">
        <attachment id="1">
            <sipub xmlns="http://jabber.org/protocol/sipub" from="user1@ejabberd.com/Sakj2019MacBookPro"
            id="sipubid_7D0EF6A6" mime-type="binary/octet-stream" profile="http://jabber.org/protocol/si/profile/file-transfer">
                <file xmlns="http://jabber.org/protocol/si/profile/file-transfer" xmlns:ichat="apple:profile:transfer-extensions"
                name="small.png" size="1182" ichat:posixflags="000001A4" />
            </sipub>
        </attachment>
    </x>
    <body/>
    <html xmlns="http://jabber.org/protocol/xhtml-im">

    <body xmlns="http://www.w3.org/1999/xhtml"><img alt="small.png" src="message-attachments:1" width="144" height="144" />
    </body>

    </html>
    <x xmlns="jabber:x:event">
        <composing/>
    </x>
    <active xmlns="http://jabber.org/protocol/chatstates" />
</message>

收到此消息后,我处理它并根据http://xmpp.org/extensions/xep-0137.html向发送者(user1)发送IQ:

  <iq type='get'
      id='sipub-request-0'
      from='user2@ejabberd.com/sdafz23123sdf'
      to='user1@ejabberd.com/Sakj2019MacBookPro'>
    <start xmlns='http://jabber.org/protocol/sipub'
           id='sipubid_7D0EF6A6'/>
  </iq>

但是我收到了这个错误: 发件人否认,因为禁止接收器

  <iq type='error'
      id='sipub-set-1'
      from='user1@ejabberd.com/Sakj2019MacBookPro'
      to='user2@ejabberd.com/sdafz23123sdf'>
    <start xmlns='http://jabber.org/protocol/sipub'>sipubid_7D0EF6A6</start>
    <error code='403' type='auth'>
      <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    </error>
  </iq>

我尝试了不同的东西,但仍然没有运气!

这是我的ejabberd服务器日志的一部分,显示我正在获取图像:

2017-02-03 14:22:30.648 [debug] <0.23733.0>@ejabberd_receiver:process_data:284 Received XML on stream = <<"\r\n">>
2017-02-03 14:22:30.648 [debug] <0.23733.0>@shaper:update:120 State: {maxrate,1000,32.728263634574134,1486149717476774}, Size=2
M=1.0166363715950295, I=33171.384
2017-02-03 14:22:34.140 [debug] <0.23733.0>@ejabberd_receiver:process_data:284 Received XML on stream = <<60,109,101,115,115,97,103,101,32,116,111,61,34,98,101,115,97,116,45,108,100,110,64,101,106,97,98,98,101,114,100,45,100,101,118,46,109,111,114,103,105,105,106,46,99,111,109,34,32,116,121,112,101,61,34,99,104,97,116,34,32,105,100,61,34,69,51,57,57,69,49,70,70,45,56,68,56,68,45,52,50,50,48,45,56,51,68,68,45,66,56,54,49,53,69,54,68,70,50,55,55,34,62,60,120,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,119,119,46,97,112,112,108,101,46,99,111,109,47,120,109,112,112,47,109,101,115,115,97,103,101,45,97,116,116,97,99,104,109,101,110,116,115,34,62,60,97,116,116,97,99,104,109,101,110,116,32,105,100,61,34,49,34,62,60,115,105,112,117,98,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,115,105,112,117,98,34,32,102,114,111,109,61,34,116,109,103,97,100,109,105,110,64,101,106,97,98,98,101,114,100,45,100,101,118,46,109,111,114,103,105,105,106,46,99,111,109,47,66,101,115,97,116,226,128,153,115,32,77,97,99,66,111,111,107,32,80,114,111,34,32,105,100,61,34,115,105,112,117,98,105,100,95,55,68,48,69,70,54,65,54,34,32,109,105,109,101,45,116,121,112,101,61,34,98,105,110,97,114,121,47,111,99,116,101,116,45,115,116,114,101,97,109,34,32,112,114,111,102,105,108,101,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,115,105,47,112,114,111,102,105,108,101,47,102,105,108,101,45,116,114,97,110,115,102,101,114,34,62,60,102,105,108,101,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,115,105,47,112,114,111,102,105,108,101,47,102,105,108,101,45,116,114,97,110,115,102,101,114,34,32,120,109,108,110,115,58,105,99,104,97,116,61,34,97,112,112,108,101,58,112,114,111,102,105,108,101,58,116,114,97,110,115,102,101,114,45,101,120,116,101,110,115,105,111,110,115,34,32,110,97,109,101,61,34,115,109,97,108,108,46,112,110,103,34,32,115,105,122,101,61,34,49,49,56,50,34,32,105,99,104,97,116,58,112,111,115,105,120,102,108,97,103,115,61,34,48,48,48,48,48,49,65,52,34,47,62,60,47,115,105,112,117,98,62,10,60,47,97,116,116,97,99,104,109,101,110,116,62,10,60,47,120,62,10,60,98,111,100,121,62,60,47,98,111,100,121,62,10,60,104,116,109,108,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,120,104,116,109,108,45,105,109,34,62,60,98,111,100,121,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,49,57,57,57,47,120,104,116,109,108,34,32,62,60,105,109,103,32,97,108,116,61,34,115,109,97,108,108,46,112,110,103,34,32,115,114,99,61,34,109,101,115,115,97,103,101,45,97,116,116,97,99,104,109,101,110,116,115,58,49,34,32,119,105,100,116,104,61,34,49,52,52,34,32,104,101,105,103,104,116,61,34,49,52,52,34,32,47,62,60,47,98,111,100,121,62,60,47,104,116,109,108,62,60,120,32,120,109,108,110,115,61,34,106,97,98,98,101,114,58,120,58,101,118,101,110,116,34,62,60,99,111,109,112,111,115,105,110,103,47,62,60,47,120,62,10,60,97,99,116,105,118,101,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,99,104,97,116,115,116,97,116,101,115,34,47,62,60,47,109,101,115,115,97,103,101,62,10>>
2017-02-03 14:22:34.141 [debug] <0.23733.0>@shaper:update:120 State: {maxrate,1000,16.394278152421222,1486149750648302}, Size=913
M=460.2729211476611, I=3492.751

这是我为user1获取的所有功能:

  <query xmlns="http://jabber.org/protocol/disco#info">
    <identity category="pubsub" type="pep"/>
    <identity category="server" type="im" name="ejabberd"/>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>http://jabber.org/network/serverinfo</value>
      </field>
    </x>
    <feature var="http://jabber.org/protocol/commands"/>
    <feature var="http://jabber.org/protocol/disco#info"/>
    <feature var="http://jabber.org/protocol/disco#items"/>
    <feature var="http://jabber.org/protocol/offline"/>
    <feature var="http://jabber.org/protocol/pubsub"/>
    <feature var="http://jabber.org/protocol/pubsub#access-authorize"/>
    <feature var="http://jabber.org/protocol/pubsub#access-open"/>
    <feature var="http://jabber.org/protocol/pubsub#access-presence"/>
    <feature var="http://jabber.org/protocol/pubsub#access-whitelist"/>
    <feature var="http://jabber.org/protocol/pubsub#auto-create"/>
    <feature var="http://jabber.org/protocol/pubsub#auto-subscribe"/>
    <feature var="http://jabber.org/protocol/pubsub#collections"/>
    <feature var="http://jabber.org/protocol/pubsub#config-node"/>
    <feature var="http://jabber.org/protocol/pubsub#create-and-configure"/>
    <feature var="http://jabber.org/protocol/pubsub#create-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#delete-items"/>
    <feature var="http://jabber.org/protocol/pubsub#delete-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#filtered-notifications"/>
    <feature var="http://jabber.org/protocol/pubsub#get-pending"/>
    <feature var="http://jabber.org/protocol/pubsub#instant-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#item-ids"/>
    <feature var="http://jabber.org/protocol/pubsub#last-published"/>
    <feature var="http://jabber.org/protocol/pubsub#manage-subscriptions"/>
    <feature var="http://jabber.org/protocol/pubsub#member-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#modify-affiliations"/>
    <feature var="http://jabber.org/protocol/pubsub#outcast-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#persistent-items"/>
    <feature var="http://jabber.org/protocol/pubsub#presence-notifications"/>
    <feature var="http://jabber.org/protocol/pubsub#presence-subscribe"/>
    <feature var="http://jabber.org/protocol/pubsub#publish"/>
    <feature var="http://jabber.org/protocol/pubsub#publish-only-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#publisher-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#purge-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#retract-items"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-affiliations"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-default"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-items"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-subscriptions"/>
    <feature var="http://jabber.org/protocol/pubsub#shim"/>
    <feature var="http://jabber.org/protocol/pubsub#subscribe"/>
    <feature var="http://jabber.org/protocol/pubsub#subscription-notifications"/>
    <feature var="https://apple.com/push"/>
    <feature var="iq"/>
    <feature var="jabber:iq:last"/>
    <feature var="jabber:iq:privacy"/>
    <feature var="jabber:iq:register"/>
    <feature var="jabber:iq:version"/>
    <feature var="msgoffline"/>
    <feature var="presence"/>
    <feature var="urn:xmpp:blocking"/>
    <feature var="urn:xmpp:carbons:1"/>
    <feature var="urn:xmpp:carbons:2"/>
    <feature var="urn:xmpp:mam:0"/>
    <feature var="urn:xmpp:mam:1"/>
    <feature var="urn:xmpp:mam:tmp"/>
    <feature var="urn:xmpp:ping"/>
    <feature var="vcard-temp"/>
  </query>

我认为缺少这些功能:

<feature var="http://jabber.org/protocol/bytestreams">
<feature var="http://jabber.org/protocol/si/profile/file-transfer">
<feature var="http://jabber.org/protocol/sipub">

任何想法如何在ejabberd中启用它们?

0 个答案:

没有答案