Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cummulative update #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
xmpp4r-simple (0.8.9)

[ Alexander Pervakov ]
* Changed reconnect timeout according to RFC 6120.

[ Emmett Shear, thelinuxlich, Alexander Pervakov ]
* Adding connection options (host, port, allow_tls).

[ David Rice ]
* Ruby 1.9 compatibility fix.

-- Alexander Pervakov <frost.nzcr4@jagmort.com> Monday, 04 May 2015 15:09:00 +0300

xmpp4r-simple (0.8.8)

[ Blaine Cook]
[ Blaine Cook ]
* Add xmpp4r-simple.gemspec, remove gem-related code from Rakefile

-- Blaine Cook <romeda@gmail.com> Wed, 30 Jul 2008 16:03:00 -0800

xmpp4r-simple (0.8.7)

[ Blaine Cook ]
* If using Jabber::Simple in a DRb environment, the Jabber::Simple object
* If using Jabber::Simple in a DRb environment, the Jabber::Simple object
will execute in the DRb server's environment to improve efficiency.
* Jabber::Simple will now recover gracefully from server-side disconnects.
* Updated Rakefile to pass tests on firebrigade (http://firebrigade.seattlerb.org)
Expand Down
20 changes: 16 additions & 4 deletions lib/xmpp4r-simple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,21 @@ class Simple
# to the Jabber server and your status message will be set to the string
# passed in as the status_message argument.
#
# jabber = Jabber::Simple.new("me@example.com", "password", "Chat with me - Please!")
def initialize(jid, password, status = nil, status_message = "Available")
# If you'd like to connect to a different talk server than the one which would
# be guessed from your jid, you may provide a server. For example, to connect
# to the gmail talk servers with a jid that doesn't end in @gmail.com, just provide
# options {:host => 'talk.l.google.com'}.
#
# jabber = Jabber::Simple.new("me@example.com", "password", "Chat with me - Please!", "Available", {:host => "host-not-from-jid.tld", :port => 64321})
def initialize(jid, password, status = nil, status_message = "Available", opts= {})
@jid = jid
@password = password
@disconnected = false
@opts = {
:host => opts[:host], # nil by default as in xmpp4r.
:port => !opts[:port].nil? ? opts[:port] : 5222, # xmpp4r default.
:allow_tls => !opts[:allow_tls].nil? ? opts[:allow_tls] : true # xmpp4r default.
}
status(status, status_message)
start_deferred_delivery_thread
end
Expand Down Expand Up @@ -336,7 +346,8 @@ def send!(msg)
retry unless attempts > 3
raise e
rescue Errno::ECONNRESET => e
sleep (attempts^2) * 60 + 60
# @see http://xmpp.org/rfcs/rfc6120.html#tcp-reconnect XMPP: Core - Reconnection
sleep 1 + rand(60) + (attempts - 1) * 20
disconnect
reconnect
retry unless attempts > 3
Expand Down Expand Up @@ -391,7 +402,8 @@ def connect!
# Connect
jid = JID.new(@jid)
my_client = Client.new(@jid)
my_client.connect
my_client.allow_tls = @opts[:allow_tls]
my_client.connect @opts[:host], @opts[:port]
my_client.auth(@password)
self.client = my_client

Expand Down
Binary file added xmpp4r-simple-0.8.8.gem
Binary file not shown.
2 changes: 1 addition & 1 deletion xmpp4r-simple.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('rake')
s.add_development_dependency('rcov')
s.name = "xmpp4r-simple"
s.version = "0.8.8"
s.version = "0.8.9"
s.author = "Blaine Cook"
s.email = "romeda@gmail.com"
s.homepage = "http://xmpp4r-simple.rubyforge.org/"
Expand Down