Skip to content

Instantly share code, notes, and snippets.

@aereal
Created April 14, 2011 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aereal/919251 to your computer and use it in GitHub Desktop.
Save aereal/919251 to your computer and use it in GitHub Desktop.
Jabber client which only do notify with Growl (requires 1.8.*)
#!/usr/bin/env ruby
require 'rubygems'
require 'pit'
require 'xmpp4r-simple'
def notify(title, msg='')
system("growlnotify '#{title}' -m '#{msg}'")
end
config = Pit.get('jabber', :require => {
'username' => 'Username of jabber account',
'password' => 'Password of jabber account',
})
im = Jabber::Simple.new(config['username'], config['password'])
Thread.start do
loop do
im.received_messages do |msg|
notify msg.from, msg.body
end
sleep 1
end
end
sleep
@denzuko
Copy link

denzuko commented Jan 15, 2012

you have a syntax error on line 4. it should read:

require 'pit'

@aereal
Copy link
Author

aereal commented Jan 16, 2012

Oh, thanks :)

@denzuko
Copy link

denzuko commented Jan 18, 2012

welcome, I'm glad to help any time ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment