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

Allow a server hostname override for JIDs #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions lib/xmpp4r-simple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,17 @@ class Simple
# to the Jabber server and your status message will be set to the string
# passed in as the status_message argument.
#
# 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
# 'talk.l.google.com' as the server. You may leave server as nil to use the default.
#
# jabber = Jabber::Simple.new("me@example.com", "password", "Chat with me - Please!")
def initialize(jid, password, status = nil, status_message = "Available")
def initialize(jid, password, status = nil, status_message = "Available", server=nil)
@jid = jid
@password = password
@disconnected = false
@server = server
status(status, status_message)
start_deferred_delivery_thread
end
Expand Down Expand Up @@ -391,7 +397,7 @@ def connect!
# Connect
jid = JID.new(@jid)
my_client = Client.new(@jid)
my_client.connect
my_client.connect(@server)
my_client.auth(@password)
self.client = my_client

Expand Down