Ruby-IRC 1.0.3 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,18 +1,23 @@
1
- # = Ruby-IRC
2
- # Framework for IRC clients
3
- # == What is it?
4
- # Ruby-IRC is a simple framework for creating clients for IRC. It will
5
- # monitor multiple IO sockets for data. Allows user defined handlers
6
- # for IRC events.
7
- #
8
- # == A simple usage example
9
- #
10
- # bot = IRC.new("Nickname", "server.example.com", "6667", [ "#arrayofchannels"])
11
- # IRCEvent.add_callback('endofmotd') { |event| bot.add_channel('#eris') }
12
- # IRCEvent.add_callback('join') {|event|
13
- # bot.send_message(event.channel, "Hello #{event.from}")
14
- # }
15
- # bot.connect
16
- # == Author
17
- # Chris Boyer
18
- # email: cboyer@musiciansfriend.com
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/#IRCEvent.rb# ADDED
@@ -0,0 +1,89 @@
1
+ require 'yaml'
2
+
3
+ # This is a lookup class for IRC event name mapping
4
+ class EventLookup
5
+ @@lookup = YAML.load_file("#{File.dirname(__FILE__)}/eventmap.yml")
6
+
7
+ # returns the event name, given a number
8
+ def EventLookup::find_by_number(num)
9
+ return @@lookup[num.to_i]
10
+ end
11
+ end
12
+
13
+
14
+ # Handles an IRC generated event.
15
+ # Handlers are for the IRC framework to use
16
+ # Callbacks are for users to add.
17
+ # Both handlers and callbacks can be called for the same event.
18
+ class IRCEvent
19
+ @@handlers = { 'ping' => lambda {|event| IRCConnection.send_to_server("PONG #{event.message}") } }
20
+ @@callbacks = Hash.new()
21
+ attr_reader :hostmask, :message, :event_type, :from, :channel, :target, :mode, :stats
22
+ def initialize (line)
23
+ line.sub!(/^:/, '')
24
+ mess_parts = line.split(':', 2);
25
+ # mess_parts[0] is server info
26
+ # mess_parts[1] is the message that was sent
27
+ @message = mess_parts[1]
28
+ @stats = mess_parts[0].scan(/[-\w.\#\@]+/)
29
+ puts "Event: #{line}"
30
+ if @stats[0].match(/^PING/)
31
+ @event_type = 'ping'
32
+ elsif @stats[1] && @stats[1].match(/^\d+/)
33
+ @event_type = EventLookup::find_by_number(@stats[1]);
34
+ @channel = @stats[3]
35
+ else
36
+ @event_type = @stats[2].downcase if @stats[2]
37
+ end
38
+
39
+ if @event_type != 'ping'
40
+ @from = @stats[0]
41
+ @user = IRCUser.create_user(@from)
42
+ end
43
+ @hostmask = @stats[1] if %W(privmsg join).include? @event_type
44
+ @channel = @stats[3] if @stats[3] && !@channel
45
+ @target = @stats[5] if @stats[5]
46
+ @mode = @stats[4] if @stats[4]
47
+
48
+
49
+
50
+ # Unfortunatly, not all messages are created equal. This is our
51
+ # special exceptions section
52
+ if @event_type == 'join'
53
+ @channel = @message
54
+ end
55
+
56
+ end
57
+
58
+ # Adds a callback for the specified irc message.
59
+ def IRCEvent.add_callback(message_id, &callback)
60
+ @@callbacks[message_id] = callback
61
+ end
62
+
63
+ # Adds a handler to the handler function hash.
64
+ def IRCEvent.add_handler(message_id, proc=nil, &handler)
65
+ if block_given?
66
+ @@handlers[message_id] = handler
67
+ elsif proc
68
+ @@handlers[message_id] = proc
69
+ end
70
+ end
71
+
72
+ # Process this event, preforming which ever handler and callback is specified
73
+ # for this event.
74
+ def process
75
+ handled = nil
76
+ if @@handlers[@event_type]
77
+ @@handlers[@event_type].call(self)
78
+ handled = 1
79
+ end
80
+ if @@callbacks[@event_type]
81
+ @@callbacks[@event_type].call(self)
82
+ handled = 1
83
+ end
84
+ if !handled
85
+ puts "No handler for event type #@event_type in #{self.class}"
86
+ end
87
+ end
88
+ end
89
+
data/lib/IRC.rb CHANGED
@@ -4,12 +4,12 @@ require 'IRCConnection'
4
4
  require 'IRCEvent'
5
5
  require 'IRCChannel'
6
6
  require 'IRCUser'
7
+ require 'IRCUtil'
7
8
 
8
9
 
9
10
 
10
11
  # Class IRC is a master class that handles connection to the irc
11
12
  # server and pasring of IRC events, through the IRCEvent class.
12
-
13
13
  class IRC
14
14
  @channels = nil
15
15
  # Create a new IRC Object instance
@@ -39,81 +39,97 @@ class IRC
39
39
 
40
40
 
41
41
  end
42
+
42
43
  attr_reader :nick, :server, :port
44
+
43
45
  # Join a channel, adding it to the list of joined channels
44
46
  def add_channel channel
45
47
  join(channel)
46
48
  self
47
49
  end
50
+
48
51
  # Returns a list of channels joined
49
52
  def channels
50
53
  @channels
51
54
  end
55
+
52
56
  # Alias for IRC.connect
53
57
  def start
54
58
  self.connect
55
59
  end
60
+
56
61
  # Open a connection to the server using the IRC Connect
57
62
  # method. Events yielded from the IRCConnection handler are
58
63
  # processed and then control is returned to IRCConnection
59
64
  def connect
60
- IRCConnection.handle_connection(@server, @port) do
61
- IRCConnection.send_to_server "NICK #{@nick}"
62
- IRCConnection.send_to_server "USER #{@nick} 8 * :#{@realname}"
65
+ IRCConnection.handle_connection(@server, @port, @nick, @realname) do
66
+ # Log in information moved to IRCConnection
63
67
  IRCConnection.main do |event|
64
68
  event.process
65
69
  end
66
70
  end
67
71
  end
72
+
68
73
  # Joins a channel on a server.
69
74
  def join(channel)
70
75
  if (IRCConnection.send_to_server("JOIN #{channel}"))
71
76
  @channels.push(IRCChannel.new(channel));
72
77
  end
73
78
  end
79
+
74
80
  # Leaves a channel on a server
75
81
  def part(channel)
76
82
  if (IRCConnection.send_to_server("PART #{channel}"))
77
83
  @channels.delete_if {|chan| chan.name == channel }
78
84
  end
79
85
  end
86
+
80
87
  # Sends a private message, or channel message
81
88
  def send_message(to, message)
82
- IRCConnection.send_to_server("privmsg #{to} : #{message}");
89
+ IRCConnection.send_to_server("privmsg #{to} :#{message}");
83
90
  end
91
+
84
92
  # Sends a notice
85
93
  def send_notice(to, message)
86
- IRCConnection.send_to_server("NOTICE #{to} : #{message}");
94
+ IRCConnection.send_to_server("NOTICE #{to} :#{message}");
87
95
  end
88
- # Lights, camera, action
96
+
97
+ # performs an action
89
98
  def send_action(to, action)
90
99
  send_ctcp(to, 'ACTION', action);
91
100
  end
92
- # And now, to send CTCP
101
+
102
+ # send CTCP
93
103
  def send_ctcp(to, type, message)
94
104
  IRCConnection.send_to_server("privmsg #{to} :\001#{type} #{message}");
95
105
  end
106
+
96
107
  # Quits the IRC Server
97
108
  def send_quit
98
109
  IRCConnection.send_to_server("QUIT : Quit ordered by user")
99
110
  end
111
+
100
112
  # Ops selected user.
101
113
  def op(channel, user)
102
114
  IRCConnection.send_to_server("MODE #{channel} +o #{user}")
103
115
  end
116
+
104
117
  # Changes the current nickname
105
118
  def ch_nick(nick)
106
119
  IRCConnection.send_to_server("NICK #{nick}")
107
120
  @nick = nick
108
121
  end
122
+
109
123
  # Removes operator status from a user
110
124
  def deop(channel, user)
111
125
  IRCConnection.send_to_server("MODE #{channel} -o #{user}")
112
126
  end
127
+
113
128
  # Changes target users mode
114
129
  def mode(channel, user, mode)
115
130
  IRCConnection.send_to_server("MODE #{channel} #{mode} #{user}")
116
131
  end
132
+
117
133
  # Retrievs user information from the server
118
134
  def get_user_info(user)
119
135
  IRCConnection.send_to_server("WHO #{user}")
data/lib/IRC.rb.~1.4.~ ADDED
@@ -0,0 +1,138 @@
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')
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 on proc to handle them.
26
+
27
+ topic_proc = Proc.new { |event|
28
+ self.channels.each { |chan|
29
+ puts "Examine channel #{chan.name} for #{event.channel}"
30
+ if chan == event.channel
31
+ puts "Setting topic: #{event.message}"
32
+ chan.topic = event.message
33
+ end
34
+ }
35
+ }
36
+
37
+ IRCEvent.add_handler('332', topic_proc)
38
+ IRCEvent.add_handler('topic', topic_proc)
39
+
40
+
41
+ end
42
+
43
+ attr_reader :nick, :server, :port
44
+
45
+ # Join a channel, adding it to the list of joined channels
46
+ def add_channel channel
47
+ join(channel)
48
+ self
49
+ end
50
+
51
+ # Returns a list of channels joined
52
+ def channels
53
+ @channels
54
+ end
55
+
56
+ # Alias for IRC.connect
57
+ def start
58
+ self.connect
59
+ end
60
+
61
+ # Open a connection to the server using the IRC Connect
62
+ # method. Events yielded from the IRCConnection handler are
63
+ # processed and then control is returned to IRCConnection
64
+ def connect
65
+ IRCConnection.handle_connection(@server, @port) do
66
+ IRCConnection.send_to_server "NICK #{@nick}"
67
+ IRCConnection.send_to_server "USER #{@nick} 8 * :#{@realname}"
68
+ IRCConnection.main do |event|
69
+ event.process
70
+ end
71
+ end
72
+ end
73
+
74
+ # Joins a channel on a server.
75
+ def join(channel)
76
+ if (IRCConnection.send_to_server("JOIN #{channel}"))
77
+ @channels.push(IRCChannel.new(channel));
78
+ end
79
+ end
80
+
81
+ # Leaves a channel on a server
82
+ def part(channel)
83
+ if (IRCConnection.send_to_server("PART #{channel}"))
84
+ @channels.delete_if {|chan| chan.name == channel }
85
+ end
86
+ end
87
+
88
+ # Sends a private message, or channel message
89
+ def send_message(to, message)
90
+ IRCConnection.send_to_server("privmsg #{to} :#{message}");
91
+ end
92
+
93
+ # Sends a notice
94
+ def send_notice(to, message)
95
+ IRCConnection.send_to_server("NOTICE #{to} :#{message}");
96
+ end
97
+
98
+ # performs an action
99
+ def send_action(to, action)
100
+ send_ctcp(to, 'ACTION', action);
101
+ end
102
+
103
+ # send CTCP
104
+ def send_ctcp(to, type, message)
105
+ IRCConnection.send_to_server("privmsg #{to} :\001#{type} #{message}");
106
+ end
107
+
108
+ # Quits the IRC Server
109
+ def send_quit
110
+ IRCConnection.send_to_server("QUIT : Quit ordered by user")
111
+ end
112
+
113
+ # Ops selected user.
114
+ def op(channel, user)
115
+ IRCConnection.send_to_server("MODE #{channel} +o #{user}")
116
+ end
117
+
118
+ # Changes the current nickname
119
+ def ch_nick(nick)
120
+ IRCConnection.send_to_server("NICK #{nick}")
121
+ @nick = nick
122
+ end
123
+
124
+ # Removes operator status from a user
125
+ def deop(channel, user)
126
+ IRCConnection.send_to_server("MODE #{channel} -o #{user}")
127
+ end
128
+
129
+ # Changes target users mode
130
+ def mode(channel, user, mode)
131
+ IRCConnection.send_to_server("MODE #{channel} #{mode} #{user}")
132
+ end
133
+
134
+ # Retrievs user information from the server
135
+ def get_user_info(user)
136
+ IRCConnection.send_to_server("WHO #{user}")
137
+ end
138
+ end
data/lib/IRCChannel.rb CHANGED
@@ -1,23 +1,32 @@
1
1
  require "IRCUser"
2
2
 
3
+ # Represents an IRC Channel
3
4
  class IRCChannel
4
5
  def initialize(name)
5
6
  @name = name
6
7
  @users = Array.new(0)
7
8
  end
8
9
  attr_reader :name
10
+
11
+ # set the topic on this channel
9
12
  def topic=(topic)
10
13
  @topic = topic
11
14
  end
15
+
16
+ # get the topic on this channel
12
17
  def topic
13
18
  if @topic
14
19
  return @topic
15
20
  end
16
21
  return "No Topic set"
17
22
  end
23
+
24
+ # add a user to this channel's userlist
18
25
  def add_user(username)
19
26
  @users.push(IRCUser.create_user(username))
20
27
  end
28
+
29
+ # returns the current user list for this channel
21
30
  def users
22
31
  @users
23
32
  end
data/lib/IRCConnection.rb CHANGED
@@ -5,18 +5,32 @@ class IRCConnection
5
5
  @@readsockets = Array.new(0)
6
6
  @@events = Hash.new()
7
7
  # Creates a socket connection and then yields.
8
- def IRCConnection.handle_connection(server, port)
9
- @@server = server
10
- @@port = port
8
+ def IRCConnection.handle_connection(server, port, nick='ChangeMe', realname='MeToo' )
9
+ socket = create_tcp_socket(server, port)
10
+ add_IO_socket(socket) {|sock| IRCEvent.new(sock.readline.chomp) }
11
+ send_to_server "NICK #{nick}"
12
+ send_to_server "USER #{nick} 8 * :#{realname}"
13
+ if block_given?
14
+ yield
15
+ @@socket.close
16
+ end
17
+ end
18
+
19
+ def IRCConnection.create_tcp_socket(server, port)
11
20
  @@socket = TCPsocket.open(server, port)
12
- add_IO_socket(@@socket) {|sock| IRCEvent.new(sock.readline.chomp) }
13
- yield
14
- @@socket.close
21
+ if block_given?
22
+ yield
23
+ @@socket.close
24
+ return
25
+ end
26
+ return @@socket
15
27
  end
28
+
16
29
  # Sends a line of text to the server
17
30
  def IRCConnection.send_to_server(line)
18
31
  @@socket.write(line + "\n")
19
32
  end
33
+
20
34
  # This loop monitors all IO_Sockets IRCConnection controls
21
35
  # (including the IRC socket) and yields events to the IO_Sockets
22
36
  # event handler.
@@ -27,6 +41,7 @@ class IRCConnection
27
41
  }
28
42
  end
29
43
  end
44
+
30
45
  # Makes one single loop pass, checking all sockets for data to read,
31
46
  # and yields the data to the sockets event handler.
32
47
  def IRCConnection.do_one_loop
@@ -35,16 +50,19 @@ class IRCConnection
35
50
  yield @@events[sock.to_i].call(sock)
36
51
  }
