torchat 0.0.1.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +43 -0
- data/bin/torchatd +537 -0
- data/doc/protocol/broadcast.md +26 -0
- data/doc/protocol/groupchat.md +140 -0
- data/doc/protocol/latency.md +30 -0
- data/doc/protocol/standard.md +279 -0
- data/doc/protocol/typing.md +41 -0
- data/etc/torchat.yml +12 -0
- data/lib/torchat.rb +239 -0
- data/lib/torchat/protocol.rb +256 -0
- data/lib/torchat/protocol/broadcast.rb +40 -0
- data/lib/torchat/protocol/groupchat.rb +197 -0
- data/lib/torchat/protocol/latency.rb +44 -0
- data/lib/torchat/protocol/standard.rb +367 -0
- data/lib/torchat/protocol/typing.rb +36 -0
- data/lib/torchat/session.rb +603 -0
- data/lib/torchat/session/broadcast/message.rb +50 -0
- data/lib/torchat/session/broadcasts.rb +72 -0
- data/lib/torchat/session/buddies.rb +152 -0
- data/lib/torchat/session/buddy.rb +343 -0
- data/lib/torchat/session/buddy/joined_group_chat.rb +42 -0
- data/lib/torchat/session/buddy/joined_group_chats.rb +46 -0
- data/lib/torchat/session/buddy/latency.rb +54 -0
- data/lib/torchat/session/event.rb +79 -0
- data/lib/torchat/session/file_transfer.rb +173 -0
- data/lib/torchat/session/file_transfer/block.rb +51 -0
- data/lib/torchat/session/file_transfers.rb +89 -0
- data/lib/torchat/session/group_chat.rb +123 -0
- data/lib/torchat/session/group_chat/participant.rb +38 -0
- data/lib/torchat/session/group_chat/participants.rb +52 -0
- data/lib/torchat/session/group_chats.rb +74 -0
- data/lib/torchat/session/incoming.rb +187 -0
- data/lib/torchat/session/outgoing.rb +102 -0
- data/lib/torchat/tor.rb +107 -0
- data/lib/torchat/utils.rb +87 -0
- data/lib/torchat/version.rb +24 -0
- data/test/file_transfer/receiver.rb +41 -0
- data/test/file_transfer/sender.rb +45 -0
- data/test/group_chat/a.rb +37 -0
- data/test/group_chat/b.rb +37 -0
- data/test/group_chat/c.rb +57 -0
- data/torchat.gemspec +21 -0
- metadata +140 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'torchat'
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
OptionParser.new do |o|
|
8
|
+
o.on '-p', '--profile PROFILE', 'the profile name' do |name|
|
9
|
+
options[:profile] = name
|
10
|
+
end
|
11
|
+
end.parse!
|
12
|
+
|
13
|
+
EM.run {
|
14
|
+
Torchat.profile(options[:profile]).start {|s|
|
15
|
+
s.when :connect_to do |e|
|
16
|
+
Torchat.debug "connecting to #{e.address}:#{e.port}"
|
17
|
+
end
|
18
|
+
|
19
|
+
s.on :connect_failure do |e|
|
20
|
+
Torchat.debug "#{e.buddy.id} failed to connect"
|
21
|
+
end
|
22
|
+
|
23
|
+
s.on :connect do |e|
|
24
|
+
Torchat.debug "#{e.buddy.id} connected"
|
25
|
+
end
|
26
|
+
|
27
|
+
s.on :verify do |e|
|
28
|
+
Torchat.debug "#{e.buddy.id} has been verified"
|
29
|
+
end
|
30
|
+
|
31
|
+
s.on :disconnect do |e|
|
32
|
+
Torchat.debug "#{e.buddy.id} disconnected"
|
33
|
+
end
|
34
|
+
|
35
|
+
s.online!
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'torchat'
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
OptionParser.new do |o|
|
8
|
+
o.on '-p', '--profile PROFILE', 'the profile name' do |name|
|
9
|
+
options[:profile] = name
|
10
|
+
end
|
11
|
+
|
12
|
+
o.on '-i', '--invite NAME...', Array, 'list of names to invite' do |name|
|
13
|
+
options[:invite] = name
|
14
|
+
end
|
15
|
+
end.parse!
|
16
|
+
|
17
|
+
EM.run {
|
18
|
+
Torchat.profile(options[:profile]).start {|s|
|
19
|
+
s.when :connect_to do |e|
|
20
|
+
Torchat.debug "connecting to #{e.address}:#{e.port}"
|
21
|
+
end
|
22
|
+
|
23
|
+
s.on :connect_failure do |e|
|
24
|
+
Torchat.debug "#{e.buddy.id} failed to connect"
|
25
|
+
end
|
26
|
+
|
27
|
+
s.on :connect do |e|
|
28
|
+
Torchat.debug "#{e.buddy.id} connected"
|
29
|
+
end
|
30
|
+
|
31
|
+
s.on :verify do |e|
|
32
|
+
Torchat.debug "#{e.buddy.id} has been verified"
|
33
|
+
end
|
34
|
+
|
35
|
+
s.on :disconnect do |e|
|
36
|
+
Torchat.debug "#{e.buddy.id} disconnected"
|
37
|
+
end
|
38
|
+
|
39
|
+
s.group_chats.create.tap {|gc|
|
40
|
+
gc.on :group_chat_join do |e|
|
41
|
+
gc.send_message "yo #{e.buddy.id}"
|
42
|
+
|
43
|
+
s.set_interval 10 do
|
44
|
+
gc.send_message '^_^'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
options[:invite].each {|id|
|
49
|
+
s.buddies.add_temporary(id).on :ready do |e|
|
50
|
+
gc.invite(e.buddy)
|
51
|
+
end
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
s.online!
|
56
|
+
}
|
57
|
+
}
|
data/torchat.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Kernel.load 'lib/torchat/version.rb'
|
2
|
+
|
3
|
+
Gem::Specification.new {|s|
|
4
|
+
s.name = 'torchat'
|
5
|
+
s.version = Torchat.version
|
6
|
+
s.author = 'meh.'
|
7
|
+
s.email = 'meh@paranoici.org'
|
8
|
+
s.homepage = 'http://github.com/meh/ruby-torchat'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Torchat implementation in Ruby, event-driven EventMachine based library.'
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
s.add_dependency 'eventmachine', '>= 1.0.0.rc.4'
|
18
|
+
s.add_dependency 'em-socksify'
|
19
|
+
|
20
|
+
s.add_dependency 'iniparse'
|
21
|
+
}
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: torchat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.rc.1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- meh.
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: eventmachine
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0.rc.4
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0.rc.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: em-socksify
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: iniparse
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description:
|
63
|
+
email: meh@paranoici.org
|
64
|
+
executables:
|
65
|
+
- torchatd
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- README.md
|
70
|
+
- bin/torchatd
|
71
|
+
- doc/protocol/broadcast.md
|
72
|
+
- doc/protocol/groupchat.md
|
73
|
+
- doc/protocol/latency.md
|
74
|
+
- doc/protocol/standard.md
|
75
|
+
- doc/protocol/typing.md
|
76
|
+
- etc/torchat.yml
|
77
|
+
- lib/torchat.rb
|
78
|
+
- lib/torchat/protocol.rb
|
79
|
+
- lib/torchat/protocol/broadcast.rb
|
80
|
+
- lib/torchat/protocol/groupchat.rb
|
81
|
+
- lib/torchat/protocol/latency.rb
|
82
|
+
- lib/torchat/protocol/standard.rb
|
83
|
+
- lib/torchat/protocol/typing.rb
|
84
|
+
- lib/torchat/session.rb
|
85
|
+
- lib/torchat/session/broadcast/message.rb
|
86
|
+
- lib/torchat/session/broadcasts.rb
|
87
|
+
- lib/torchat/session/buddies.rb
|
88
|
+
- lib/torchat/session/buddy.rb
|
89
|
+
- lib/torchat/session/buddy/joined_group_chat.rb
|
90
|
+
- lib/torchat/session/buddy/joined_group_chats.rb
|
91
|
+
- lib/torchat/session/buddy/latency.rb
|
92
|
+
- lib/torchat/session/event.rb
|
93
|
+
- lib/torchat/session/file_transfer.rb
|
94
|
+
- lib/torchat/session/file_transfer/block.rb
|
95
|
+
- lib/torchat/session/file_transfers.rb
|
96
|
+
- lib/torchat/session/group_chat.rb
|
97
|
+
- lib/torchat/session/group_chat/participant.rb
|
98
|
+
- lib/torchat/session/group_chat/participants.rb
|
99
|
+
- lib/torchat/session/group_chats.rb
|
100
|
+
- lib/torchat/session/incoming.rb
|
101
|
+
- lib/torchat/session/outgoing.rb
|
102
|
+
- lib/torchat/tor.rb
|
103
|
+
- lib/torchat/utils.rb
|
104
|
+
- lib/torchat/version.rb
|
105
|
+
- test/file_transfer/receiver.rb
|
106
|
+
- test/file_transfer/sender.rb
|
107
|
+
- test/group_chat/a.rb
|
108
|
+
- test/group_chat/b.rb
|
109
|
+
- test/group_chat/c.rb
|
110
|
+
- torchat.gemspec
|
111
|
+
homepage: http://github.com/meh/ruby-torchat
|
112
|
+
licenses: []
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>'
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 1.3.1
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 1.8.24
|
132
|
+
signing_key:
|
133
|
+
specification_version: 3
|
134
|
+
summary: Torchat implementation in Ruby, event-driven EventMachine based library.
|
135
|
+
test_files:
|
136
|
+
- test/file_transfer/receiver.rb
|
137
|
+
- test/file_transfer/sender.rb
|
138
|
+
- test/group_chat/a.rb
|
139
|
+
- test/group_chat/b.rb
|
140
|
+
- test/group_chat/c.rb
|