Class: Sac
- Inherits:
-
Object
- Object
- Sac
- Defined in:
- lib/sac.rb
Overview
Sac, Simple AIM Client, is an AIM client that outputs messages to standard output and reads in commands from standard input. To use it just create a new instance of Sac with your AIM username and password as a parameter. Alternatively, use the example provided in the bin/ directory and pass your info as command-line parameters.
Instance Method Summary collapse
-
#initialize(username, password) ⇒ Sac
constructor
Connects to AIM network using the supplied username and password.
- #main_loop ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Sac
Connects to AIM network using the supplied username and password.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sac.rb', line 13 def initialize(username, password) @client = Net::TOC.new(username, password) @client.connect @client.on_im do | , buddy | .gsub!(/<br>/i, " ") .gsub!(/<br\/>/i, " ") .gsub!(/<br \/>/i, " ") .gsub!(/<[^>]*>/, "") puts Time.now.strftime("%I:%M%p") + " #{buddy.to_s}: #{}" end main_loop end |
Instance Method Details
#main_loop ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sac.rb', line 30 def main_loop loop do while(input = gets) if input =~ /^:m (\S+) (.+)/ @client.buddy_list.buddy_named($1).send_im($2) elsif input =~ /^:q/ @client.disconnect exit end end end end |