Ricardo Pardini
Ricardo Pardini

Reputation: 950

Sending XMPP message to offline Google Talk user with ruby xmpp4r

When using Perl's Net::Jabber, sending a simple message to an offline user causes the message to be delivered to the user when he comes online (it even show's in the user's gmail account as unread messages). That's as simple as doing

my $msg = Net::Jabber::Message->new();
$msg->SetMessage(...);
$connection->Send($msg);

In Ruby xmpp4r, doing the same equivalent thing does not send the message to an offline user, instead returning (async) a xmpp service-unavailable stanza or even not returning anything, and also not working. Message is simply lost.

How can one send an offline message with xmpp4r?

Also, in related subject, in xmpp's api docs for Jabber::Stream's send method, there is a "block" parameter. How does one use that?

Thanks

Upvotes: 1

Views: 1210

Answers (1)

Joe Hildebrand
Joe Hildebrand

Reputation: 10414

Make sure that you're doing type=:chat on the message.

client.send(Jabber::Message.new(jid, contents).set_type(:chat))

(code copied from Ricardo Pardini's comment, for long-term clarity)

Upvotes: 3

Related Questions