net-yail 1.2.1 → 1.2.3
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/net/yail.rb +29 -17
- metadata +2 -4
- data/CHANGELOG +0 -47
data/lib/net/yail.rb
CHANGED
@@ -36,6 +36,12 @@ module Net
|
|
36
36
|
# ==Incoming Events
|
37
37
|
#
|
38
38
|
# Current list of incoming events and the parameters sent to the handler:
|
39
|
+
# * :incoming_any(event) - "global" handler that catches all events and may
|
40
|
+
# modify their data as necessary before the real handler is hit. This
|
41
|
+
# only be used in cases where it's necessary to grab a lot of events that
|
42
|
+
# also need to be processed elsewhere, such as doing input filtering for
|
43
|
+
# all events that have a "text" element. Note that returning true from
|
44
|
+
# this handler will still break the entire chain of event handling.
|
39
45
|
# * :incoming_msg(fullactor, actor, target, text) - Normal message from actor to target
|
40
46
|
# * :incoming_act(fullactor, actor, target, text) - CTCP "action" (emote) from actor to target
|
41
47
|
# * :incoming_invite(fullactor, actor, target, text) - INVITE to target channel from actor
|
@@ -230,7 +236,8 @@ class YAIL
|
|
230
236
|
)
|
231
237
|
attr_accessor(
|
232
238
|
:silent,
|
233
|
-
:loud
|
239
|
+
:loud,
|
240
|
+
:throttle_seconds
|
234
241
|
)
|
235
242
|
|
236
243
|
# Makes a new instance, obviously.
|
@@ -451,35 +458,40 @@ class YAIL
|
|
451
458
|
|
452
459
|
# Gets some input, sends stuff off to a handler. Yay.
|
453
460
|
def process_input(line)
|
461
|
+
# Allow global handler to break the chain, filter the line, whatever
|
462
|
+
return if handle :incoming_any, line
|
463
|
+
|
454
464
|
case line
|
455
|
-
|
465
|
+
# Numerics must be handled first! Otherwise a numeric message that's
|
466
|
+
# formatted just right will accidentally match another handler.
|
467
|
+
when /^:((.+?)(?:!.+?)?) (\d{3})\s+(\S+?) (.+?)$/
|
468
|
+
handle_numeric($3.to_i, $1, $2, $4, $5)
|
469
|
+
when /^PING :?(.+?)$/
|
470
|
+
handle :incoming_ping, $1
|
471
|
+
when /^:((.+?)(?:!.+?)?) INVITE \S+ :(\S+)/
|
456
472
|
handle :incoming_invite, $1, $2, $3
|
457
|
-
when /^:((.+?)(?:!.+?)?) PRIVMSG (\S+) :?\001ACTION (.+?)\001$/
|
473
|
+
when /^:((.+?)(?:!.+?)?) PRIVMSG (\S+) :?\001ACTION (.+?)\001$/
|
458
474
|
handle :incoming_act, $1, $2, $3, $4
|
459
|
-
when /^:((.+?)(?:!.+?)?) PRIVMSG (\S+?) :?\001(.+?)\001$/
|
475
|
+
when /^:((.+?)(?:!.+?)?) PRIVMSG (\S+?) :?\001(.+?)\001$/
|
460
476
|
handle :incoming_ctcp, $1, $2, $3, $4
|
461
|
-
when /^:((.+?)(?:!.+?)?) PRIVMSG (\S+?) :?(.+?)$/
|
477
|
+
when /^:((.+?)(?:!.+?)?) PRIVMSG (\S+?) :?(.+?)$/
|
462
478
|
handle :incoming_msg, $1, $2, $3, $4
|
463
|
-
when /^:((.+?)(?:!.+?)?) NOTICE (\S+?) :?\001(.+?)\001$/
|
479
|
+
when /^:((.+?)(?:!.+?)?) NOTICE (\S+?) :?\001(.+?)\001$/
|
464
480
|
handle :incoming_ctcpreply, $1, $2, $3, $4
|
465
|
-
when /^:((.+?)(?:!.+?)?) NOTICE (\S+?) :?(.+?)$/
|
481
|
+
when /^:((.+?)(?:!.+?)?) NOTICE (\S+?) :?(.+?)$/
|
466
482
|
handle :incoming_notice, $1, $2, $3, $4
|
467
|
-
when /^:((.+?)(?:!.+?)?) MODE (\S+?) :?(\S+?)(?: (.+?))?$/
|
483
|
+
when /^:((.+?)(?:!.+?)?) MODE (\S+?) :?(\S+?)(?: (.+?))?$/
|
468
484
|
handle :incoming_mode, $1, $2, $3, $4, $5
|
469
|
-
when /^:((.+?)(?:!.+?)?) JOIN :?(\S+?)$/
|
485
|
+
when /^:((.+?)(?:!.+?)?) JOIN :?(\S+?)$/
|
470
486
|
handle :incoming_join, $1, $2, $3
|
471
|
-
when /^:((.+?)(?:!.+?)?) PART (\S+?)(?: :?(\S+?)?)?$/
|
487
|
+
when /^:((.+?)(?:!.+?)?) PART (\S+?)(?: :?(\S+?)?)?$/
|
472
488
|
handle :incoming_part, $1, $2, $3, $4
|
473
|
-
when /^:((.+?)(?:!.+?)?) KICK (\S+?) (\S+?) :?(.+?)$/
|
489
|
+
when /^:((.+?)(?:!.+?)?) KICK (\S+?) (\S+?) :?(.+?)$/
|
474
490
|
handle :incoming_kick, $1, $2, $3, $4, $5
|
475
|
-
when /^:((.+?)(?:!.+?)?) QUIT :?(.+?)$/
|
491
|
+
when /^:((.+?)(?:!.+?)?) QUIT :?(.+?)$/
|
476
492
|
handle :incoming_quit, $1, $2, $3
|
477
|
-
when /^:((.+?)(?:!.+?)?) NICK :?(\S+?)$/
|
493
|
+
when /^:((.+?)(?:!.+?)?) NICK :?(\S+?)$/
|
478
494
|
handle :incoming_nick, $1, $2, $3
|
479
|
-
when /^PING :?(.+?)$/i
|
480
|
-
handle :incoming_ping, $1
|
481
|
-
when /^:((.+?)(?:!.+?)?) (\d{3})\s+(\S+?) (.+?)$/i
|
482
|
-
handle_numeric($3.to_i, $1, $2, $4, $5)
|
483
495
|
else
|
484
496
|
handle :incoming_miscellany, line
|
485
497
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-yail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Echols
|
@@ -9,7 +9,7 @@ autorequire: net/yail
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-04-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -21,13 +21,11 @@ extensions: []
|
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README
|
24
|
-
- CHANGELOG
|
25
24
|
files:
|
26
25
|
- examples/logger/default.yml
|
27
26
|
- examples/logger/logger_bot.rb
|
28
27
|
- examples/logger/run.rb
|
29
28
|
- lib/net/yail.rb
|
30
|
-
- CHANGELOG
|
31
29
|
- lib/net/yail/output_api.rb
|
32
30
|
- lib/net/yail/default_events.rb
|
33
31
|
- lib/net/yail/magic_events.rb
|
data/CHANGELOG
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
2008-07-01:
|
2
|
-
* Fixed IRCBot to be part of the net/yail namespace so you can subclass
|
3
|
-
without copying the file into your own project
|
4
|
-
* Fixed IRCBot to actually be usable (fixed require)
|
5
|
-
|
6
|
-
2008-07-02:
|
7
|
-
* Minor documentation fixes
|
8
|
-
* Args aren't automatically duped for all handlers anymore, as that caused
|
9
|
-
output handling to break (args come in, go to handler, get duped, get
|
10
|
-
filtered, handler chain ends, required YAIL output methods finish with the
|
11
|
-
original, unfiltered args)
|
12
|
-
* All output APIs now dup the args at the top level to deal with above issue
|
13
|
-
* Added more details to Rakefile - homepage and rubyforge project
|
14
|
-
* Bumped to version 1.0.2 - will release gem only after a little testing,
|
15
|
-
though
|
16
|
-
|
17
|
-
2008-07-03:
|
18
|
-
* IRCBot can now auto-join multiple channels, and has a built-in uptime
|
19
|
-
system.
|
20
|
-
* Net::YAIL now has handling for INVITE messages
|
21
|
-
* Added fully working logger bot for a solid example
|
22
|
-
* Since changes are more extensive than a minor release, bumping to 1.1.1
|
23
|
-
|
24
|
-
2008-07-07:
|
25
|
-
* The included logger example bot no longer crashes on incoming "private"
|
26
|
-
message
|
27
|
-
* Logger example also has an example of using an outgoing handler to
|
28
|
-
centralize a list of channel passwords - all join messages get a password
|
29
|
-
tacked on if the central password list has one for the given channel
|
30
|
-
* Obviously the above addition required support for joining password-protected
|
31
|
-
channels, so YAY!
|
32
|
-
|
33
|
-
2008-07-17:
|
34
|
-
* Fixed logger's handler to not call the channel logging code on private message
|
35
|
-
* Figured it's about time for a new gem, 1.2.0. Change to join handler breaks
|
36
|
-
existing code in a minor way - don't forget to fix your handlers!
|
37
|
-
|
38
|
-
2008-07-22:
|
39
|
-
* Added a bunch of new output APIs and corresponding outgoing handlers
|
40
|
-
* Auto-support for server password with new arg to constructor
|
41
|
-
* Moved TODO stuff into a separate file outside the gem's evil influence!
|
42
|
-
|
43
|
-
2008-07-??:
|
44
|
-
* Fixed up a bunch of code to add a bit more stability for dead sockets and
|
45
|
-
such.
|
46
|
-
* IRCBot can now properly reconnect when the socket does end up dying.
|
47
|
-
* Bumped version to 1.2.1. Probably a good time to release another gem.
|