ircguerilla-irc 1.1.0
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/lib/irc/client/client_error.rb +35 -0
- data/lib/irc/client/command_handler.rb +113 -0
- data/lib/irc/client/connected_state.rb +95 -0
- data/lib/irc/client/connection.rb +119 -0
- data/lib/irc/client/connection_listener.rb +97 -0
- data/lib/irc/client/connection_state.rb +88 -0
- data/lib/irc/client/context.rb +250 -0
- data/lib/irc/client/disconnected_state.rb +132 -0
- data/lib/irc/client/message_handler.rb +87 -0
- data/lib/irc/client/registered_state.rb +90 -0
- data/lib/irc/client/unregistered_state.rb +113 -0
- data/lib/irc/commands/command.rb +57 -0
- data/lib/irc/commands/invalid_command.rb +35 -0
- data/lib/irc/commands/join_command.rb +122 -0
- data/lib/irc/commands/nick_command.rb +86 -0
- data/lib/irc/commands/part_command.rb +84 -0
- data/lib/irc/commands/password_command.rb +72 -0
- data/lib/irc/commands/ping_command.rb +79 -0
- data/lib/irc/commands/pong_command.rb +68 -0
- data/lib/irc/commands/quit_command.rb +77 -0
- data/lib/irc/commands/user_command.rb +105 -0
- data/lib/irc/messages/codes.rb +186 -0
- data/lib/irc/messages/error_join_message.rb +72 -0
- data/lib/irc/messages/error_message.rb +101 -0
- data/lib/irc/messages/factory.rb +122 -0
- data/lib/irc/messages/invalid_message.rb +35 -0
- data/lib/irc/messages/join_message.rb +130 -0
- data/lib/irc/messages/message.rb +110 -0
- data/lib/irc/messages/nick_message.rb +93 -0
- data/lib/irc/messages/notice_message.rb +87 -0
- data/lib/irc/messages/part_message.rb +95 -0
- data/lib/irc/messages/ping_message.rb +101 -0
- data/lib/irc/messages/pong_message.rb +89 -0
- data/lib/irc/messages/private_message.rb +121 -0
- data/lib/irc/models/bot.rb +159 -0
- data/lib/irc/models/channel.rb +158 -0
- data/lib/irc/models/network.rb +252 -0
- data/lib/irc/models/packet.rb +84 -0
- data/lib/irc/models/server.rb +116 -0
- data/lib/irc/models/user.rb +112 -0
- data/test/functional/irc/client/connection_test.rb +118 -0
- data/test/functional/irc/client/context_test.rb +126 -0
- data/test/test_helper.rb +32 -0
- data/test/unit/irc/client/command_handler_test.rb +137 -0
- data/test/unit/irc/commands/join_command_test.rb +72 -0
- data/test/unit/irc/commands/nick_command_test.rb +35 -0
- data/test/unit/irc/commands/part_command_test.rb +52 -0
- data/test/unit/irc/commands/password_command_test.rb +35 -0
- data/test/unit/irc/commands/ping_command_test.rb +36 -0
- data/test/unit/irc/commands/pong_command_test.rb +36 -0
- data/test/unit/irc/commands/quit_command_test.rb +35 -0
- data/test/unit/irc/commands/user_command_test.rb +35 -0
- data/test/unit/irc/messages/error_join_message_test.rb +45 -0
- data/test/unit/irc/messages/factory_test.rb +62 -0
- data/test/unit/irc/messages/join_message_test.rb +46 -0
- data/test/unit/irc/messages/message_test.rb +56 -0
- data/test/unit/irc/messages/nick_message_test.rb +48 -0
- data/test/unit/irc/messages/notice_message_test.rb +43 -0
- data/test/unit/irc/messages/part_message_test.rb +47 -0
- data/test/unit/irc/messages/ping_message_test.rb +57 -0
- data/test/unit/irc/messages/pong_message_test.rb +57 -0
- data/test/unit/irc/messages/private_message_test.rb +42 -0
- data/test/unit/irc/models/bot_test.rb +85 -0
- data/test/unit/irc/models/channel_test.rb +90 -0
- data/test/unit/irc/models/network_test.rb +210 -0
- data/test/unit/irc/models/packet_test.rb +38 -0
- data/test/unit/irc/models/server_test.rb +54 -0
- data/test/unit/irc/models/user_test.rb +67 -0
- metadata +111 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (c) 2006 Roman Scherer | IRC Guerilla | Rapid Packet Movement
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# $Id: packet_test.rb 85 2006-08-13 11:42:07Z roman $
|
25
|
+
#
|
26
|
+
require 'irc/models/network'
|
27
|
+
require 'test/unit'
|
28
|
+
|
29
|
+
class IRC::Models::PacketTest < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_key
|
32
|
+
network = IRC::Models::Network.new(:name => 'Efnet')
|
33
|
+
bot = network.create_bot('iRCGUERillA')
|
34
|
+
packet = bot.create_packet(1, 'Packet # 1')
|
35
|
+
assert_equal 'efnet|ircguerilla|1', packet.key
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (c) 2006 Roman Scherer | IRC Guerilla | Rapid Packet Movement
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# $Id: server_test.rb 85 2006-08-13 11:42:07Z roman $
|
25
|
+
#
|
26
|
+
require 'irc/models/channel'
|
27
|
+
require 'irc/models/network'
|
28
|
+
require 'irc/models/server'
|
29
|
+
require 'irc/models/user'
|
30
|
+
require 'test/unit'
|
31
|
+
|
32
|
+
class IRC::Models::ServerTest < Test::Unit::TestCase
|
33
|
+
|
34
|
+
def setup
|
35
|
+
@network = IRC::Models::Network.new(:name => 'Efnet')
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_key
|
39
|
+
network = IRC::Models::Network.new(:name => 'Efnet')
|
40
|
+
server = network.create_server('irc.EfNet.pl', 6667)
|
41
|
+
assert_equal 'efnet|irc.efnet.pl|6667', server.key
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_equal
|
45
|
+
|
46
|
+
assert_equal @network.create_server('irc.efnet.pl'), @network.create_server('irc.efnet.pl')
|
47
|
+
|
48
|
+
assert_not_equal @network.create_server('irc.efnet.pl'), @network.create_server('irc.efnet.de')
|
49
|
+
assert_not_equal @network.create_server('irc.efnet.pl', 6668), @network.create_server('irc.efnet.pl', 6669)
|
50
|
+
assert_not_equal IRC::Models::Server.new(:network => IRC::Models::Network.new(:name => 'Undernet'), :hostname => 'irc.efnet.pl'), IRC::Models::Server.new(:network => @network, :hostname => 'irc.efnet.pl')
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (c) 2006 Roman Scherer | IRC Guerilla | Rapid Packet Movement
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
#
|
24
|
+
# $Id: user_test.rb 85 2006-08-13 11:42:07Z roman $
|
25
|
+
#
|
26
|
+
require 'irc/models/channel'
|
27
|
+
require 'irc/models/network'
|
28
|
+
require 'irc/models/server'
|
29
|
+
require 'irc/models/user'
|
30
|
+
require 'test/unit'
|
31
|
+
|
32
|
+
class IRC::Models::UserTest < Test::Unit::TestCase
|
33
|
+
|
34
|
+
def setup
|
35
|
+
@network = IRC::Models::Network.new(:name => 'Efnet')
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_key
|
39
|
+
network = IRC::Models::Network.new(:name => 'Efnet')
|
40
|
+
user = network.create_user('iRCGUERillA')
|
41
|
+
assert_equal 'efnet|ircguerilla', user.key
|
42
|
+
end
|
43
|
+
|
44
|
+
# def test_equal
|
45
|
+
# assert_equal IRC::Models::User.new(@network, 'tom'), IRC::Models::User.new(@network, 'tom')
|
46
|
+
# assert_equal IRC::Models::User.new(@network, 'tom', 'tom1'), IRC::Models::User.new(@network, 'tom', 'tom2')
|
47
|
+
# assert_equal IRC::Models::User.new(@network, 'tom', 'tom1', 'yahoo.com'), IRC::Models::User.new(@network, 'tom', 'tom2', 'google.com')
|
48
|
+
# assert_not_equal IRC::Models::User.new(@network, 'tom'), IRC::Models::User.new(@network, 'jerry')
|
49
|
+
# assert_not_equal IRC::Models::User.new(IRC::Models::Network.new('Undernet'), 'tom'), IRC::Models::User.new(@network, 'tom')
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
def test_add_channel(nick = "ircguerilla", channel_name = "#ircguerilla")
|
53
|
+
channel = @network.create_channel(channel_name)
|
54
|
+
user = @network.create_user(nick)
|
55
|
+
user.add_channel(channel)
|
56
|
+
assert user.channels.include?(channel)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_remove_channel(nick = "ircguerilla", channel_name = "#ircguerilla")
|
60
|
+
test_add_channel(nick, channel_name)
|
61
|
+
user = @network.lookup_user(nick)
|
62
|
+
channel = @network.lookup_channel(channel_name)
|
63
|
+
user.remove_channel(channel)
|
64
|
+
assert !user.channels.include?(channel)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: ircguerilla-irc
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.1.0
|
7
|
+
date: 2006-08-15 00:00:00 +02:00
|
8
|
+
summary: A Ruby framework for the Internet Relay Chat (IRC) protocol.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: roman.scherer@web.de
|
12
|
+
homepage:
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Roman Scherer
|
30
|
+
files:
|
31
|
+
- lib/irc/commands/password_command.rb
|
32
|
+
- lib/irc/commands/join_command.rb
|
33
|
+
- lib/irc/commands/command.rb
|
34
|
+
- lib/irc/commands/invalid_command.rb
|
35
|
+
- lib/irc/commands/quit_command.rb
|
36
|
+
- lib/irc/commands/pong_command.rb
|
37
|
+
- lib/irc/commands/nick_command.rb
|
38
|
+
- lib/irc/commands/part_command.rb
|
39
|
+
- lib/irc/commands/ping_command.rb
|
40
|
+
- lib/irc/commands/user_command.rb
|
41
|
+
- lib/irc/models/server.rb
|
42
|
+
- lib/irc/models/user.rb
|
43
|
+
- lib/irc/models/bot.rb
|
44
|
+
- lib/irc/models/packet.rb
|
45
|
+
- lib/irc/models/channel.rb
|
46
|
+
- lib/irc/models/network.rb
|
47
|
+
- lib/irc/messages/message.rb
|
48
|
+
- lib/irc/messages/codes.rb
|
49
|
+
- lib/irc/messages/private_message.rb
|
50
|
+
- lib/irc/messages/error_message.rb
|
51
|
+
- lib/irc/messages/notice_message.rb
|
52
|
+
- lib/irc/messages/ping_message.rb
|
53
|
+
- lib/irc/messages/join_message.rb
|
54
|
+
- lib/irc/messages/pong_message.rb
|
55
|
+
- lib/irc/messages/factory.rb
|
56
|
+
- lib/irc/messages/invalid_message.rb
|
57
|
+
- lib/irc/messages/nick_message.rb
|
58
|
+
- lib/irc/messages/part_message.rb
|
59
|
+
- lib/irc/messages/error_join_message.rb
|
60
|
+
- lib/irc/client/unregistered_state.rb
|
61
|
+
- lib/irc/client/registered_state.rb
|
62
|
+
- lib/irc/client/connection.rb
|
63
|
+
- lib/irc/client/connection_state.rb
|
64
|
+
- lib/irc/client/disconnected_state.rb
|
65
|
+
- lib/irc/client/message_handler.rb
|
66
|
+
- lib/irc/client/connected_state.rb
|
67
|
+
- lib/irc/client/connection_listener.rb
|
68
|
+
- lib/irc/client/context.rb
|
69
|
+
- lib/irc/client/client_error.rb
|
70
|
+
- lib/irc/client/command_handler.rb
|
71
|
+
test_files:
|
72
|
+
- test/test_helper.rb
|
73
|
+
- test/unit/irc/commands/password_command_test.rb
|
74
|
+
- test/unit/irc/commands/quit_command_test.rb
|
75
|
+
- test/unit/irc/commands/pong_command_test.rb
|
76
|
+
- test/unit/irc/commands/nick_command_test.rb
|
77
|
+
- test/unit/irc/commands/part_command_test.rb
|
78
|
+
- test/unit/irc/commands/ping_command_test.rb
|
79
|
+
- test/unit/irc/commands/user_command_test.rb
|
80
|
+
- test/unit/irc/commands/join_command_test.rb
|
81
|
+
- test/unit/irc/models/server_test.rb
|
82
|
+
- test/unit/irc/models/user_test.rb
|
83
|
+
- test/unit/irc/models/bot_test.rb
|
84
|
+
- test/unit/irc/models/packet_test.rb
|
85
|
+
- test/unit/irc/models/channel_test.rb
|
86
|
+
- test/unit/irc/models/network_test.rb
|
87
|
+
- test/unit/irc/messages/error_join_message_test.rb
|
88
|
+
- test/unit/irc/messages/private_message_test.rb
|
89
|
+
- test/unit/irc/messages/ping_message_test.rb
|
90
|
+
- test/unit/irc/messages/join_message_test.rb
|
91
|
+
- test/unit/irc/messages/message_test.rb
|
92
|
+
- test/unit/irc/messages/notice_message_test.rb
|
93
|
+
- test/unit/irc/messages/factory_test.rb
|
94
|
+
- test/unit/irc/messages/pong_message_test.rb
|
95
|
+
- test/unit/irc/messages/nick_message_test.rb
|
96
|
+
- test/unit/irc/messages/part_message_test.rb
|
97
|
+
- test/unit/irc/client/command_handler_test.rb
|
98
|
+
- test/functional/irc/client/connection_test.rb
|
99
|
+
- test/functional/irc/client/context_test.rb
|
100
|
+
rdoc_options: []
|
101
|
+
|
102
|
+
extra_rdoc_files: []
|
103
|
+
|
104
|
+
executables: []
|
105
|
+
|
106
|
+
extensions: []
|
107
|
+
|
108
|
+
requirements: []
|
109
|
+
|
110
|
+
dependencies: []
|
111
|
+
|