mod_spox 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/INSTALL +9 -0
- data/README +33 -0
- data/bin/mod_spox +60 -0
- data/data/mod_spox/extras/Tester.rb +14 -0
- data/data/mod_spox/plugins/Authenticator.rb +245 -0
- data/data/mod_spox/plugins/BotNick.rb +18 -0
- data/data/mod_spox/plugins/Initializer.rb +41 -0
- data/data/mod_spox/plugins/Joiner.rb +13 -0
- data/data/mod_spox/plugins/Parter.rb +22 -0
- data/data/mod_spox/plugins/PluginLoader.rb +136 -0
- data/data/mod_spox/plugins/Ponger.rb +14 -0
- data/data/mod_spox/plugins/Quitter.rb +14 -0
- data/lib/mod_spox/Action.rb +73 -0
- data/lib/mod_spox/BaseConfig.rb +48 -0
- data/lib/mod_spox/Bot.rb +472 -0
- data/lib/mod_spox/BotConfig.rb +54 -0
- data/lib/mod_spox/ConfigurationWizard.rb +178 -0
- data/lib/mod_spox/Database.rb +25 -0
- data/lib/mod_spox/Exceptions.rb +35 -0
- data/lib/mod_spox/Helpers.rb +35 -0
- data/lib/mod_spox/Loader.rb +79 -0
- data/lib/mod_spox/Logger.rb +31 -0
- data/lib/mod_spox/MessageFactory.rb +73 -0
- data/lib/mod_spox/Monitors.rb +59 -0
- data/lib/mod_spox/Pipeline.rb +148 -0
- data/lib/mod_spox/Plugin.rb +18 -0
- data/lib/mod_spox/PluginManager.rb +105 -0
- data/lib/mod_spox/Pool.rb +50 -0
- data/lib/mod_spox/Socket.rb +171 -0
- data/lib/mod_spox/Timer.rb +138 -0
- data/lib/mod_spox/handlers/BadNick.rb +16 -0
- data/lib/mod_spox/handlers/Bounce.rb +15 -0
- data/lib/mod_spox/handlers/Created.rb +16 -0
- data/lib/mod_spox/handlers/Handler.rb +31 -0
- data/lib/mod_spox/handlers/Invite.rb +19 -0
- data/lib/mod_spox/handlers/Join.rb +30 -0
- data/lib/mod_spox/handlers/Kick.rb +24 -0
- data/lib/mod_spox/handlers/LuserChannels.rb +16 -0
- data/lib/mod_spox/handlers/LuserClient.rb +16 -0
- data/lib/mod_spox/handlers/LuserMe.rb +14 -0
- data/lib/mod_spox/handlers/LuserOp.rb +16 -0
- data/lib/mod_spox/handlers/LuserUnknown.rb +16 -0
- data/lib/mod_spox/handlers/Mode.rb +47 -0
- data/lib/mod_spox/handlers/Motd.rb +30 -0
- data/lib/mod_spox/handlers/MyInfo.rb +21 -0
- data/lib/mod_spox/handlers/Names.rb +54 -0
- data/lib/mod_spox/handlers/Nick.rb +24 -0
- data/lib/mod_spox/handlers/NickInUse.rb +16 -0
- data/lib/mod_spox/handlers/Notice.rb +32 -0
- data/lib/mod_spox/handlers/Part.rb +19 -0
- data/lib/mod_spox/handlers/Ping.rb +16 -0
- data/lib/mod_spox/handlers/Pong.rb +16 -0
- data/lib/mod_spox/handlers/Privmsg.rb +27 -0
- data/lib/mod_spox/handlers/Quit.rb +21 -0
- data/lib/mod_spox/handlers/Topic.rb +29 -0
- data/lib/mod_spox/handlers/Welcome.rb +34 -0
- data/lib/mod_spox/handlers/Who.rb +60 -0
- data/lib/mod_spox/handlers/Whois.rb +63 -0
- data/lib/mod_spox/handlers/YourHost.rb +17 -0
- data/lib/mod_spox/messages/incoming/BadNick.rb +15 -0
- data/lib/mod_spox/messages/incoming/Bounce.rb +17 -0
- data/lib/mod_spox/messages/incoming/Created.rb +14 -0
- data/lib/mod_spox/messages/incoming/Invite.rb +20 -0
- data/lib/mod_spox/messages/incoming/Join.rb +18 -0
- data/lib/mod_spox/messages/incoming/Kick.rb +25 -0
- data/lib/mod_spox/messages/incoming/LuserChannels.rb +14 -0
- data/lib/mod_spox/messages/incoming/LuserClient.rb +23 -0
- data/lib/mod_spox/messages/incoming/LuserMe.rb +17 -0
- data/lib/mod_spox/messages/incoming/LuserOp.rb +14 -0
- data/lib/mod_spox/messages/incoming/LuserUnknown.rb +14 -0
- data/lib/mod_spox/messages/incoming/Message.rb +22 -0
- data/lib/mod_spox/messages/incoming/Mode.rb +41 -0
- data/lib/mod_spox/messages/incoming/Motd.rb +17 -0
- data/lib/mod_spox/messages/incoming/MyInfo.rb +23 -0
- data/lib/mod_spox/messages/incoming/Names.rb +23 -0
- data/lib/mod_spox/messages/incoming/Nick.rb +25 -0
- data/lib/mod_spox/messages/incoming/NickInUse.rb +14 -0
- data/lib/mod_spox/messages/incoming/Notice.rb +8 -0
- data/lib/mod_spox/messages/incoming/Part.rb +20 -0
- data/lib/mod_spox/messages/incoming/Ping.rb +17 -0
- data/lib/mod_spox/messages/incoming/Pong.rb +8 -0
- data/lib/mod_spox/messages/incoming/Privmsg.rb +64 -0
- data/lib/mod_spox/messages/incoming/Quit.rb +17 -0
- data/lib/mod_spox/messages/incoming/Topic.rb +20 -0
- data/lib/mod_spox/messages/incoming/TopicInfo.rb +20 -0
- data/lib/mod_spox/messages/incoming/Welcome.rb +26 -0
- data/lib/mod_spox/messages/incoming/Who.rb +17 -0
- data/lib/mod_spox/messages/incoming/Whois.rb +47 -0
- data/lib/mod_spox/messages/incoming/YourHost.rb +17 -0
- data/lib/mod_spox/messages/internal/BotInitialized.rb +11 -0
- data/lib/mod_spox/messages/internal/ChangeNick.rb +15 -0
- data/lib/mod_spox/messages/internal/Connected.rb +20 -0
- data/lib/mod_spox/messages/internal/ConnectionFailed.rb +23 -0
- data/lib/mod_spox/messages/internal/Disconnected.rb +8 -0
- data/lib/mod_spox/messages/internal/Disconnecting.rb +8 -0
- data/lib/mod_spox/messages/internal/EstablishConnection.rb +22 -0
- data/lib/mod_spox/messages/internal/HaltBot.rb +8 -0
- data/lib/mod_spox/messages/internal/NickRequest.rb +8 -0
- data/lib/mod_spox/messages/internal/NickResponse.rb +14 -0
- data/lib/mod_spox/messages/internal/PluginLoadRequest.rb +20 -0
- data/lib/mod_spox/messages/internal/PluginLoadResponse.rb +16 -0
- data/lib/mod_spox/messages/internal/PluginModuleRequest.rb +13 -0
- data/lib/mod_spox/messages/internal/PluginModuleResponse.rb +17 -0
- data/lib/mod_spox/messages/internal/PluginReload.rb +8 -0
- data/lib/mod_spox/messages/internal/PluginRequest.rb +17 -0
- data/lib/mod_spox/messages/internal/PluginResponse.rb +20 -0
- data/lib/mod_spox/messages/internal/PluginUnloadRequest.rb +8 -0
- data/lib/mod_spox/messages/internal/PluginUnloadResponse.rb +8 -0
- data/lib/mod_spox/messages/internal/Request.rb +15 -0
- data/lib/mod_spox/messages/internal/Response.rb +15 -0
- data/lib/mod_spox/messages/internal/Shutdown.rb +8 -0
- data/lib/mod_spox/messages/internal/SignaturesUpdate.rb +8 -0
- data/lib/mod_spox/messages/internal/StatusRequest.rb +9 -0
- data/lib/mod_spox/messages/internal/StatusResponse.rb +17 -0
- data/lib/mod_spox/messages/internal/TimerAdd.rb +27 -0
- data/lib/mod_spox/messages/internal/TimerClear.rb +8 -0
- data/lib/mod_spox/messages/internal/TimerRemove.rb +15 -0
- data/lib/mod_spox/messages/internal/TimerResponse.rb +26 -0
- data/lib/mod_spox/messages/internal/TriggersUpdate.rb +8 -0
- data/lib/mod_spox/messages/outgoing/Admin.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Away.rb +10 -0
- data/lib/mod_spox/messages/outgoing/ChannelMode.rb +25 -0
- data/lib/mod_spox/messages/outgoing/Connect.rb +24 -0
- data/lib/mod_spox/messages/outgoing/Die.rb +9 -0
- data/lib/mod_spox/messages/outgoing/Info.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Invite.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Ison.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Join.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Kick.rb +23 -0
- data/lib/mod_spox/messages/outgoing/Kill.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Links.rb +19 -0
- data/lib/mod_spox/messages/outgoing/List.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Lusers.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Motd.rb +16 -0
- data/lib/mod_spox/messages/outgoing/Names.rb +20 -0
- data/lib/mod_spox/messages/outgoing/Nick.rb +16 -0
- data/lib/mod_spox/messages/outgoing/Notice.rb +11 -0
- data/lib/mod_spox/messages/outgoing/Oper.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Part.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Pass.rb +16 -0
- data/lib/mod_spox/messages/outgoing/Ping.rb +10 -0
- data/lib/mod_spox/messages/outgoing/Pong.rb +17 -0
- data/lib/mod_spox/messages/outgoing/Privmsg.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Quit.rb +10 -0
- data/lib/mod_spox/messages/outgoing/Rehash.rb +9 -0
- data/lib/mod_spox/messages/outgoing/Restart.rb +9 -0
- data/lib/mod_spox/messages/outgoing/ServList.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Simple.rb +12 -0
- data/lib/mod_spox/messages/outgoing/Squery.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Squit.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Stats.rb +18 -0
- data/lib/mod_spox/messages/outgoing/Summon.rb +23 -0
- data/lib/mod_spox/messages/outgoing/Time.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Topic.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Trace.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Unaway.rb +9 -0
- data/lib/mod_spox/messages/outgoing/User.rb +23 -0
- data/lib/mod_spox/messages/outgoing/UserHost.rb +15 -0
- data/lib/mod_spox/messages/outgoing/UserMode.rb +19 -0
- data/lib/mod_spox/messages/outgoing/Users.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Version.rb +16 -0
- data/lib/mod_spox/messages/outgoing/Who.rb +19 -0
- data/lib/mod_spox/messages/outgoing/WhoWas.rb +23 -0
- data/lib/mod_spox/messages/outgoing/Whois.rb +19 -0
- data/lib/mod_spox/migration/001_create_auths.rb +13 -0
- data/lib/mod_spox/migration/001_create_channel.rb +13 -0
- data/lib/mod_spox/migration/001_create_channel_modes.rb +13 -0
- data/lib/mod_spox/migration/001_create_config.rb +13 -0
- data/lib/mod_spox/migration/001_create_nick_channels.rb +13 -0
- data/lib/mod_spox/migration/001_create_nick_modes.rb +13 -0
- data/lib/mod_spox/migration/001_create_nicks.rb +13 -0
- data/lib/mod_spox/migration/001_create_servers.rb +13 -0
- data/lib/mod_spox/migration/001_create_settings.rb +13 -0
- data/lib/mod_spox/migration/001_create_signatures.rb +13 -0
- data/lib/mod_spox/migration/001_create_triggers.rb +13 -0
- data/lib/mod_spox/models/Auth.rb +79 -0
- data/lib/mod_spox/models/AuthGroup.rb +15 -0
- data/lib/mod_spox/models/Channel.rb +47 -0
- data/lib/mod_spox/models/ChannelMode.rb +14 -0
- data/lib/mod_spox/models/Config.rb +31 -0
- data/lib/mod_spox/models/Group.rb +13 -0
- data/lib/mod_spox/models/Nick.rb +110 -0
- data/lib/mod_spox/models/NickChannel.rb +43 -0
- data/lib/mod_spox/models/NickMode.rb +18 -0
- data/lib/mod_spox/models/Server.rb +12 -0
- data/lib/mod_spox/models/Setting.rb +40 -0
- data/lib/mod_spox/models/Signature.rb +30 -0
- data/lib/mod_spox/models/Trigger.rb +9 -0
- data/lib/mod_spox/rfc2812.rb +171 -0
- metadata +261 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Incoming
|
4
|
+
class Who < Message
|
5
|
+
# array of nicks
|
6
|
+
attr_reader :nicks
|
7
|
+
# where nicks are from (channel if who'd a channel, nick if who'd a single nick)
|
8
|
+
attr_reader :location
|
9
|
+
def initialize(raw, location, nicks)
|
10
|
+
super(raw)
|
11
|
+
@location = location
|
12
|
+
@nicks = nicks
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Incoming
|
4
|
+
class Whois < Message
|
5
|
+
# Nick of user
|
6
|
+
attr_reader :nick
|
7
|
+
# Channels user is found in
|
8
|
+
attr_accessor :channels
|
9
|
+
# Raw whois string
|
10
|
+
attr_accessor :raw
|
11
|
+
|
12
|
+
def initialize(nick)
|
13
|
+
@nick = nick
|
14
|
+
@channels = Array.new
|
15
|
+
@raw = Array.new
|
16
|
+
@locked = false
|
17
|
+
end
|
18
|
+
|
19
|
+
# channel:: Channel
|
20
|
+
# Adds channel to list
|
21
|
+
def channels_push(channel)
|
22
|
+
restricted if @locked
|
23
|
+
@channels << channel
|
24
|
+
end
|
25
|
+
|
26
|
+
# string:: string
|
27
|
+
# Adds string to raw whois info
|
28
|
+
def raw_push(string)
|
29
|
+
restricted if @locked
|
30
|
+
@raw << string
|
31
|
+
end
|
32
|
+
|
33
|
+
# Locks the object's custom methods
|
34
|
+
def lock
|
35
|
+
@locked = true
|
36
|
+
@raw_content = @raw.join("\n")
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def restricted
|
42
|
+
raise Exceptions::LockedObject.new('Whois message can no longer be modified')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Incoming
|
4
|
+
class YourHost < Message
|
5
|
+
# name of server bot is connected to
|
6
|
+
attr_reader :servername
|
7
|
+
# version of server bot is connected to
|
8
|
+
attr_reader :version
|
9
|
+
def initialize(raw, server, version)
|
10
|
+
super(raw)
|
11
|
+
@servername = server
|
12
|
+
@version = version
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class ChangeNick
|
5
|
+
# change bot's nick to this nick
|
6
|
+
attr_reader :new_nick
|
7
|
+
# new_nick: nick to change to
|
8
|
+
# Tells the bot it needs to change its nick
|
9
|
+
def initialize(new_nick)
|
10
|
+
@new_nick = new_nick
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class Connected
|
5
|
+
# server connected to
|
6
|
+
attr_reader :server
|
7
|
+
# port connected to
|
8
|
+
attr_reader :port
|
9
|
+
# server:: Server bot is connected to
|
10
|
+
# port:: Port bot connected to
|
11
|
+
# Used as notification that the bot has connected
|
12
|
+
# to the given server
|
13
|
+
def initialize(server, port)
|
14
|
+
@server = server
|
15
|
+
@port = port
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class ConnectionFailed
|
5
|
+
# server attempted
|
6
|
+
attr_reader :server
|
7
|
+
# port attempted
|
8
|
+
attr_reader :port
|
9
|
+
# reason for failure
|
10
|
+
attr_reader :reason
|
11
|
+
# server:: server attempted to connect
|
12
|
+
# port:: port attempted to connect on
|
13
|
+
# reason: reason for failed connection
|
14
|
+
# Failed connection to the server
|
15
|
+
def initialize(server, port, reason=nil)
|
16
|
+
@server = server
|
17
|
+
@port = port
|
18
|
+
@reason = reason
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class EstablishConnection
|
5
|
+
# server to connect to
|
6
|
+
attr_reader :server
|
7
|
+
# port to connect to
|
8
|
+
attr_reader :port
|
9
|
+
# password for connection to server
|
10
|
+
attr_reader :password
|
11
|
+
# server:: Server to connect to
|
12
|
+
# port:: Port to connect to
|
13
|
+
# password:: password to connect
|
14
|
+
def initialize(server, port, password=nil)
|
15
|
+
@server = server
|
16
|
+
@port = port
|
17
|
+
@password = password
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class PluginLoadRequest < Request
|
5
|
+
# path to plugin file
|
6
|
+
attr_reader :path
|
7
|
+
# file name for plugin
|
8
|
+
attr_reader :name
|
9
|
+
# object:: object requesting the load
|
10
|
+
# path:: path to plugin file to be loaded
|
11
|
+
# Loads a plugin located at the given path
|
12
|
+
def initialize(object, path, name=nil)
|
13
|
+
super(object)
|
14
|
+
@path = path
|
15
|
+
@name = name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class PluginLoadResponse < Response
|
5
|
+
# success of loading
|
6
|
+
attr_reader :success
|
7
|
+
# successful:: load was successful
|
8
|
+
# Notifies requesting object if load was successful
|
9
|
+
def initialize(object, successful)
|
10
|
+
super(object)
|
11
|
+
@success = successful
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class PluginModuleResponse < Response
|
5
|
+
# plugins module
|
6
|
+
attr_reader :module
|
7
|
+
# plugin:: Plugin to send to requester
|
8
|
+
# Sends the plugins module to the requester
|
9
|
+
def initialize(object, mod)
|
10
|
+
super(object)
|
11
|
+
@module = mod
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class PluginRequest < Request
|
5
|
+
# plugin requested
|
6
|
+
attr_reader :plugin
|
7
|
+
# object:: object requesting
|
8
|
+
# name:: Name of plugin
|
9
|
+
# Request plugin from bot
|
10
|
+
def initialize(object, name)
|
11
|
+
super(object)
|
12
|
+
@name = name.is_a?(Symbol) ? name : name.to_sym
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class PluginResponse < Response
|
5
|
+
# plugin object
|
6
|
+
attr_reader :plugin
|
7
|
+
# plugin:: Plugin to send to requester
|
8
|
+
# Sends a plugin to requesting object
|
9
|
+
def initialize(object, plugin)
|
10
|
+
super(object)
|
11
|
+
@plugin = plugin
|
12
|
+
end
|
13
|
+
|
14
|
+
def found?
|
15
|
+
return !@plugin.nil?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class Request
|
5
|
+
# object making request
|
6
|
+
attr_reader :requester
|
7
|
+
# requester:: object making request
|
8
|
+
# Request for information
|
9
|
+
def initialize(requester)
|
10
|
+
@requester = requester
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class Response
|
5
|
+
# object response is for
|
6
|
+
attr_reader :origin
|
7
|
+
# origin:: object that requested the information
|
8
|
+
# Response of information
|
9
|
+
def initialize(origin)
|
10
|
+
@origin = origin
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class StatusResponse < Response
|
5
|
+
# Current status of the bot
|
6
|
+
attr_reader :status
|
7
|
+
# object:: Destination for response
|
8
|
+
# status:: Status of the bot
|
9
|
+
# Send status response to requester
|
10
|
+
def initialize(object, status)
|
11
|
+
super(object)
|
12
|
+
@status = status
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class TimerAdd < Request
|
5
|
+
# code block to execute
|
6
|
+
attr_reader :block
|
7
|
+
# data to supply to block
|
8
|
+
attr_reader :data
|
9
|
+
# interval between executions
|
10
|
+
attr_reader :period
|
11
|
+
# only execute block once
|
12
|
+
attr_reader :once
|
13
|
+
# period:: interval between executions
|
14
|
+
# once:: only run block once
|
15
|
+
# block:: code block
|
16
|
+
# Add repeating event to timer
|
17
|
+
def initialize(object, period, data=nil, once=false, &block)
|
18
|
+
super(object)
|
19
|
+
@data = data
|
20
|
+
@period = period
|
21
|
+
@once = once
|
22
|
+
@block = block
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class TimerRemove
|
5
|
+
# action to remove
|
6
|
+
attr_reader :action
|
7
|
+
# action:: action to remove from timer
|
8
|
+
# Remove action from timer
|
9
|
+
def initialize(action)
|
10
|
+
@action = action
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Internal
|
4
|
+
class TimerResponse < Response
|
5
|
+
# action from timer
|
6
|
+
attr_reader :action
|
7
|
+
# object:: object to send response to
|
8
|
+
# action:: action removed from timer
|
9
|
+
# Notification that action has been removed
|
10
|
+
def initialize(object, action, added)
|
11
|
+
super(object)
|
12
|
+
@action = action
|
13
|
+
@added = added
|
14
|
+
end
|
15
|
+
# Action was added to timer
|
16
|
+
def action_added?
|
17
|
+
return @added
|
18
|
+
end
|
19
|
+
# Action was removed from timer
|
20
|
+
def action_removed?
|
21
|
+
return !@added
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Admin
|
5
|
+
# target server
|
6
|
+
attr_reader :target
|
7
|
+
# target:: target server
|
8
|
+
# Request administrator info from target serve
|
9
|
+
def initialize(target)
|
10
|
+
@target = target
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class ChannelMode
|
5
|
+
# channel to set mode
|
6
|
+
attr_reader :channel
|
7
|
+
# mode to set/unset
|
8
|
+
attr_reader :mode
|
9
|
+
# target of mode change
|
10
|
+
attr_reader :target
|
11
|
+
# channel:: channel to set mode in
|
12
|
+
# mode:: mode to set/unset
|
13
|
+
# target:: target of mode change
|
14
|
+
# Query/change channel modes. Target can also be used as mode
|
15
|
+
# options for cases like: MODE #chan +l 10 where the target
|
16
|
+
# would hold the limit value.
|
17
|
+
def initialize(channel, mode, target='')
|
18
|
+
@channel = channel
|
19
|
+
@mode = mode
|
20
|
+
@target = target
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Connect
|
5
|
+
# server to connect to
|
6
|
+
attr_reader :target_server
|
7
|
+
# port to connec to
|
8
|
+
attr_reader :port
|
9
|
+
# remote server to connect to target
|
10
|
+
attr_reader :remote_server
|
11
|
+
# target_server:: server to connect to
|
12
|
+
# port:: target server port
|
13
|
+
# remote_server:: remote server to connect to target
|
14
|
+
# Request a server to try to establish a connection to
|
15
|
+
# another server. This is generally an oper command.
|
16
|
+
def initialize(target_server, port, remote_server='')
|
17
|
+
@target_server = target_server
|
18
|
+
@port = port
|
19
|
+
@remote_server = remote_server
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Info
|
5
|
+
# target server
|
6
|
+
attr_reader :target
|
7
|
+
# target:: target server
|
8
|
+
# Request information about target server
|
9
|
+
def initialize(target='')
|
10
|
+
@target = target
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|