zmb 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/zmb +4 -6
- data/lib/zmb.rb +48 -36
- data/lib/zmb/settings.rb +8 -2
- data/lib/zmb/timer.rb +7 -2
- data/plugins/announce.rb +101 -0
- data/plugins/autorejoin.rb +15 -0
- data/plugins/bank.rb +9 -7
- data/plugins/commands.rb +97 -32
- data/plugins/dns.rb +51 -0
- data/plugins/idle.rb +2 -7
- data/plugins/irc.rb +53 -26
- data/plugins/log.rb +25 -0
- data/plugins/nickserv.rb +8 -6
- data/plugins/poll.rb +10 -11
- data/plugins/quote.rb +20 -16
- data/plugins/relay.rb +12 -8
- data/plugins/security.rb +117 -0
- data/plugins/system.rb +3 -7
- data/plugins/url.rb +110 -0
- data/plugins/usermodes.rb +90 -0
- data/plugins/users.rb +64 -31
- data/zmb.gemspec +9 -3
- metadata +9 -3
- data/lib/zmb/commands.rb +0 -63
data/lib/zmb/commands.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
class Command
|
2
|
-
attr_accessor :delegate, :signal, :help
|
3
|
-
|
4
|
-
def initialize(delegate, signal, commands=1, help=nil)
|
5
|
-
@delegate = delegate
|
6
|
-
@signal = signal
|
7
|
-
@help = help
|
8
|
-
@commands = commands
|
9
|
-
end
|
10
|
-
|
11
|
-
def help?
|
12
|
-
help != nil
|
13
|
-
end
|
14
|
-
|
15
|
-
def run(e, args)
|
16
|
-
if @commands == 0 then
|
17
|
-
args = Array.new
|
18
|
-
elsif args.size > @commands
|
19
|
-
a = args.first @commands-1 # Take one under amount of commands
|
20
|
-
a << args[@commands-1..-1].join(' ')
|
21
|
-
args = a
|
22
|
-
end
|
23
|
-
|
24
|
-
begin
|
25
|
-
@delegate.send(@signal, e, *args)
|
26
|
-
rescue ArgumentError
|
27
|
-
'incorrect arguments'
|
28
|
-
rescue Exception
|
29
|
-
if e.respond_to?('user') and e.user.respond_to?('admin?') and e.user.admin? and e.private? then
|
30
|
-
"#{$!.message}\n#{$!.inspect}\n#{$!.backtrace[0..2].join("\n")}"
|
31
|
-
else
|
32
|
-
"command failed"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class PermCommand < Command
|
39
|
-
attr_accessor :perm
|
40
|
-
|
41
|
-
def initialize(perm, *args)
|
42
|
-
super(*args)
|
43
|
-
@perm = perm
|
44
|
-
end
|
45
|
-
|
46
|
-
def run(e, args)
|
47
|
-
if e.respond_to?('user') and e.user.permission?(@perm) then
|
48
|
-
super(e, args)
|
49
|
-
else
|
50
|
-
'permission denied'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class AuthCommand < Command
|
56
|
-
def run(e, args)
|
57
|
-
if e.respond_to?('user') and e.user.authenticated? then
|
58
|
-
super(e, args)
|
59
|
-
else
|
60
|
-
'permission denied'
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|