37
52
  end
53
+
38
54
  # Ends connection to the irc server
39
55
  def IRCConnection.quit
40
56
  @@quit = 1
41
57
  end
58
+
42
59
  # Retrieves user info from the server
43
60
  def IRCConnection.get_user_info(user)
44
61
  IRCConnection.send_to_server("WHOIS #{user}")
45
62
  end
63
+
64
+ # Adds a new socket to the list of sockets to monitor for new data.
46
65
  def IRCConnection.add_IO_socket(socket, &event_generator)
47
- # Adds a new socket to the list of sockets to monitor for new data.
48
66
  @@readsockets.push(socket)
49
67
  @@events[socket.to_i] = event_generator
50
68
  end
@@ -0,0 +1,59 @@
1
+
2
+ # Handles connection to IRC Server
3
+ class IRCConnection
4
+ @@quit = 0
5
+ @@readsockets = Array.new(0)
6
+ @@events = Hash.new()
7
+ # Creates a socket connection and then yields.
8
+ def IRCConnection.handle_connection(server, port)
9
+ @@server = server
10
+ @@port = port
11
+ @@socket = TCPsocket.open(server, port)
12
+ add_IO_socket(@@socket) {|sock| IRCEvent.new(sock.readline.chomp) }
13
+ yield
14
+ @@socket.close
15
+ end
16
+
17
+ # Sends a line of text to the server
18
+ def IRCConnection.send_to_server(line)
19
+ @@socket.write(line + "\n")
20
+ end
21
+
22
+ # This loop monitors all IO_Sockets IRCConnection controls
23
+ # (including the IRC socket) and yields events to the IO_Sockets
24
+ # event handler.
25
+ def IRCConnection.main
26
+ while(@@quit == 0)
27
+ do_one_loop { |event|
28
+ yield event
29
+ }
30
+ end
31
+ end
32
+
33
+ # Makes one single loop pass, checking all sockets for data to read,
34
+ # and yields the data to the sockets event handler.
35
+ def IRCConnection.do_one_loop
36
+ read_sockets = select(@@readsockets, nil, nil, nil);
37
+ read_sockets[0].each {|sock|
38
+ yield @@events[sock.to_i].call(sock)
39
+ }
40
+ end
41
+
42
+ # Ends connection to the irc server
43
+ def IRCConnection.quit
44
+ @@quit = 1
45
+ end
46
+
47
+ # Retrieves user info from the server
48
+ def IRCConnection.get_user_info(user)
49
+ IRCConnection.send_to_server("WHOIS #{user}")
50
+ end
51
+
52
+ # Adds a new socket to the list of sockets to monitor for new data.
53
+ def IRCConnection.add_IO_socket(socket, &event_generator)
54
+ @@readsockets.push(socket)
55
+ @@events[socket.to_i] = event_generator
56
+ end
57
+ end
58
+
59
+
data/lib/IRCEvent.rb CHANGED
@@ -1,286 +1,32 @@
1
+ require 'yaml'
1
2
 
