Sac 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/sac_example.rb +5 -0
  2. data/lib/sac.rb +40 -0
  3. metadata +65 -0
@@ -0,0 +1,5 @@
1
+ #require 'sac'
2
+ require '../lib/sac'
3
+ require 'net/toc'
4
+
5
+ sac = Sac.new("username", "password")
data/lib/sac.rb ADDED
@@ -0,0 +1,40 @@
1
+ require 'sac'
2
+ require 'net/toc'
3
+
4
+ # Sac, Simple AIM Client, is an AIM client that outputs messages to standard
5
+ # output and reads in commands from standard input. To use it just create a
6
+ # new instance of Sac with your AIM username and password as a parameter.
7
+ # Alternatively, use the example provided in the bin/ directory and pass your
8
+ # info as command-line parameters.
9
+ class Sac
10
+
11
+ # Connects to AIM network using the supplied
12
+ # <em>username</em> and password.
13
+ def initialize(username, password)
14
+ @client = Net::TOC.new(username, password)
15
+
16
+ @client.connect
17
+
18
+ @client.on_im do | message, buddy |
19
+ message.gsub!(/<br>/i, " ")
20
+ message.gsub!(/<br\/>/i, " ")
21
+ message.gsub!(/<br \/>/i, " ")
22
+ message.gsub!(/<[^>]*>/, "")
23
+ puts Time.now.strftime("%I:%M%p") + " #{buddy.to_s}: #{message}"
24
+ end
25
+
26
+ end
27
+
28
+ private
29
+ def main_loop
30
+ while(input = gets)
31
+ if input =~ /^:m (\S+) (.+)/
32
+ client.buddy_list.buddy_named($1).send_im($2)
33
+ elsif input =~ /^:q/
34
+ client.disconnect
35
+ exit
36
+ end
37
+ end
38
+ end
39
+
40
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Sac
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marco Peraza
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-18 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: net-loc
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0.2"
24
+ version:
25
+ description:
26
+ email: marco_92@bellsouth.net
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - bin/sac_example.rb
35
+ - lib/sac.rb
36
+ has_rdoc: true
37
+ homepage:
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.3
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: A simple standard input/output AIM client
64
+ test_files: []
65
+