Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Using XMPP4R-Simple to check for activity. (See related posts)

Using XMPP4R--Simple these Ruby code snippets show a user's status change and any messages they may have sent you since the last time.

# user1 changes their status to away
jabber.presence_updates do |friend, old_presence, new_presence|
  puts "Received presence update from #{friend.to_s}: #{new_presence}"
end

# user1 sends the message "do you like Tofu?"
jabber.received_messages do |message|
  puts "Received message from #{message.from}: #{message.body}"
end



Reference: http://xmpp4r-simple.rubyforge.org/

You need to create an account or log in to post comments to this site.


Click here to browse all 7309 code snippets

Related Posts