2
3
  # This is a lookup class for IRC event name mapping
3
4
  class EventLookup
4
- @@lookup = Hash[
5
- # suck! these aren't treated as strings --
6
- # 001 ne 1 for the purpose of hash keying, apparently.
7
- '001' => "welcome",
8
- '002' => "yourhost",
9
- '003' => "created",
10
- '004' => "myinfo",
11
- '005' => "map", # Undernet Extension, Kajetan@Hinner.com, 17/11/98
12
- '006' => "mapmore", # Undernet Extension, Kajetan@Hinner.com, 17/11/98
13
- '007' => "mapend", # Undernet Extension, Kajetan@Hinner.com, 17/11/98
14
-
15
- '008' => "snomask", # Undernet Extension, Kajetan@Hinner.com, 17/11/98
16
-
17
- '009' => "statmemtot", # Undernet Extension, Kajetan@Hinner.com, 17/11/98
18
-
19
- '010' => "statmem", # Undernet Extension, Kajetan@Hinner.com, 17/11/98
20
-
21
-
22
- '200' => "tracelink",
23
- '201' => "traceconnecting",
24
- '202' => "tracehandshake",
25
- '203' => "traceunknown",
26
- '204' => "traceoperator",
27
- '205' => "traceuser",
28
- '206' => "traceserver",
29
- '208' => "tracenewtype",
30
- '209' => "traceclass",
31
- '211' => "statslinkinfo",
32
- '212' => "statscommands",
33
- '213' => "statscline",
34
- '214' => "statsnline",
35
- '215' => "statsiline",
36
- '216' => "statskline",
37
- '217' => "statsqline",
38
- '218' => "statsyline",
39
- '219' => "endofstats",
40
- '220' => "statsbline", # UnrealIrcd, Hendrik Frenzel
41
- '221' => "umodeis",
42
- '222' => "sqline_nick", # UnrealIrcd, Hendrik Frenzel
43
- '223' => "statsgline", # UnrealIrcd, Hendrik Frenzel
44
- '224' => "statstline", # UnrealIrcd, Hendrik Frenzel
45
- '225' => "statseline", # UnrealIrcd, Hendrik Frenzel
46
- '226' => "statsnline", # UnrealIrcd, Hendrik Frenzel
47
- '227' => "statsvline", # UnrealIrcd, Hendrik Frenzel
48
- '231' => "serviceinfo",
49
- '232' => "endofservices",
50
- '233' => "service",
51
- '234' => "servlist",
52
- '235' => "servlistend",
53
- '241' => "statslline",
54
- '242' => "statsuptime",
55
- '243' => "statsoline",
56
- '244' => "statshline",
57
- '245' => "statssline", # Reserved, Kajetan@Hinner.com, 17/10/98
58
- '246' => "statstline", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
59
- '247' => "statsgline", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
60
- ### TODO: need numerics to be able to map to multiple strings
61
- ### 247' => "statsxline", # UnrealIrcd, Hendrik Frenzel
62
- '248' => "statsuline", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
63
- '249' => "statsdebug", # Unspecific Extension, Kajetan@Hinner.com, 17/10/98
64
- '250' => "luserconns", # 1998-03-15 -- tkil
65
- '251' => "luserclient",
66
- '252' => "luserop",
67
- '253' => "luserunknown",
68
- '254' => "luserchannels",
69
- '255' => "luserme",
70
- '256' => "adminme",
71
- '257' => "adminloc1",
72
- '258' => "adminloc2",
73
- '259' => "adminemail",
74
- '261' => "tracelog",
75
- '262' => "endoftrace", # 1997-11-24 -- archon
76
- '265' => "n_local", # 1997-10-16 -- tkil
77
- '266' => "n_global", # 1997-10-16 -- tkil
78
- '271' => "silelist", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
79
- '272' => "endofsilelist", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
80
- '275' => "statsdline", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
81
- '280' => "glist", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
82
- '281' => "endofglist", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
83
- '290' => "helphdr", # UnrealIrcd, Hendrik Frenzel
84
- '291' => "helpop", # UnrealIrcd, Hendrik Frenzel
85
- '292' => "helptlr", # UnrealIrcd, Hendrik Frenzel
86
- '293' => "helphlp", # UnrealIrcd, Hendrik Frenzel
87
- '294' => "helpfwd", # UnrealIrcd, Hendrik Frenzel
88
- '295' => "helpign", # UnrealIrcd, Hendrik Frenzel
89
-
90
- '300' => "none",
91
- '301' => "away",
92
- '302' => "userhost",
93
- '303' => "ison",
94
- '304' => "rpl_text", # Bahamut IRCD
95
- '305' => "unaway",
96
- '306' => "nowaway",
97
- '307' => "userip", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
98
- '308' => "rulesstart", # UnrealIrcd, Hendrik Frenzel
99
- '309' => "endofrules", # UnrealIrcd, Hendrik Frenzel
100
- '310' => "whoishelp", # (July01-01)Austnet Extension, found by Andypoo <andypoo@secret.com.au>
101
- '311' => "whoisuser",
102
- '312' => "whoisserver",
103
- '313' => "whoisoperator",
104
- '314' => "whowasuser",
105
- '315' => "endofwho",
106
- '316' => "whoischanop",
107
- '317' => "whoisidle",
108
- '318' => "endofwhois",
109
- '319' => "whoischannels",
110
- '320' => "whoisvworld", # (July01-01)Austnet Extension, found by Andypoo <andypoo@secret.com.au>
111
- '321' => "liststart",
112
- '322' => "list",
113
- '323' => "listend",
114
- '324' => "channelmodeis",
115
- '329' => "channelcreate", # 1997-11-24 -- archon
116
- '331' => "notopic",
117
- '332' => "topic",
118
- '333' => "topicinfo", # 1997-11-24 -- archon
119
- '334' => "listusage", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
120
- '335' => "whoisbot", # UnrealIrcd, Hendrik Frenzel
121
- '341' => "inviting",
122
- '342' => "summoning",
123
- '346' => "invitelist", # UnrealIrcd, Hendrik Frenzel
124
- '347' => "endofinvitelist", # UnrealIrcd, Hendrik Frenzel
125
- '348' => "exlist", # UnrealIrcd, Hendrik Frenzel
126
- '349' => "endofexlist", # UnrealIrcd, Hendrik Frenzel
127
- '351' => "version",
128
- '352' => "whoreply",
129
- '353' => "namreply",
130
- '354' => "whospcrpl", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
131
- '361' => "killdone",
132
- '362' => "closing",
133
- '363' => "closeend",
134
- '364' => "links",
135
- '365' => "endoflinks",
136
- '366' => "endofnames",
137
- '367' => "banlist",
138
- '368' => "endofbanlist",
139
- '369' => "endofwhowas",
140
- '371' => "info",
141
- '372' => "motd",
142
- '373' => "infostart",
143
- '374' => "endofinfo",
144
- '375' => "motdstart",
145
- '376' => "endofmotd",
146
- '377' => "motd2", # 1997-10-16 -- tkil
147
- '378' => "austmotd", # (July01-01)Austnet Extension, found by Andypoo <andypoo@secret.com.au>
148
- '379' => "whoismodes", # UnrealIrcd, Hendrik Frenzel
149
- '381' => "youreoper",
150
- '382' => "rehashing",
151
- '383' => "youreservice", # UnrealIrcd, Hendrik Frenzel
152
- '384' => "myportis",
153
- '385' => "notoperanymore", # Unspecific Extension, Kajetan@Hinner.com, 17/10/98
154
- '386' => "qlist", # UnrealIrcd, Hendrik Frenzel
155
- '387' => "endofqlist", # UnrealIrcd, Hendrik Frenzel
156
- '388' => "alist", # UnrealIrcd, Hendrik Frenzel
157
- '389' => "endofalist", # UnrealIrcd, Hendrik Frenzel
158
- '391' => "time",
159
- '392' => "usersstart",
160
- '393' => "users",
161
- '394' => "endofusers",
162
- '395' => "nousers",
163
-
164
- '401' => "nosuchnick",
165
- '402' => "nosuchserver",
166
- '403' => "nosuchchannel",
167
- '404' => "cannotsendtochan",
168
- '405' => "toomanychannels",
169
- '406' => "wasnosuchnick",
170
- '407' => "toomanytargets",
171
- '408' => "nosuchservice", # UnrealIrcd, Hendrik Frenzel
172
- '409' => "noorigin",
173
- '411' => "norecipient",
174
- '412' => "notexttosend",
175
- '413' => "notoplevel",
176
- '414' => "wildtoplevel",
177
- '416' => "querytoolong", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
178
- '421' => "unknowncommand",
179
- '422' => "nomotd",
180
- '423' => "noadmininfo",
181
- '424' => "fileerror",
182
- '425' => "noopermotd", # UnrealIrcd, Hendrik Frenzel
183
- '431' => "nonicknamegiven",
184
- '432' => "erroneusnickname", # This iz how its speld in thee RFC.
185
- '433' => "nicknameinuse",
186
- '434' => "norules", # UnrealIrcd, Hendrik Frenzel
187
- '435' => "serviceconfused", # UnrealIrcd, Hendrik Frenzel
188
- '436' => "nickcollision",
189
- '437' => "bannickchange", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
190
- '438' => "nicktoofast", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
191
- '439' => "targettoofast", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
192
- '440' => "servicesdown", # Bahamut IRCD
193
- '441' => "usernotinchannel",
194
- '442' => "notonchannel",
195
- '443' => "useronchannel",
196
- '444' => "nologin",
197
- '445' => "summondisabled",
198
- '446' => "usersdisabled",
199
- '447' => "nonickchange", # UnrealIrcd, Hendrik Frenzel
200
- '451' => "notregistered",
201
- '455' => "hostilename", # UnrealIrcd, Hendrik Frenzel
202
- '459' => "nohiding", # UnrealIrcd, Hendrik Frenzel
203
- '460' => "notforhalfops", # UnrealIrcd, Hendrik Frenzel
204
- '461' => "needmoreparams",
205
- '462' => "alreadyregistered",
206
- '463' => "nopermforhost",
207
- '464' => "passwdmismatch",
208
- '465' => "yourebannedcreep", # I love this one...
209
- '466' => "youwillbebanned",
210
- '467' => "keyset",
211
- '468' => "invalidusername", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
212
- '469' => "linkset", # UnrealIrcd, Hendrik Frenzel
213
- '470' => "linkchannel", # UnrealIrcd, Hendrik Frenzel
214
- '471' => "channelisfull",
215
- '472' => "unknownmode",
216
- '473' => "inviteonlychan",
217
- '474' => "bannedfromchan",
218
- '475' => "badchannelkey",
219
- '476' => "badchanmask",
220
- '477' => "needreggednick", # Bahamut IRCD
221
- '478' => "banlistfull", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
222
- '479' => "secureonlychannel", # pircd
223
- ### TODO: see above todo
224
- ### 479' => "linkfail", # UnrealIrcd, Hendrik Frenzel
225
- '480' => "cannotknock", # UnrealIrcd, Hendrik Frenzel
226
- '481' => "noprivileges",
227
- '482' => "chanoprivsneeded",
228
- '483' => "cantkillserver",
229
- '484' => "ischanservice", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
230
- '485' => "killdeny", # UnrealIrcd, Hendrik Frenzel
231
- '486' => "htmdisabled", # UnrealIrcd, Hendrik Frenzel
232
- '489' => "secureonlychan", # UnrealIrcd, Hendrik Frenzel
233
- '491' => "nooperhost",
234
- '492' => "noservicehost",
235
-
236
- '501' => "umodeunknownflag",
237
- '502' => "usersdontmatch",
238
- '511' => "silelistfull", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
239
- '513' => "nosuchgline", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
240
- '513' => "badping", # Undernet Extension, Kajetan@Hinner.com, 17/10/98
241
- '518' => "noinvite", # UnrealIrcd, Hendrik Frenzel
242
- '519' => "admonly", # UnrealIrcd, Hendrik Frenzel
243
- '520' => "operonly", # UnrealIrcd, Hendrik Frenzel
244
- '521' => "listsyntax", # UnrealIrcd, Hendrik Frenzel
245
- '524' => "operspverify", # UnrealIrcd, Hendrik Frenzel
246
-
247
- '600' => "rpl_logon", # Bahamut IRCD
248
- '601' => "rpl_logoff", # Bahamut IRCD
249
- '602' => "rpl_watchoff", # UnrealIrcd, Hendrik Frenzel
250
- '603' => "rpl_watchstat", # UnrealIrcd, Hendrik Frenzel
251
- '604' => "rpl_nowon", # Bahamut IRCD
252
- '605' => "rpl_nowoff", # Bahamut IRCD
253
- '606' => "rpl_watchlist", # UnrealIrcd, Hendrik Frenzel
254
- '607' => "rpl_endofwatchlist", # UnrealIrcd, Hendrik Frenzel
255
- '610' => "mapmore", # UnrealIrcd, Hendrik Frenzel
256
- '640' => "rpl_dumping", # UnrealIrcd, Hendrik Frenzel
257
- '641' => "rpl_dumprpl", # UnrealIrcd, Hendrik Frenzel
258
- '642' => "rpl_eodump", # UnrealIrcd, Hendrik Frenzel
259
-
260
- '999' => "numericerror", # Bahamut IRCD
261
- ];
5
+ @@lookup = YAML.load_file("#{File.dirname(__FILE__)}/eventmap.yml")
6
+
7
+ # returns the event name, given a number
262
8
  def EventLookup::find_by_number(num)
