1

I try to realize simple code on perl which should just get/send messages from/to gtalk accounts. I use Net::XMPP::*

modules. All works just fine for users, who are my friends (in my "buddy" list). But i can't send message to unknown user. I know, that for this case i must send an invitation first, but

Net::XMPP::* don't provide this possibility. There is only one way to invite person - construct my own xml according

to "XEP-0155 Stanza Session Negotiation" protocol. But this doesn't work correct. When i send xml to server, it

returns error "service-unavailable".

I send:

<message to='TEST@gmail.com'>
 <sxde xmlns='http://jabber.org/protocol/sxde'
   xmlns:sxde='http://jabber.org/protocol/sxde#metadata'
   session='0AEF4278DC4B6577'
   id='b'>
  <negotiation>
    <invitation>
      <feature var='http://jabber.org/protocol/whiteboard' />
    </invitation>
  </negotiation>
 </sxde>
</message>

before my message.

ANSWER:

<message from='' to='ME@gmail.com/TALKCDDCCE63' type='error'>
  <sxde id='b' session='0AEF4278DC4B6577' xmlns='http://jabber.org/protocol/sxde' xmlns:sxde='http://jabber.org/protocol/sxde#metadata'>
    <negotiation>
      <invitation>
        <feature var='http://jabber.org/protocol/whiteboard'/>
      </invitation>
    </negotiation>
  </sxde>
<nos:x value='disabled' xmlns:nos='google:nosave'/>
<arc:record otr='false' xmlns:arc='http://jabber.org/protocol/archive'/>
<error code='503' type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>

Maybe i lost smth or should send another info before (or after..) ?

Or maybe there are another way to send message without any invitation?

Thanks in advance

4

2 に答える 2

0

修理済み。送ればいいだけ

$xmpp->Send("<presence to='$address' type='subscribe' /></presence>")

それで全部です

于 2010-05-19T15:05:55.870 に答える
0

まず、jid を認証する必要があります。次に、メッセージ スタンザを xmpp サーバーに送信できます。プレゼンス通知にのみサブスクリプションが必要です。

<message to='ME@gmail.com/TALKCDDCCE63' type='chat' xmlns='jabber:client'>
<body>TEST MESSAGE</body>
</message>
于 2010-05-18T15:05:02.930 に答える