views:

215

answers:

2

Hi

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='[email protected]'>
 <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='[email protected]/TALKCDDCCE63' type='error'>
  <sxde id='b' session='0AEF4278DC4B6577' xmlns='http://jabber.org/protocol/sxde' xmlns:sxde='http://jabber.org/protocol/sxde#metadata'&gt;
    <negotiation>
      <invitation>
        <feature var='http://jabber.org/protocol/whiteboard'/&gt;
      </invitation>
    </negotiation>
  </sxde>
<nos:x value='disabled' xmlns:nos='google:nosave'/>
<arc:record otr='false' xmlns:arc='http://jabber.org/protocol/archive'/&gt;
<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

A: 

First You need to authenticate your jid, then you could send message stanza to xmpp server. Subscription required only for presence notifications.

<message to='[email protected]/TALKCDDCCE63' type='chat' xmlns='jabber:client'>
<body>TEST MESSAGE</body>
</message>
frx
As i understand, my auth process run correct, please, take a look at my code and said if there is smth wrong: <pre> <code> $xmpp = new Net::XMPP::Client->new(debuglevel=>2,debugfile=>'SOME_FILE'); my $xmppsid = $xmpp->{SESSION}->{id}; $xmpp->{STREAM}->{SIDS}->{$xmppsid}->{hostname} = 'gmail.com'; my @connect_status = $xmpp->AuthSend( username=>$login password=>$password, resource=>'TALK', hostname=>'gmail.com' ); exit if $connect_status[0] ne 'ok' ; $xmpp->Process(); </code> </pre>I should send to server smth else?
Gizzo
A: 

Fixed. I just need to send

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

That's all

Gizzo