263
- return @@lookup[num]
9
+ return @@lookup[num.to_i]
264
10
  end
265
11
  end
266
12
 
267
13
 
268
- # Handles an IRC generated event.
269
- # Handlers are for the IRC framework to use
270
- # Callbacks are for users to add.
271
- # Both handlers and callbacks can be called for the same event.
14
+ # Handles an IRC generated event.
15
+ # Handlers are for the IRC framework to use
16
+ # Callbacks are for users to add.
17
+ # Both handlers and callbacks can be called for the same event.
272
18
  class IRCEvent
273
19
  @@handlers = { 'ping' => lambda {|event| IRCConnection.send_to_server("PONG #{event.message}") } }
274
20
  @@callbacks = Hash.new()
275
- attr_reader :message, :event_type, :from, :channel, :target, :mode, :stats
21
+ attr_reader :hostmask, :message, :event_type, :from, :channel, :target, :mode, :stats
276
22
  def initialize (line)
277
23
  line.sub!(/^:/, '')
278
24
  mess_parts = line.split(':', 2);
279
25
  # mess_parts[0] is server info
280
26
  # mess_parts[1] is the message that was sent
281
27
  @message = mess_parts[1]
282
- @stats = mess_parts[0].scan(/[-\w.\#\@]+/)
283
-
28
+ @stats = mess_parts[0].scan(/[-\w.\#\@\+]+/)
29
+
284
30
  if @stats[0].match(/^PING/)
285
31
  @event_type = 'ping'
286
32
  elsif @stats[1] && @stats[1].match(/^\d+/)
@@ -294,7 +40,7 @@ class IRCEvent
294
40
  @from = @stats[0]
295
41
  @user = IRCUser.create_user(@from)
296
42
  end
297
- @hostmask = @stats[1] if @event_type.eql?('PRIVMSG'.downcase)
43
+ @hostmask = @stats[1] if %W(privmsg join).include? @event_type
298
44
  @channel = @stats[3] if @stats[3] && !@channel
299
45
  @target = @stats[5] if @stats[5]
300
46
  @mode = @stats[4] if @stats[4]
@@ -307,11 +53,13 @@ class IRCEvent
307
53
  @channel = @message
308
54
  end
309
55
 
310
- end
56
+ end
57
+
311
58
  # Adds a callback for the specified irc message.
312
59
  def IRCEvent.add_callback(message_id, &callback)
313
60
  @@callbacks[message_id] = callback
314
61
  end
62
+
315
63
  # Adds a handler to the handler function hash.
316
64
  def IRCEvent.add_handler(message_id, proc=nil, &handler)
317
65
  if block_given?
@@ -320,6 +68,7 @@ class IRCEvent
320
68
  @@handlers[message_id] = proc
321
69
  end
322
70
  end
71
+
323
72
  # Process this event, preforming which ever handler and callback is specified
324
73
  # for this event.
325
74
  def process
@@ -0,0 +1,89 @@
1
+ require 'yaml'
2
+
3
+ # This is a lookup class for IRC event name mapping
4
+ class EventLookup
5
+ @@lookup = YAML.load_file("#{File.dirname(__FILE__)}/eventmap.yml")
6
+
7
+ # returns the event name, given a number
8
+ def EventLookup::find_by_number(num)
9
+ return @@lookup[num.to_i]
10
+ end
11
+ end
12
+
13
+
14
+ # Handles an IRC generated event.
15
+ # Handlers are for the IRC framework to use
16
+ # Callbacks are for users to add.
17
+ # Both handlers and callbacks can be called for the same event.
18
+ class IRCEvent
19
+ @@handlers = { 'ping' => lambda {|event| IRCConnection.send_to_server("PONG #{event.message}") } }
20
+ @@callbacks = Hash.new()
21
+ attr_reader :hostmask, :message, :event_type, :from, :channel, :target, :mode, :stats
22
+ def initialize (line)
23
+ line.sub!(/^:/, '')
24
+ mess_parts = line.split(':', 2);
25
+ # mess_parts[0] is server info
26
+ # mess_parts[1] is the message that was sent
27
+ @message = mess_parts[1]
28
+ @stats = mess_parts[0].scan(/[-\w.\#\@]+/)
29
+ puts "Event: #{line}"
30
+ if @stats[0].match(/^PING/)
31
+ @event_type = 'ping'
32
+ elsif @stats[1] && @stats[1].match(/^\d+/)
33
+ @event_type = EventLookup::find_by_number(@stats[1]);
34
+ @channel = @stats[3]
35
+ else
36
+ @event_type = @stats[2].downcase if @stats[2]
37
+ end
38
+
39
+ if @event_type != 'ping'
40
+ @from = @stats[0]
41
+ @user = IRCUser.create_user(@from)
42
+ end
43
+ @hostmask = @stats[1] if %W(privmsg join).include? @event_type
44
+ @channel = @stats[3] if @stats[3] && !@channel
45
+ @target = @stats[5] if @stats[5]
46
+ @mode = @stats[4] if @stats[4]
47
+
48
+
49
+
50
+ # Unfortunatly, not all messages are created equal. This is our
51
+ # special exceptions section
52
+ if @event_type == 'join'
53
+ @channel = @message
54
+ end
55
+
56
+ end
57
+
58
+ # Adds a callback for the specified irc message.
59
+ def IRCEvent.add_callback(message_id, &callback)
60
+ @@callbacks[message_id] = callback
61
+ end
62
+
63
+ # Adds a handler to the handler function hash.
64
+ def IRCEvent.add_handler(message_id, proc=nil, &handler)
65
+ if block_given?
66
+ @@handlers[message_id] = handler
67
+ elsif proc
68
+ @@handlers[message_id] = proc
69
+ end
70
+ end
71
+
72
+ # Process this event, preforming which ever handler and callback is specified
73
+ # for this event.
74
+ def process
75
+ handled = nil
76
+ if @@handlers[@event_type]
77
+ @@handlers[@event_type].call(self)
78
+ handled = 1
79
+ end
80
+ if @@callbacks[@event_type]
81
+ @@callbacks[@event_type].call(self)
82
+ handled = 1
83
+ end
84
+ if !handled
85
+ puts "No handler for event type #@event_type in #{self.class}"
86
+ end
87
+ end
88
+ end
89
+
data/lib/IRCUser.rb CHANGED
@@ -1,7 +1,8 @@
1
-
1
+ # Represents IRC Users
2
2
  class IRCUser
3
3
  @@users = Hash.new()
4
4
  @modes = Hash.new()
5
+
5
6
  def IRCUser.create_user(username)
6
7
  username.sub!(/^[\@\%]/,'')
7
8
 
@@ -11,8 +12,10 @@ class IRCUser
11
12
  @@users[username] = self.new(username)
12
13
  @@users[username]
13
14
  end
15
+
14
16
  attr_reader :username, :mask
15
17
  attr_writer :mask
18
+
16
19
  private
17
20
  def initialize (username)
18
21
  @username = username
data/lib/IRCUtil.rb ADDED
@@ -0,0 +1,49 @@
1
+ #
2
+ # IRCUtil is a module that contains utility functions for use with the
3
+ # rest of Ruby-IRC. There is nothing required of the user to know or
4
+ # even use these functions, but they are useful for certain tasks
5
+ # regarding IRC connections.
6
+ #
7
+
8
+ module IRCUtil
9
+ #
10
+ # Matches hostmasks against hosts. Returns t/f on success/fail.
11
+ #
12
+ # A hostmask consists of a simple wildcard that describes a
13
+ # host or class of hosts.
14
+ #
15
+ # f.e., where the host is 'bar.example.com', a host mask
16
+ # of '*.example.com' would assert.
17
+ #
18
+
19
+ def assert_hostmask(host, hostmask)
20
+ return !!host.match(quote_regexp_for_mask(hostmask))
21
+ end
22
+
23
+ module_function :assert_hostmask
24
+
25
+ #
26
+ # A utility function used by assert_hostmask() to turn hostmasks
27
+ # into regular expressions.
28
+ #
29
+ # Rarely, if ever, should be used by outside code. It's public
30
+ # exposure is merely for those who are interested in it's
31
+ # functionality.
32
+ #
33
+
34
+ def quote_regexp_for_mask(hostmask)
35
+ # Big thanks to Jesse Williamson for his consultation while writing this.
36
+ #
37
+ # escape all other regexp specials except for . and *.
38
+ # properly escape . and place an unescaped . before *.
39
+ # confine the regexp to scan the whole line.
40
+ # return the edited hostmask as a string.
41
+ hostmask.gsub(/([\[\]\(\)\?\^\$])\\/, '\\1').
42
+ gsub(/\./, '\.').
43
+ gsub(/\*/, '.*').
44
+ sub(/^/, '^').
45
+ sub(/$/, '$')
46
+ end
47
+
48
+ module_function :quote_regexp_for_mask
49
+ end
data/lib/eventmap.yml ADDED
@@ -0,0 +1,247 @@
1
+ # 001 ne 1 for the purpose of hash keying apparently.
2
+ 001 : welcome
3
+ 002 : yourhost
4
+ 003 : created
5
+ 004 : myinfo
6
+ 005 : map # Undernet Extension, Kajetan@Hinner.com, 17/11/98
7
+ 006 : mapmore # Undernet Extension, Kajetan@Hinner.com, 17/11/98
8
+ 007 : mapend # Undernet Extension, Kajetan@Hinner.com, 17/11/98
9
+ 008 : snomask # Undernet Extension, Kajetan@Hinner.com, 17/11/98
10
+ 009 : statmemtot # Undernet Extension, Kajetan@Hinner.com, 17/11/98
11
+ 010 : statmem # Undernet Extension, Kajetan@Hinner.com, 17/11/98
12
+ 200 : tracelink
13
+ 201 : traceconnecting
14
+ 202 : tracehandshake
15
+ 203 : traceunknown
16
+ 204 : traceoperator
17
+ 205 : traceuser
18
+ 206 : traceserver
19
+ 208 : tracenewtype
20
+ 209 : traceclass
21
+ 211 : statslinkinfo
22
+ 212 : statscommands
23
+ 213 : statscline
24
+ 214 : statsnline
25
+ 215 : statsiline
26
+ 216 : statskline
27
+ 217 : statsqline
28
+ 218 : statsyline
29
+ 219 : endofstats
30
+ 220 : statsbline # UnrealIrcd, Hendrik Frenzel
31
+ 221 : umodeis
32
+ 222 : sqline_nick # UnrealIrcd, Hendrik Frenzel
33
+ 223 : statsgline # UnrealIrcd, Hendrik Frenzel
34
+ 224 : statstline # UnrealIrcd, Hendrik Frenzel
35
+ 225 : statseline # UnrealIrcd, Hendrik Frenzel
36
+ 226 : statsnline # UnrealIrcd, Hendrik Frenzel
37
+ 227 : statsvline # UnrealIrcd, Hendrik Frenzel
38
+ 231 : serviceinfo
39
+ 232 : endofservices
40
+ 233 : service
41
+ 234 : servlist
42
+ 235 : servlistend
43
+ 241 : statslline
44
+ 242 : statsuptime
45
+ 243 : statsoline
46
+ 244 : statshline
47
+ 245 : statssline # Reserved, Kajetan@Hinner.com, 17/10/98
48
+ 246 : statstline # Undernet Extension, Kajetan@Hinner.com, 17/10/98
49
+ 247 : statsgline # Undernet Extension, Kajetan@Hinner.com, 17/10/98
50
+ ### TODO: need numerics to be able to map to multiple strings
51
+ ### 247 : statsxline # UnrealIrcd, Hendrik Frenzel
52
+ 248 : statsuline # Undernet Extension, Kajetan@Hinner.com, 17/10/98
53
+ 249 : statsdebug # Unspecific Extension, Kajetan@Hinner.com, 17/10/98
54
+ 250 : luserconns # 1998-03-15 -- tkil
55
+ 251 : luserclient
56
+ 252 : luserop
57
+ 253 : luserunknown
58
+ 254 : luserchannels
59
+ 255 : luserme
60
+ 256 : adminme
61
+ 257 : adminloc1
62
+ 258 : adminloc2
63
+ 259 : adminemail
64
+ 261 : tracelog
65
+ 262 : endoftrace # 1997-11-24 -- archon
66
+ 265 : n_local # 1997-10-16 -- tkil
67
+ 266 : n_global # 1997-10-16 -- tkil
68
+ 271 : silelist # Undernet Extension, Kajetan@Hinner.com, 17/10/98
69
+ 272 : endofsilelist # Undernet Extension, Kajetan@Hinner.com, 17/10/98
70
+ 275 : statsdline # Undernet Extension, Kajetan@Hinner.com, 17/10/98
71
+ 280 : glist # Undernet Extension, Kajetan@Hinner.com, 17/10/98
72
+ 281 : endofglist # Undernet Extension, Kajetan@Hinner.com, 17/10/98
73
+ 290 : helphdr # UnrealIrcd, Hendrik Frenzel
74
+ 291 : helpop # UnrealIrcd, Hendrik Frenzel
75
+ 292 : helptlr # UnrealIrcd, Hendrik Frenzel
76
+ 293 : helphlp # UnrealIrcd, Hendrik Frenzel
77
+ 294 : helpfwd # UnrealIrcd, Hendrik Frenzel
78
+ 295 : helpign # UnrealIrcd, Hendrik Frenzel
79
+ 300 : none
80
+ 301 : away
81
+ 302 : userhost
82
+ 303 : ison
83
+ 304 : rpl_text # Bahamut IRCD
84
+ 305 : unaway
85
+ 306 : nowaway
86
+ 307 : userip # Undernet Extension, Kajetan@Hinner.com, 17/10/98
87
+ 308 : rulesstart # UnrealIrcd, Hendrik Frenzel
88
+ 309 : endofrules # UnrealIrcd, Hendrik Frenzel
89
+ 310 : whoishelp # (July01-01)Austnet Extension, found by Andypoo <andypoo@secret.com.au>
90
+ 311 : whoisuser
91
+ 312 : whoisserver
92
+ 313 : whoisoperator
93
+ 314 : whowasuser
94
+ 315 : endofwho
95
+ 316 : whoischanop
96
+ 317 : whoisidle
97
+ 318 : endofwhois
98
+ 319 : whoischannels
99
+ 320 : whoisvworld # (July01-01)Austnet Extension, found by Andypoo <andypoo@secret.com.au>
100
+ 321 : liststart
101
+ 322 : list
102
+ 323 : listend
103
+ 324 : channelmodeis
104
+ 329 : channelcreate # 1997-11-24 -- archon
105
+ 331 : notopic
106
+ 332 : topic
107
+ 333 : topicinfo # 1997-11-24 -- archon
108
+ 334 : listusage # Undernet Extension, Kajetan@Hinner.com, 17/10/98
109
+ 335 : whoisbot # UnrealIrcd, Hendrik Frenzel
110
+ 341 : inviting
111
+ 342 : summoning
112
+ 346 : invitelist # UnrealIrcd, Hendrik Frenzel
113
+ 347 : endofinvitelist # UnrealIrcd, Hendrik Frenzel
114
+ 348 : exlist # UnrealIrcd, Hendrik Frenzel
115
+ 349 : endofexlist # UnrealIrcd, Hendrik Frenzel
116
+ 351 : version
117
+ 352 : whoreply
118
+ 353 : namreply
119
+ 354 : whospcrpl # Undernet Extension, Kajetan@Hinner.com, 17/10/98
120
+ 361 : killdone
121
+ 362 : closing
122
+ 363 : closeend
123
+ 364 : links
124
+ 365 : endoflinks
125
+ 366 : endofnames
126
+ 367 : banlist
127
+ 368 : endofbanlist
128
+ 369 : endofwhowas
129
+ 371 : info
130
+ 372 : motd
131
+ 373 : infostart
132
+ 374 : endofinfo
133
+ 375 : motdstart
134
+ 376 : endofmotd
135
+ 377 : motd2 # 1997-10-16 -- tkil
136
+ 378 : austmotd # (July01-01)Austnet Extension, found by Andypoo <andypoo@secret.com.au>
137
+ 379 : whoismodes # UnrealIrcd, Hendrik Frenzel
138
+ 381 : youreoper
139
+ 382 : rehashing
140
+ 383 : youreservice # UnrealIrcd, Hendrik Frenzel
141
+ 384 : myportis
142
+ 385 : notoperanymore # Unspecific Extension, Kajetan@Hinner.com, 17/10/98
143
+ 386 : qlist # UnrealIrcd, Hendrik Frenzel
144
+ 387 : endofqlist # UnrealIrcd, Hendrik Frenzel
145
+ 388 : alist # UnrealIrcd, Hendrik Frenzel
146
+ 389 : endofalist # UnrealIrcd, Hendrik Frenzel
147
+ 391 : time
148
+ 392 : usersstart
149
+ 393 : users
150
+ 394 : endofusers
151
+ 395 : nousers
152
+ 401 : nosuchnick
153
+ 402 : nosuchserver
154
+ 403 : nosuchchannel
155
+ 404 : cannotsendtochan
156
+ 405 : toomanychannels
157
+ 406 : wasnosuchnick
158
+ 407 : toomanytargets
159
+ 408 : nosuchservice # UnrealIrcd, Hendrik Frenzel
160
+ 409 : noorigin
161
+ 411 : norecipient
162
+ 412 : notexttosend
163
+ 413 : notoplevel
164
+ 414 : wildtoplevel
165
+ 416 : querytoolong # Undernet Extension, Kajetan@Hinner.com, 17/10/98
166
+ 421 : unknowncommand
167
+ 422 : nomotd
168
+ 423 : noadmininfo
169
+ 424 : fileerror
170
+ 425 : noopermotd # UnrealIrcd, Hendrik Frenzel
171
+ 431 : nonicknamegiven
172
+ 432 : erroneusnickname # This iz how its speld in thee RFC.
173
+ 433 : nicknameinuse
174
+ 434 : norules # UnrealIrcd, Hendrik Frenzel
175
+ 435 : serviceconfused # UnrealIrcd, Hendrik Frenzel
176
+ 436 : nickcollision
177
+ 437 : bannickchange # Undernet Extension, Kajetan@Hinner.com, 17/10/98
178
+ 438 : nicktoofast # Undernet Extension, Kajetan@Hinner.com, 17/10/98
179
+ 439 : targettoofast # Undernet Extension, Kajetan@Hinner.com, 17/10/98
180
+ 440 : servicesdown # Bahamut IRCD
181
+ 441 : usernotinchannel
182
+ 442 : notonchannel
183
+ 443 : useronchannel
184
+ 444 : nologin
185
+ 445 : summondisabled
186
+ 446 : usersdisabled
187
+ 447 : nonickchange # UnrealIrcd, Hendrik Frenzel
188
+ 451 : notregistered
189
+ 455 : hostilename # UnrealIrcd, Hendrik Frenzel
190
+ 459 : nohiding # UnrealIrcd, Hendrik Frenzel
191
+ 460 : notforhalfops # UnrealIrcd, Hendrik Frenzel
192
+ 461 : needmoreparams
193
+ 462 : alreadyregistered
194
+ 463 : nopermforhost
195
+ 464 : passwdmismatch
196
+ 465 : yourebannedcreep # I love this one...
197
+ 466 : youwillbebanned
198
+ 467 : keyset
199
+ 468 : invalidusername # Undernet Extension, Kajetan@Hinner.com, 17/10/98
200
+ 469 : linkset # UnrealIrcd, Hendrik Frenzel
201
+ 470 : linkchannel # UnrealIrcd, Hendrik Frenzel
202
+ 471 : channelisfull
203
+ 472 : unknownmode
204
+ 473 : inviteonlychan
205
+ 474 : bannedfromchan
206
+ 475 : badchannelkey
207
+ 476 : badchanmask
208
+ 477 : needreggednick # Bahamut IRCD
209
+ 478 : banlistfull # Undernet Extension, Kajetan@Hinner.com, 17/10/98
210
+ 479 : secureonlychannel # pircd
211
+ ### TODO: see above todo
212
+ ### 479 : linkfail # UnrealIrcd, Hendrik Frenzel
213
+ 480 : cannotknock # UnrealIrcd, Hendrik Frenzel
214
+ 481 : noprivileges
215
+ 482 : chanoprivsneeded
216
+ 483 : cantkillserver
217
+ 484 : ischanservice # Undernet Extension, Kajetan@Hinner.com, 17/10/98
218
+ 485 : killdeny # UnrealIrcd, Hendrik Frenzel
219
+ 486 : htmdisabled # UnrealIrcd, Hendrik Frenzel
220
+ 489 : secureonlychan # UnrealIrcd, Hendrik Frenzel
221
+ 491 : nooperhost
222
+ 492 : noservicehost
223
+ 501 : umodeunknownflag
224
+ 502 : usersdontmatch
225
+ 511 : silelistfull # Undernet Extension, Kajetan@Hinner.com, 17/10/98
226
+ 513 : nosuchgline # Undernet Extension, Kajetan@Hinner.com, 17/10/98
227
+ 513 : badping # Undernet Extension, Kajetan@Hinner.com, 17/10/98
228
+ 518 : noinvite # UnrealIrcd, Hendrik Frenzel
229
+ 519 : admonly # UnrealIrcd, Hendrik Frenzel
230
+ 520 : operonly # UnrealIrcd, Hendrik Frenzel
231
+ 521 : listsyntax # UnrealIrcd, Hendrik Frenzel
232
+ 524 : operspverify # UnrealIrcd, Hendrik Frenzel
233
+
234
+ 600 : rpl_logon # Bahamut IRCD
235
+ 601 : rpl_logoff # Bahamut IRCD
236
+ 602 : rpl_watchoff # UnrealIrcd, Hendrik Frenzel
237
+ 603 : rpl_watchstat # UnrealIrcd, Hendrik Frenzel
238
+ 604 : rpl_nowon # Bahamut IRCD
239
+ 605 : rpl_nowoff # Bahamut IRCD
240
+ 606 : rpl_watchlist # UnrealIrcd, Hendrik Frenzel
241
+ 607 : rpl_endofwatchlist # UnrealIrcd, Hendrik Frenzel
242
+ 610 : mapmore # UnrealIrcd, Hendrik Frenzel
243
+ 640 : rpl_dumping # UnrealIrcd, Hendrik Frenzel
244
+ 641 : rpl_dumprpl # UnrealIrcd, Hendrik Frenzel
245
+ 642 : rpl_eodump # UnrealIrcd, Hendrik Frenzel
246
+
247
+ 999 : numericerror # Bahamut IRCD
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: Ruby-IRC
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.3
7
- date: 2006-06-08 00:00:00 -07:00
6
+ version: 1.0.6
7
+ date: 2006-12-08 00:00:00 -08:00
8
8
  summary: An IRC Client library
9
9
  require_paths:
10
10
  - lib
@@ -33,6 +33,12 @@ files:
33
33
  - lib/IRCChannel.rb
34
34
  - lib/IRCConnection.rb
35
35
  - lib/IRCUser.rb
36
+ - lib/IRCUtil.rb
37
+ - lib/eventmap.yml
38
+ - lib/IRCEvent.rb.~1.5.~
39
+ - lib/IRCConnection.rb.~1.2.~
40
+ - lib/#IRCEvent.rb#
41
+ - lib/IRC.rb.~1.4.~
36
42
  - README
37
43
  test_files: []
38
44