Module: Zabbirc::Irc::PluginMethods
- Extended by:
- ActiveSupport::Concern
- Includes:
- Help
- Included in:
- Plugin
- Defined in:
- lib/zabbirc/irc/plugin_methods.rb
Constant Summary
Constants included
from Help
Help::FEATURES
Instance Method Summary
collapse
Methods included from Help
#help_features, #zabbirc_help, #zabbirc_help_detail
Instance Method Details
#event_command(m, cmd) ⇒ Object
37
38
39
40
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 37
def event_command m, cmd
cmd = EventCommand.new(ops, m, cmd)
cmd.run
end
|
#get_login(obj) ⇒ Object
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 65
def get_login obj
case obj
when Cinch::Message
obj.user.user.sub("~","")
when Cinch::User
obj.user.user.sub("~","")
when String
obj
end
end
|
#get_op(obj) ⇒ Object
Also known as:
authenticate
Authentication and helpers
58
59
60
61
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 58
def get_op obj
login = get_login obj
ops.get login
end
|
#help_command(m, cmd) ⇒ Object
22
23
24
25
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 22
def help_command m, cmd
cmd = HelpCommand.new(ops, m, cmd)
cmd.run
end
|
#host_command(m, cmd) ⇒ Object
27
28
29
30
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 27
def host_command m, cmd
cmd = HostCommand.new(ops, m, cmd)
cmd.run
end
|
#maintenance_command(m, cmd) ⇒ Object
42
43
44
45
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 42
def maintenance_command m, cmd
cmd = MaintenanceCommand.new(ops, m, cmd)
cmd.run
end
|
#ops ⇒ Object
52
53
54
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 52
def ops
@ops ||= bot.zabbirc_service.ops
end
|
#settings_command(m, cmd) ⇒ Object
32
33
34
35
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 32
def settings_command m, cmd
cmd = SettingsCommand.new(ops, m, cmd)
cmd.run
end
|
#sync_ops(m, u = nil) ⇒ Object
47
48
49
50
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 47
def sync_ops m, u=nil
return if u and u.nick == bot.nick
bot.zabbirc_service.ops_service.iterate
end
|
#zabbirc_status(m) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/zabbirc/irc/plugin_methods.rb', line 7
def zabbirc_status m
ops_msg = ops.find_all{|o| o.nick.present? }.collect{|o| "#{o.nick} as #{o.login}"}
msg = []
version = "Zabbirc #{Zabbirc::VERSION}"
if Zabbix::Connection.test_connection
msg << "#{m.user.nick}: #{version} - Zabbix API connection successfull"
else
msg << "#{m.user.nick}: #{version} - Zabbix API connection FAILED !!!"
end
msg << "#{m.user.nick}: Identified ops: #{ops_msg.join(", ")}"
m.reply msg.join("\n")
rescue Zabbix::NotConnected => e
rescue_not_connected m, e
end
|