cerberus 0.7.6 → 0.7.7
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.
- data/Changelog.txt +21 -1
- data/Rakefile +2 -2
- data/lib/cerberus/cli.rb +1 -1
- data/lib/cerberus/constants.rb +1 -1
- data/lib/cerberus/manager.rb +5 -5
- data/lib/cerberus/publisher/base.rb +1 -1
- data/lib/cerberus/publisher/irc.rb +8 -13
- data/lib/cerberus/publisher/mail.rb +1 -0
- data/lib/cerberus/scm/git.rb +1 -1
- data/lib/vendor/addressable/CHANGELOG +88 -0
- data/lib/vendor/addressable/LICENSE +20 -0
- data/lib/vendor/addressable/README +50 -0
- data/lib/vendor/addressable/Rakefile +74 -0
- data/lib/vendor/addressable/addressable.gemspec +30 -0
- data/lib/vendor/addressable/lib/addressable/idna.rb +4871 -0
- data/lib/vendor/addressable/lib/addressable/template.rb +1049 -0
- data/lib/vendor/addressable/lib/addressable/uri.rb +2078 -0
- data/lib/vendor/addressable/lib/addressable/version.rb +36 -0
- data/lib/vendor/addressable/spec/addressable/idna_spec.rb +194 -0
- data/lib/vendor/addressable/spec/addressable/template_spec.rb +2152 -0
- data/lib/vendor/addressable/spec/addressable/uri_spec.rb +3914 -0
- data/lib/vendor/addressable/spec/data/rfc3986.txt +3419 -0
- data/lib/vendor/addressable/tasks/clobber.rake +2 -0
- data/lib/vendor/addressable/tasks/gem.rake +68 -0
- data/lib/vendor/addressable/tasks/git.rake +40 -0
- data/lib/vendor/addressable/tasks/metrics.rake +22 -0
- data/lib/vendor/addressable/tasks/rdoc.rake +29 -0
- data/lib/vendor/addressable/tasks/rubyforge.rake +89 -0
- data/lib/vendor/addressable/tasks/spec.rake +47 -0
- data/lib/vendor/addressable/website/index.html +110 -0
- data/lib/vendor/shout-bot/TODO +2 -0
- data/lib/vendor/shout-bot/lib/shout-bot.rb +76 -0
- data/lib/vendor/shout-bot/shout-bot.gemspec +13 -0
- data/lib/vendor/tinder/CHANGELOG.txt +39 -0
- data/lib/vendor/tinder/Manifest.txt +10 -0
- data/lib/vendor/tinder/README.txt +48 -0
- data/lib/vendor/tinder/Rakefile +45 -0
- data/lib/vendor/tinder/VERSION +1 -0
- data/lib/vendor/tinder/init.rb +1 -0
- data/lib/vendor/tinder/lib/tinder.rb +12 -0
- data/lib/vendor/tinder/lib/tinder/campfire.rb +75 -0
- data/lib/vendor/tinder/lib/tinder/connection.rb +74 -0
- data/lib/vendor/tinder/lib/tinder/multipart.rb +63 -0
- data/lib/vendor/tinder/lib/tinder/room.rb +225 -0
- data/lib/vendor/tinder/site/index.html +101 -0
- data/lib/vendor/tinder/site/stylesheets/style.css +77 -0
- data/lib/vendor/tinder/spec/fixtures/rooms.json +18 -0
- data/lib/vendor/tinder/spec/fixtures/rooms/room80749.json +21 -0
- data/lib/vendor/tinder/spec/fixtures/rooms/room80751.json +21 -0
- data/lib/vendor/tinder/spec/fixtures/rooms/show.json +21 -0
- data/lib/vendor/tinder/spec/fixtures/users/me.json +11 -0
- data/lib/vendor/tinder/spec/spec.opts +2 -0
- data/lib/vendor/tinder/spec/spec_helper.rb +12 -0
- data/lib/vendor/tinder/spec/tinder/campfire_spec.rb +53 -0
- data/lib/vendor/tinder/spec/tinder/connection_spec.rb +29 -0
- data/lib/vendor/tinder/spec/tinder/room_spec.rb +98 -0
- data/lib/vendor/tinder/tinder.gemspec +79 -0
- data/test/functional_test.rb +19 -4
- data/test/integration_test.rb +1 -1
- data/test/irc_publisher_test.rb +4 -4
- data/test/mock/manager.rb +1 -1
- metadata +58 -20
- data/lib/vendor/irc/README +0 -23
- data/lib/vendor/irc/lib/IRC.rb +0 -164
- data/lib/vendor/irc/lib/IRCChannel.rb +0 -33
- data/lib/vendor/irc/lib/IRCConnection.rb +0 -134
- data/lib/vendor/irc/lib/IRCEvent.rb +0 -91
- data/lib/vendor/irc/lib/IRCUser.rb +0 -23
- data/lib/vendor/irc/lib/IRCUtil.rb +0 -49
- data/lib/vendor/irc/lib/eventmap.yml +0 -247
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tinder}
|
8
|
+
s.version = "1.3.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Brandon Keepers"]
|
12
|
+
s.date = %q{2009-12-17}
|
13
|
+
s.description = %q{An API for interfacing with Campfire, the 37Signals chat application.}
|
14
|
+
s.email = %q{brandon@opensoul.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.txt"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"CHANGELOG.txt",
|
21
|
+
"Manifest.txt",
|
22
|
+
"README.txt",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"init.rb",
|
26
|
+
"lib/tinder.rb",
|
27
|
+
"lib/tinder/campfire.rb",
|
28
|
+
"lib/tinder/connection.rb",
|
29
|
+
"lib/tinder/multipart.rb",
|
30
|
+
"lib/tinder/room.rb",
|
31
|
+
"site/index.html",
|
32
|
+
"site/stylesheets/style.css",
|
33
|
+
"spec/campfire_spec.rb",
|
34
|
+
"spec/html/full_lobby.html",
|
35
|
+
"spec/html/normal_lobby.html",
|
36
|
+
"spec/html/transcript.html",
|
37
|
+
"spec/spec.opts",
|
38
|
+
"spec/spec_helper.rb",
|
39
|
+
"test/remote/credentials.rb.example",
|
40
|
+
"test/remote/remote_campfire_test.rb",
|
41
|
+
"test/test_helper.rb",
|
42
|
+
"tinder.gemspec"
|
43
|
+
]
|
44
|
+
s.homepage = %q{http://github.com/collectiveidea/tinder}
|
45
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubyforge_project = %q{tinder}
|
48
|
+
s.rubygems_version = %q{1.3.5}
|
49
|
+
s.summary = %q{An (unofficial) Campfire API}
|
50
|
+
s.test_files = [
|
51
|
+
"spec/campfire_spec.rb",
|
52
|
+
"spec/spec_helper.rb",
|
53
|
+
"test/remote/remote_campfire_test.rb",
|
54
|
+
"test/test_helper.rb"
|
55
|
+
]
|
56
|
+
|
57
|
+
if s.respond_to? :specification_version then
|
58
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
59
|
+
s.specification_version = 3
|
60
|
+
|
61
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
62
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
63
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
68
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
69
|
+
s.add_dependency(%q<mime-types>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
74
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
75
|
+
s.add_dependency(%q<mime-types>, [">= 0"])
|
76
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
data/test/functional_test.rb
CHANGED
@@ -136,7 +136,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
136
136
|
# assert_equal 1, ActionMailer::Base.deliveries.size
|
137
137
|
end
|
138
138
|
|
139
|
-
def
|
139
|
+
def test_multiple_publishers_without_configuration
|
140
140
|
add_application('myapp', SVN_URL, 'publisher' => {'active' => 'mail , jabber , irc, dddd'})
|
141
141
|
|
142
142
|
build = Cerberus::BuildCommand.new('myapp')
|
@@ -190,6 +190,21 @@ class FunctionalTest < Test::Unit::TestCase
|
|
190
190
|
assert_match /Task 'custom2' has been invoked/, output
|
191
191
|
end
|
192
192
|
|
193
|
+
def test_build_setup_script
|
194
|
+
add_application('rake_cust', SVN_URL, {
|
195
|
+
'builder' => {'rake' => {'task' => 'custom1'}},
|
196
|
+
'setup_script' => "echo 'setup script has been invoked' ",
|
197
|
+
}
|
198
|
+
)
|
199
|
+
|
200
|
+
build = Cerberus::BuildAllCommand.new
|
201
|
+
build.run
|
202
|
+
assert_equal 1, ActionMailer::Base.deliveries.size
|
203
|
+
output = ActionMailer::Base.deliveries[0].body
|
204
|
+
assert_match /setup script has been invoked/, output
|
205
|
+
assert_match /Task 'custom1' has been invoked/, output
|
206
|
+
end
|
207
|
+
|
193
208
|
def test_logs_disabled
|
194
209
|
add_application('rake_cust', SVN_URL, 'log' => {'enable' => false})
|
195
210
|
build = Cerberus::BuildAllCommand.new
|
@@ -333,14 +348,14 @@ class FunctionalTest < Test::Unit::TestCase
|
|
333
348
|
|
334
349
|
def test_mercurial
|
335
350
|
add_application('hgapp', HG_URL, :scm => {:type => 'hg'})
|
336
|
-
|
351
|
+
|
337
352
|
build = Cerberus::BuildCommand.new('hgapp')
|
338
353
|
build.run
|
339
354
|
assert build.scm.has_changes?
|
340
355
|
assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup
|
341
356
|
mail = ActionMailer::Base.deliveries[0]
|
342
357
|
output = mail.body
|
343
|
-
|
358
|
+
|
344
359
|
#Check output that run needed tasks
|
345
360
|
assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output
|
346
361
|
assert output !~ /Task 'custom1' has been invoked/
|
@@ -373,7 +388,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
373
388
|
curr_dir = Dir.pwd
|
374
389
|
Dir.chdir HG_REPO
|
375
390
|
`hg add #{test_case_name}`
|
376
|
-
`hg commit -m 'somepatch'`
|
391
|
+
`hg commit -m 'somepatch' --config ui.username='Fake User <fake.user@example.com>'`
|
377
392
|
Dir.chdir curr_dir
|
378
393
|
|
379
394
|
build = Cerberus::BuildCommand.new('hgapp')
|
data/test/integration_test.rb
CHANGED
data/test/irc_publisher_test.rb
CHANGED
@@ -8,13 +8,13 @@ require 'mock/manager'
|
|
8
8
|
|
9
9
|
class IRCPublisherTest < Test::Unit::TestCase
|
10
10
|
def test_publisher
|
11
|
-
options = Cerberus::Config.new(nil, :publisher => {:irc => {:channel => '
|
11
|
+
options = Cerberus::Config.new(nil, :publisher => {:irc => {:channel => 'cerberus-testing', :server => 'irc.freenode.net'}}, :application_name => 'IrcApp')
|
12
12
|
build = DummyManager.new('last message', 'this is output', 1232, 'anatol')
|
13
13
|
|
14
14
|
Cerberus::Publisher::IRC.publish(build_status(true), build, options)
|
15
15
|
|
16
|
-
assert IRCConnection.connected
|
17
|
-
assert IRCConnection.messages.first.include?('JOIN')
|
18
|
-
assert_equal 7, IRCConnection.messages.size
|
16
|
+
# assert IRCConnection.connected
|
17
|
+
# assert IRCConnection.messages.first.include?('JOIN')
|
18
|
+
# assert_equal 7, IRCConnection.messages.size
|
19
19
|
end
|
20
20
|
end
|
data/test/mock/manager.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 7
|
9
|
+
version: 0.7.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Craig P Jolicoeur
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-25 00:00:00 -04:00
|
18
18
|
default_executable: cerberus
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -22,13 +22,12 @@ dependencies:
|
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
|
-
-
|
29
|
-
-
|
30
|
-
|
31
|
-
version: 1.3.3
|
28
|
+
- 2
|
29
|
+
- 0
|
30
|
+
version: "2.0"
|
32
31
|
type: :runtime
|
33
32
|
version_requirements: *id001
|
34
33
|
- !ruby/object:Gem::Dependency
|
@@ -36,13 +35,12 @@ dependencies:
|
|
36
35
|
prerelease: false
|
37
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
|
-
- -
|
38
|
+
- - ~>
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
segments:
|
42
|
-
- 1
|
43
|
-
- 4
|
44
41
|
- 2
|
45
|
-
|
42
|
+
- 0
|
43
|
+
version: "2.0"
|
46
44
|
type: :runtime
|
47
45
|
version_requirements: *id002
|
48
46
|
- !ruby/object:Gem::Dependency
|
@@ -102,14 +100,54 @@ files:
|
|
102
100
|
- lib/cerberus/scm/perforce.rb
|
103
101
|
- lib/cerberus/scm/svn.rb
|
104
102
|
- lib/cerberus/utils.rb
|
105
|
-
- lib/vendor/
|
106
|
-
- lib/vendor/
|
107
|
-
- lib/vendor/
|
108
|
-
- lib/vendor/
|
109
|
-
- lib/vendor/
|
110
|
-
- lib/vendor/
|
111
|
-
- lib/vendor/
|
112
|
-
- lib/vendor/
|
103
|
+
- lib/vendor/addressable/addressable.gemspec
|
104
|
+
- lib/vendor/addressable/CHANGELOG
|
105
|
+
- lib/vendor/addressable/lib/addressable/idna.rb
|
106
|
+
- lib/vendor/addressable/lib/addressable/template.rb
|
107
|
+
- lib/vendor/addressable/lib/addressable/uri.rb
|
108
|
+
- lib/vendor/addressable/lib/addressable/version.rb
|
109
|
+
- lib/vendor/addressable/LICENSE
|
110
|
+
- lib/vendor/addressable/Rakefile
|
111
|
+
- lib/vendor/addressable/README
|
112
|
+
- lib/vendor/addressable/spec/addressable/idna_spec.rb
|
113
|
+
- lib/vendor/addressable/spec/addressable/template_spec.rb
|
114
|
+
- lib/vendor/addressable/spec/addressable/uri_spec.rb
|
115
|
+
- lib/vendor/addressable/spec/data/rfc3986.txt
|
116
|
+
- lib/vendor/addressable/tasks/clobber.rake
|
117
|
+
- lib/vendor/addressable/tasks/gem.rake
|
118
|
+
- lib/vendor/addressable/tasks/git.rake
|
119
|
+
- lib/vendor/addressable/tasks/metrics.rake
|
120
|
+
- lib/vendor/addressable/tasks/rdoc.rake
|
121
|
+
- lib/vendor/addressable/tasks/rubyforge.rake
|
122
|
+
- lib/vendor/addressable/tasks/spec.rake
|
123
|
+
- lib/vendor/addressable/website/index.html
|
124
|
+
- lib/vendor/shout-bot/lib/shout-bot.rb
|
125
|
+
- lib/vendor/shout-bot/shout-bot.gemspec
|
126
|
+
- lib/vendor/shout-bot/TODO
|
127
|
+
- lib/vendor/tinder/CHANGELOG.txt
|
128
|
+
- lib/vendor/tinder/init.rb
|
129
|
+
- lib/vendor/tinder/lib/tinder/campfire.rb
|
130
|
+
- lib/vendor/tinder/lib/tinder/connection.rb
|
131
|
+
- lib/vendor/tinder/lib/tinder/multipart.rb
|
132
|
+
- lib/vendor/tinder/lib/tinder/room.rb
|
133
|
+
- lib/vendor/tinder/lib/tinder.rb
|
134
|
+
- lib/vendor/tinder/Manifest.txt
|
135
|
+
- lib/vendor/tinder/Rakefile
|
136
|
+
- lib/vendor/tinder/README.txt
|
137
|
+
- lib/vendor/tinder/site/index.html
|
138
|
+
- lib/vendor/tinder/site/stylesheets/style.css
|
139
|
+
- lib/vendor/tinder/spec/fixtures/rooms/room80749.json
|
140
|
+
- lib/vendor/tinder/spec/fixtures/rooms/room80751.json
|
141
|
+
- lib/vendor/tinder/spec/fixtures/rooms/show.json
|
142
|
+
- lib/vendor/tinder/spec/fixtures/rooms.json
|
143
|
+
- lib/vendor/tinder/spec/fixtures/users/me.json
|
144
|
+
- lib/vendor/tinder/spec/spec.opts
|
145
|
+
- lib/vendor/tinder/spec/spec_helper.rb
|
146
|
+
- lib/vendor/tinder/spec/tinder/campfire_spec.rb
|
147
|
+
- lib/vendor/tinder/spec/tinder/connection_spec.rb
|
148
|
+
- lib/vendor/tinder/spec/tinder/room_spec.rb
|
149
|
+
- lib/vendor/tinder/tinder.gemspec
|
150
|
+
- lib/vendor/tinder/VERSION
|
113
151
|
- lib/vendor/twitter/CHANGES
|
114
152
|
- lib/vendor/twitter/lib/twitter/client/account.rb
|
115
153
|
- lib/vendor/twitter/lib/twitter/client/auth.rb
|
data/lib/vendor/irc/README
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
= Ruby-IRC
|
2
|
-
|
3
|
-
Framework for IRC clients
|
4
|
-
|
5
|
-
== What is it?
|
6
|
-
|
7
|
-
Ruby-IRC is a simple framework for creating clients for IRC. It will
|
8
|
-
monitor multiple IO sockets for data. Allows user defined handlers
|
9
|
-
for IRC events.
|
10
|
-
|
11
|
-
== A simple usage example
|
12
|
-
|
13
|
-
bot = IRC.new("Nickname", "server.example.com", "6667", "Realname")
|
14
|
-
IRCEvent.add_callback('endofmotd') { |event| bot.add_channel('#eris') }
|
15
|
-
IRCEvent.add_callback('join') { |event|
|
16
|
-
bot.send_message(event.channel, "Hello #{event.from}")
|
17
|
-
}
|
18
|
-
bot.connect
|
19
|
-
|
20
|
-
== Author
|
21
|
-
Chris Boyer
|
22
|
-
|
23
|
-
email: cboyer@musiciansfriend.com
|
data/lib/vendor/irc/lib/IRC.rb
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'socket'
|
3
|
-
require 'IRCConnection'
|
4
|
-
require 'IRCEvent'
|
5
|
-
require 'IRCChannel'
|
6
|
-
require 'IRCUser'
|
7
|
-
require 'IRCUtil'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# Class IRC is a master class that handles connection to the irc
|
12
|
-
# server and pasring of IRC events, through the IRCEvent class.
|
13
|
-
class IRC
|
14
|
-
@channels = nil
|
15
|
-
# Create a new IRC Object instance
|
16
|
-
def initialize( nick, server, port, realname='RBot', options = {})
|
17
|
-
@nick = nick
|
18
|
-
@server = server
|
19
|
-
@port = port
|
20
|
-
@realname = realname
|
21
|
-
@channels = Array.new(0)
|
22
|
-
# Some good default Event handlers. These can and will be overridden by users.
|
23
|
-
# Thses make changes on the IRCbot object. So they need to be here.
|
24
|
-
|
25
|
-
# Topic events can come on two tags, so we create one proc to handle them.
|
26
|
-
topic_proc = Proc.new { |event|
|
27
|
-
self.channels.each { |chan|
|
28
|
-
if chan == event.channel
|
29
|
-
chan.topic = event.message
|
30
|
-
end
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
IRCEvent.add_handler('332', topic_proc)
|
35
|
-
IRCEvent.add_handler('topic', topic_proc)
|
36
|
-
@@options = options;
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
attr_reader :nick, :server, :port
|
41
|
-
|
42
|
-
# Join a channel, adding it to the list of joined channels
|
43
|
-
def add_channel channel
|
44
|
-
join(channel)
|
45
|
-
self
|
46
|
-
end
|
47
|
-
|
48
|
-
# Returns a list of channels joined
|
49
|
-
def channels
|
50
|
-
@channels
|
51
|
-
end
|
52
|
-
|
53
|
-
# Alias for IRC.connect
|
54
|
-
def start
|
55
|
-
self.connect
|
56
|
-
end
|
57
|
-
|
58
|
-
# Open a connection to the server using the IRC Connect
|
59
|
-
# method. Events yielded from the IRCConnection handler are
|
60
|
-
# processed and then control is returned to IRCConnection
|
61
|
-
def connect
|
62
|
-
quithandler = lambda { send_quit(); IRCConnection.quit }
|
63
|
-
trap("INT", quithandler)
|
64
|
-
trap("TERM", quithandler)
|
65
|
-
|
66
|
-
IRCConnection.handle_connection(@server, @port, @nick, @realname, @@options) do
|
67
|
-
# Log in information moved to IRCConnection
|
68
|
-
@threads = []
|
69
|
-
IRCConnection.main do |event|
|
70
|
-
if event.kind_of?(Array)
|
71
|
-
event.each {|event|
|
72
|
-
thread_event(event)
|
73
|
-
}
|
74
|
-
else
|
75
|
-
thread_event(event)
|
76
|
-
end
|
77
|
-
# Memory leak patch thanks to Patrick Sinclair
|
78
|
-
@threads.delete_if {|thr| thr.stop? }
|
79
|
-
end
|
80
|
-
@threads.each {|thr| thr.join }
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Joins a channel on a server.
|
85
|
-
def join(channel)
|
86
|
-
if (IRCConnection.send_to_server("JOIN #{channel}"))
|
87
|
-
@channels.push(IRCChannel.new(channel));
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
# Leaves a channel on a server
|
92
|
-
def part(channel)
|
93
|
-
if (IRCConnection.send_to_server("PART #{channel}"))
|
94
|
-
@channels.delete_if {|chan| chan.name == channel }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# kicks a user from a channel (does not check for operator privledge)
|
99
|
-
def kick(channel, user, message)
|
100
|
-
IRCConnection.send_to_server("KICK #{channel} #{user} :#{message || user || 'kicked'}")
|
101
|
-
end
|
102
|
-
|
103
|
-
# sets the topic of the given channel
|
104
|
-
def set_topic(channel, topic)
|
105
|
-
IRCConnection.send_to_server("TOPIC #{channel} :#{topic}");
|
106
|
-
end
|
107
|
-
|
108
|
-
# Sends a private message, or channel message
|
109
|
-
def send_message(to, message)
|
110
|
-
IRCConnection.send_to_server("privmsg #{to} :#{message}");
|
111
|
-
end
|
112
|
-
|
113
|
-
# Sends a notice
|
114
|
-
def send_notice(to, message)
|
115
|
-
IRCConnection.send_to_server("NOTICE #{to} :#{message}");
|
116
|
-
end
|
117
|
-
|
118
|
-
# performs an action
|
119
|
-
def send_action(to, action)
|
120
|
-
send_ctcp(to, 'ACTION', action);
|
121
|
-
end
|
122
|
-
|
123
|
-
# send CTCP
|
124
|
-
def send_ctcp(to, type, message)
|
125
|
-
IRCConnection.send_to_server("privmsg #{to} :\001#{type} #{message}");
|
126
|
-
end
|
127
|
-
|
128
|
-
# Quits the IRC Server
|
129
|
-
def send_quit
|
130
|
-
IRCConnection.send_to_server("QUIT : Quit ordered by user")
|
131
|
-
end
|
132
|
-
|
133
|
-
# Ops selected user.
|
134
|
-
def op(channel, user)
|
135
|
-
IRCConnection.send_to_server("MODE #{channel} +o #{user}")
|
136
|
-
end
|
137
|
-
|
138
|
-
# Changes the current nickname
|
139
|
-
def ch_nick(nick)
|
140
|
-
IRCConnection.send_to_server("NICK #{nick}")
|
141
|
-
@nick = nick
|
142
|
-
end
|
143
|
-
|
144
|
-
# Removes operator status from a user
|
145
|
-
def deop(channel, user)
|
146
|
-
IRCConnection.send_to_server("MODE #{channel} -o #{user}")
|
147
|
-
end
|
148
|
-
|
149
|
-
# Changes target users mode
|
150
|
-
def mode(channel, user, mode)
|
151
|
-
IRCConnection.send_to_server("MODE #{channel} #{mode} #{user}")
|
152
|
-
end
|
153
|
-
|
154
|
-
# Retrievs user information from the server
|
155
|
-
def get_user_info(user)
|
156
|
-
IRCConnection.send_to_server("WHO #{user}")
|
157
|
-
end
|
158
|
-
private
|
159
|
-
def thread_event (event)
|
160
|
-
@threads << Thread.new(event) {|localevent|
|
161
|
-
localevent.process
|
162
|
-
}
|
163
|
-
end
|
164
|
-
end
|