sac 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/sac_example.rb +5 -0
- data/lib/sac.rb +43 -0
- metadata +65 -0
data/bin/sac_example.rb
ADDED
data/lib/sac.rb
ADDED
@@ -0,0 +1,43 @@
|
|
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
|
+
main_loop
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def main_loop
|
31
|
+
loop do
|
32
|
+
while(input = gets)
|
33
|
+
if input =~ /^:m (\S+) (.+)/
|
34
|
+
@client.buddy_list.buddy_named($1).send_im($2)
|
35
|
+
elsif input =~ /^:q/
|
36
|
+
@client.disconnect
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
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-toc
|
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: A simple standard input/output AIM client
|
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: http://sac.rubyforge.org
|
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: sac
|
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
|
+
|