Skip to content

Commit

Permalink
added configurable setting for server port number
Browse files Browse the repository at this point in the history
now it is possible define what is the port number the client will use
to connect to the XMPP server.
  • Loading branch information
formigarafa committed Jun 5, 2013
1 parent a632bf2 commit 93bd354
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/credentials.rb.example
Expand Up @@ -2,6 +2,7 @@
BOT_LOGIN = "user@gmail.com"
BOT_PASSWORD = "password"
BOT_JABBER_HOST_SERVER = 'talk.google.com'
BOT_JABBER_SERVER_PORT = 5222

# Jabber-SH answers some random epigram via 'fortune' to any message sent to him.
# The user CLIENT_LOGIN logs into the console by sending the CLIENT_PASSPHRASE.
Expand Down
3 changes: 2 additions & 1 deletion lib/gems_patch.rb
Expand Up @@ -5,6 +5,7 @@ def initialize(connection_info, status = nil, status_message = "Available")
@jid = connection_info[:login]
@password = connection_info[:password]
@server = connection_info[:server]
@port = connection_info[:port] || 5222
@disconnected = false
status(status, status_message)
start_deferred_delivery_thread
Expand All @@ -24,7 +25,7 @@ def connect!
# Connect
jid = JID.new(@jid)
my_client = Client.new(@jid)
my_client.connect @server
my_client.connect @server, @port
my_client.auth(@password)
self.client = my_client

Expand Down
2 changes: 1 addition & 1 deletion lib/jabber_shell.rb
Expand Up @@ -4,7 +4,7 @@ class JabberShell
def connect
puts "Connecting..."
begin
self.messenger = Jabber::Simple.new({:login => BOT_LOGIN, :password => BOT_PASSWORD, :server =>BOT_JABBER_HOST_SERVER})
self.messenger = Jabber::Simple.new({:login => BOT_LOGIN, :password => BOT_PASSWORD, :server =>BOT_JABBER_HOST_SERVER, :port => BOT_JABBER_SERVER_PORT})
puts "Connected"
rescue Exception => e
puts "Ooops - Couldn't connect"
Expand Down

0 comments on commit 93bd354

Please sign in to comment.