spox-mod_spox 0.3.1
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/CHANGELOG +174 -0
- data/INSTALL +15 -0
- data/LICENSE +674 -0
- data/README.rdoc +73 -0
- data/bin/mod_spox +112 -0
- data/data/mod_spox/extras/AOLSpeak.rb +257 -0
- data/data/mod_spox/extras/AutoKick.rb +152 -0
- data/data/mod_spox/extras/AutoMode.rb +122 -0
- data/data/mod_spox/extras/AutoRejoin.rb +37 -0
- data/data/mod_spox/extras/Bash.rb +55 -0
- data/data/mod_spox/extras/Bouncer.rb +220 -0
- data/data/mod_spox/extras/Bullshit.rb +19 -0
- data/data/mod_spox/extras/Bytes.rb +11 -0
- data/data/mod_spox/extras/Confess.rb +244 -0
- data/data/mod_spox/extras/DCC.rb +182 -0
- data/data/mod_spox/extras/DevWatch.rb +153 -0
- data/data/mod_spox/extras/DownForEveryoneOrJustMe.rb +47 -0
- data/data/mod_spox/extras/EightBall.rb +33 -0
- data/data/mod_spox/extras/FML.rb +35 -0
- data/data/mod_spox/extras/FloodKicker.rb +129 -0
- data/data/mod_spox/extras/Fortune.rb +76 -0
- data/data/mod_spox/extras/GoogleIt.rb +13 -0
- data/data/mod_spox/extras/Headers.rb +59 -0
- data/data/mod_spox/extras/Karma.rb +302 -0
- data/data/mod_spox/extras/Locator.rb +44 -0
- data/data/mod_spox/extras/Logger.rb +182 -0
- data/data/mod_spox/extras/LolSpeak.rb +21 -0
- data/data/mod_spox/extras/NickServ.rb +84 -0
- data/data/mod_spox/extras/PhpCli.rb +308 -0
- data/data/mod_spox/extras/PhpFuncLookup.rb +297 -0
- data/data/mod_spox/extras/Pinger.rb +11 -0
- data/data/mod_spox/extras/Quotes.rb +79 -0
- data/data/mod_spox/extras/RegexTracker.rb +158 -0
- data/data/mod_spox/extras/Roulette.rb +267 -0
- data/data/mod_spox/extras/RubyCli.rb +93 -0
- data/data/mod_spox/extras/Search.rb +49 -0
- data/data/mod_spox/extras/Seen.rb +150 -0
- data/data/mod_spox/extras/Slashdot.rb +35 -0
- data/data/mod_spox/extras/SlashdotHeadlineGenerator.rb +500 -0
- data/data/mod_spox/extras/Talk.rb +32 -0
- data/data/mod_spox/extras/Topten.rb +103 -0
- data/data/mod_spox/extras/TracTicket.rb +66 -0
- data/data/mod_spox/extras/Translate.rb +132 -0
- data/data/mod_spox/extras/Twitter.rb +458 -0
- data/data/mod_spox/extras/UrbanDictionary.rb +55 -0
- data/data/mod_spox/extras/Weather.rb +55 -0
- data/data/mod_spox/plugins/Authenticator.rb +289 -0
- data/data/mod_spox/plugins/Banner.rb +585 -0
- data/data/mod_spox/plugins/BotNick.rb +18 -0
- data/data/mod_spox/plugins/Helper.rb +49 -0
- data/data/mod_spox/plugins/Initializer.rb +35 -0
- data/data/mod_spox/plugins/Joiner.rb +23 -0
- data/data/mod_spox/plugins/Nicker.rb +14 -0
- data/data/mod_spox/plugins/Parter.rb +23 -0
- data/data/mod_spox/plugins/Permissions.rb +60 -0
- data/data/mod_spox/plugins/PluginLoader.rb +180 -0
- data/data/mod_spox/plugins/Ponger.rb +70 -0
- data/data/mod_spox/plugins/PoolConfig.rb +52 -0
- data/data/mod_spox/plugins/Quitter.rb +15 -0
- data/data/mod_spox/plugins/Servers.rb +57 -0
- data/data/mod_spox/plugins/Status.rb +31 -0
- data/data/mod_spox/plugins/Triggers.rb +85 -0
- data/lib/mod_spox/BaseConfig.rb +51 -0
- data/lib/mod_spox/Bot.rb +604 -0
- data/lib/mod_spox/BotConfig.rb +65 -0
- data/lib/mod_spox/ConfigurationWizard.rb +180 -0
- data/lib/mod_spox/Database.rb +51 -0
- data/lib/mod_spox/Exceptions.rb +84 -0
- data/lib/mod_spox/Helpers.rb +122 -0
- data/lib/mod_spox/Loader.rb +60 -0
- data/lib/mod_spox/Logger.rb +37 -0
- data/lib/mod_spox/MessageFactory.rb +112 -0
- data/lib/mod_spox/Pipeline.rb +207 -0
- data/lib/mod_spox/Plugin.rb +97 -0
- data/lib/mod_spox/PluginHolder.rb +22 -0
- data/lib/mod_spox/PluginManager.rb +257 -0
- data/lib/mod_spox/PriorityQueue.rb +69 -0
- data/lib/mod_spox/Socket.rb +201 -0
- data/lib/mod_spox/Sockets.rb +226 -0
- data/lib/mod_spox/Timer.rb +60 -0
- data/lib/mod_spox/Version.rb +14 -0
- data/lib/mod_spox/handlers/BadNick.rb +19 -0
- data/lib/mod_spox/handlers/Bounce.rb +24 -0
- data/lib/mod_spox/handlers/Created.rb +27 -0
- data/lib/mod_spox/handlers/Handler.rb +39 -0
- data/lib/mod_spox/handlers/Invite.rb +28 -0
- data/lib/mod_spox/handlers/Join.rb +38 -0
- data/lib/mod_spox/handlers/Kick.rb +36 -0
- data/lib/mod_spox/handlers/LuserChannels.rb +19 -0
- data/lib/mod_spox/handlers/LuserClient.rb +18 -0
- data/lib/mod_spox/handlers/LuserMe.rb +16 -0
- data/lib/mod_spox/handlers/LuserOp.rb +19 -0
- data/lib/mod_spox/handlers/LuserUnknown.rb +19 -0
- data/lib/mod_spox/handlers/Mode.rb +62 -0
- data/lib/mod_spox/handlers/Motd.rb +38 -0
- data/lib/mod_spox/handlers/MyInfo.rb +24 -0
- data/lib/mod_spox/handlers/Names.rb +86 -0
- data/lib/mod_spox/handlers/Nick.rb +50 -0
- data/lib/mod_spox/handlers/NickInUse.rb +19 -0
- data/lib/mod_spox/handlers/Notice.rb +35 -0
- data/lib/mod_spox/handlers/Part.rb +39 -0
- data/lib/mod_spox/handlers/Ping.rb +25 -0
- data/lib/mod_spox/handlers/Pong.rb +23 -0
- data/lib/mod_spox/handlers/Privmsg.rb +39 -0
- data/lib/mod_spox/handlers/Quit.rb +29 -0
- data/lib/mod_spox/handlers/Topic.rb +38 -0
- data/lib/mod_spox/handlers/Welcome.rb +30 -0
- data/lib/mod_spox/handlers/Who.rb +83 -0
- data/lib/mod_spox/handlers/Whois.rb +117 -0
- data/lib/mod_spox/handlers/YourHost.rb +20 -0
- data/lib/mod_spox/messages/Messages.rb +6 -0
- data/lib/mod_spox/messages/incoming/BadNick.rb +16 -0
- data/lib/mod_spox/messages/incoming/Bounce.rb +18 -0
- data/lib/mod_spox/messages/incoming/Created.rb +15 -0
- data/lib/mod_spox/messages/incoming/Invite.rb +21 -0
- data/lib/mod_spox/messages/incoming/Join.rb +19 -0
- data/lib/mod_spox/messages/incoming/Kick.rb +26 -0
- data/lib/mod_spox/messages/incoming/LuserChannels.rb +15 -0
- data/lib/mod_spox/messages/incoming/LuserClient.rb +24 -0
- data/lib/mod_spox/messages/incoming/LuserMe.rb +18 -0
- data/lib/mod_spox/messages/incoming/LuserOp.rb +15 -0
- data/lib/mod_spox/messages/incoming/LuserUnknown.rb +15 -0
- data/lib/mod_spox/messages/incoming/Message.rb +22 -0
- data/lib/mod_spox/messages/incoming/Mode.rb +42 -0
- data/lib/mod_spox/messages/incoming/Motd.rb +18 -0
- data/lib/mod_spox/messages/incoming/MyInfo.rb +24 -0
- data/lib/mod_spox/messages/incoming/Names.rb +24 -0
- data/lib/mod_spox/messages/incoming/Nick.rb +26 -0
- data/lib/mod_spox/messages/incoming/NickInUse.rb +15 -0
- data/lib/mod_spox/messages/incoming/Notice.rb +9 -0
- data/lib/mod_spox/messages/incoming/Part.rb +21 -0
- data/lib/mod_spox/messages/incoming/Ping.rb +18 -0
- data/lib/mod_spox/messages/incoming/Pong.rb +9 -0
- data/lib/mod_spox/messages/incoming/Privmsg.rb +90 -0
- data/lib/mod_spox/messages/incoming/Quit.rb +18 -0
- data/lib/mod_spox/messages/incoming/Topic.rb +21 -0
- data/lib/mod_spox/messages/incoming/TopicInfo.rb +21 -0
- data/lib/mod_spox/messages/incoming/Welcome.rb +27 -0
- data/lib/mod_spox/messages/incoming/Who.rb +18 -0
- data/lib/mod_spox/messages/incoming/Whois.rb +49 -0
- data/lib/mod_spox/messages/incoming/YourHost.rb +18 -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/DCCListener.rb +12 -0
- data/lib/mod_spox/messages/internal/DCCRequest.rb +12 -0
- data/lib/mod_spox/messages/internal/DCCSocket.rb +19 -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 +9 -0
- data/lib/mod_spox/messages/internal/NickResponse.rb +15 -0
- data/lib/mod_spox/messages/internal/PluginLoadRequest.rb +21 -0
- data/lib/mod_spox/messages/internal/PluginLoadResponse.rb +17 -0
- data/lib/mod_spox/messages/internal/PluginModuleRequest.rb +14 -0
- data/lib/mod_spox/messages/internal/PluginModuleResponse.rb +18 -0
- data/lib/mod_spox/messages/internal/PluginReload.rb +18 -0
- data/lib/mod_spox/messages/internal/PluginRequest.rb +18 -0
- data/lib/mod_spox/messages/internal/PluginResponse.rb +21 -0
- data/lib/mod_spox/messages/internal/PluginUnloadRequest.rb +9 -0
- data/lib/mod_spox/messages/internal/PluginUnloadResponse.rb +9 -0
- data/lib/mod_spox/messages/internal/PluginsReady.rb +10 -0
- data/lib/mod_spox/messages/internal/QueueSocket.rb +8 -0
- data/lib/mod_spox/messages/internal/Reconnect.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 +10 -0
- data/lib/mod_spox/messages/internal/StatusResponse.rb +18 -0
- data/lib/mod_spox/messages/internal/TimerAdd.rb +36 -0
- data/lib/mod_spox/messages/internal/TimerClear.rb +16 -0
- data/lib/mod_spox/messages/internal/TimerRemove.rb +23 -0
- data/lib/mod_spox/messages/internal/TimerResponse.rb +34 -0
- data/lib/mod_spox/messages/internal/TriggersUpdate.rb +8 -0
- data/lib/mod_spox/messages/internal/UnqueueSocket.rb +8 -0
- data/lib/mod_spox/messages/outgoing/Admin.rb +15 -0
- data/lib/mod_spox/messages/outgoing/Away.rb +11 -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 +12 -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 +11 -0
- data/lib/mod_spox/messages/outgoing/Pong.rb +17 -0
- data/lib/mod_spox/messages/outgoing/Privmsg.rb +43 -0
- data/lib/mod_spox/messages/outgoing/Quit.rb +11 -0
- data/lib/mod_spox/messages/outgoing/Raw.rb +16 -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 +23 -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/migrations/001_initialize_models.rb +115 -0
- data/lib/mod_spox/migrations/002_persistent_sigs.rb +14 -0
- data/lib/mod_spox/migrations/003_auth_restructure.rb +31 -0
- data/lib/mod_spox/migrations/004_mode_index_fix.rb +18 -0
- data/lib/mod_spox/migrations/005_nick_mode_nopark.rb +18 -0
- data/lib/mod_spox/models/Auth.rb +65 -0
- data/lib/mod_spox/models/AuthMask.rb +13 -0
- data/lib/mod_spox/models/Channel.rb +89 -0
- data/lib/mod_spox/models/Config.rb +30 -0
- data/lib/mod_spox/models/Group.rb +30 -0
- data/lib/mod_spox/models/Models.rb +4 -0
- data/lib/mod_spox/models/Nick.rb +195 -0
- data/lib/mod_spox/models/NickMode.rb +32 -0
- data/lib/mod_spox/models/Server.rb +27 -0
- data/lib/mod_spox/models/Setting.rb +52 -0
- data/lib/mod_spox/models/Signature.rb +52 -0
- data/lib/mod_spox/models/Trigger.rb +9 -0
- data/lib/mod_spox/rfc2812.rb +49 -0
- data/populate_gemspec.rb +15 -0
- data/tests/BotHolder.rb +24 -0
- data/tests/handlers/tc_BadNick.rb +21 -0
- data/tests/handlers/tc_Created.rb +24 -0
- data/tests/handlers/tc_Invite.rb +50 -0
- data/tests/handlers/tc_Join.rb +33 -0
- data/tests/handlers/tc_Kick.rb +32 -0
- data/tests/handlers/tc_Mode.rb +85 -0
- data/tests/handlers/tc_Names.rb +35 -0
- data/tests/handlers/tc_Nick.rb +55 -0
- data/tests/handlers/tc_Part.rb +44 -0
- data/tests/handlers/tc_Ping.rb +40 -0
- data/tests/handlers/tc_Pong.rb +28 -0
- data/tests/handlers/tc_Privmsg.rb +85 -0
- data/tests/handlers/tc_Quit.rb +40 -0
- data/tests/handlers/tc_Who.rb +50 -0
- data/tests/handlers/tc_Whois.rb +61 -0
- data/tests/models/tc_Auth.rb +39 -0
- data/tests/models/tc_Channel.rb +52 -0
- data/tests/models/tc_Config.rb +19 -0
- data/tests/models/tc_Nick.rb +144 -0
- data/tests/models/tc_NickMode.rb +40 -0
- data/tests/models/tc_Setting.rb +21 -0
- data/tests/models/tc_Signature.rb +14 -0
- data/tests/run_tests.rb +6 -0
- metadata +362 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Pong
|
5
|
+
# server:: server to send to
|
6
|
+
attr_reader :server
|
7
|
+
# string:: string
|
8
|
+
attr_reader :string
|
9
|
+
# Send a pong
|
10
|
+
def initialize(server, string)
|
11
|
+
@server = server
|
12
|
+
@string = string
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Privmsg
|
5
|
+
# target for the message
|
6
|
+
attr_reader :target
|
7
|
+
# the message
|
8
|
+
attr_reader :message
|
9
|
+
# type of CTCP message
|
10
|
+
attr_reader :ctcp_type
|
11
|
+
# target:: target for the message
|
12
|
+
# message:: message to be sent
|
13
|
+
# Send a message to user or channel. Setting action to true
|
14
|
+
# is a shortcut to setting ctcp parameters. The action parameter
|
15
|
+
# will override the ctcp parameters if all are set
|
16
|
+
def initialize(target, message, action=false, ctcp=false, ctcp_type=nil)
|
17
|
+
@target = target
|
18
|
+
@message = message
|
19
|
+
@action = action
|
20
|
+
@ctcp = ctcp
|
21
|
+
@ctcp_type = ctcp_type.upcase unless ctcp_type.nil?
|
22
|
+
if(@action)
|
23
|
+
@ctcp = true
|
24
|
+
@ctcp_type = 'ACTION'
|
25
|
+
end
|
26
|
+
if(!@action && !@ctcp_type.nil?)
|
27
|
+
@action = true if @ctcp_type == 'ACTION'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# is message an action
|
32
|
+
def is_action?
|
33
|
+
return @action
|
34
|
+
end
|
35
|
+
|
36
|
+
# is message CTCP
|
37
|
+
def is_ctcp?
|
38
|
+
return @ctcp
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
# Sends message to IRC server with no modification
|
5
|
+
class Raw
|
6
|
+
# message to send
|
7
|
+
attr_reader :message
|
8
|
+
# message:: message to send
|
9
|
+
# Creates new Raw message
|
10
|
+
def initialize(message)
|
11
|
+
@message = message
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class ServList
|
5
|
+
# mask
|
6
|
+
attr_reader :mask
|
7
|
+
# type
|
8
|
+
attr_reader :type
|
9
|
+
# mask:: mask
|
10
|
+
# type:: type
|
11
|
+
# List services currently connected to network
|
12
|
+
def initialize(mask, type)
|
13
|
+
@mask = mask
|
14
|
+
@type = type
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Squery
|
5
|
+
# service to query
|
6
|
+
attr_reader :service_name
|
7
|
+
# message to send to service
|
8
|
+
attr_reader :message
|
9
|
+
# service_name:: name of the service to query
|
10
|
+
# message:: message to send to service
|
11
|
+
# Send message to a service
|
12
|
+
def initialize(service_name, message)
|
13
|
+
@service_name = service_name
|
14
|
+
@message = message
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Squit
|
5
|
+
# server to disconnect
|
6
|
+
attr_reader :server
|
7
|
+
# reasone for disconnection
|
8
|
+
attr_reader :comment
|
9
|
+
# server:: server to disconnect
|
10
|
+
# comment:: reason for disconnection
|
11
|
+
# Disconnect server link. Only available if bot is oper.
|
12
|
+
def initialize(server, comment)
|
13
|
+
@comment = comment
|
14
|
+
@server = server
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Stats
|
5
|
+
# the query
|
6
|
+
attr_reader :query
|
7
|
+
# target server
|
8
|
+
attr_reader :target
|
9
|
+
# query:: single character for query
|
10
|
+
# target:: target server to query (or connected server if unset)
|
11
|
+
def initialize(query, target='')
|
12
|
+
@query = query
|
13
|
+
@target = target
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Summon
|
5
|
+
# nick to summon
|
6
|
+
attr_reader :nick
|
7
|
+
# server nick is on
|
8
|
+
attr_reader :target
|
9
|
+
# channel to summon to
|
10
|
+
attr_reader :channel
|
11
|
+
# nick:: nick to summon
|
12
|
+
# target:: server which nick is on
|
13
|
+
# channel:: channel to summon to
|
14
|
+
# Summon a user
|
15
|
+
def initialize(nick, target='', channel='')
|
16
|
+
@nick = nick
|
17
|
+
@channel = channel
|
18
|
+
@target = target
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Topic
|
5
|
+
# channel to set topic
|
6
|
+
attr_reader :channel
|
7
|
+
# the topic
|
8
|
+
attr_reader :topic
|
9
|
+
# channel:: channel to set topic in
|
10
|
+
# topic:: the topic
|
11
|
+
# Set the topic for the channel
|
12
|
+
def initialize(channel, topic)
|
13
|
+
@channel = channel
|
14
|
+
@topic = topic
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Trace
|
5
|
+
# target to trace to
|
6
|
+
attr_reader :target
|
7
|
+
# target:: target to trace to
|
8
|
+
# Find route to specifc server
|
9
|
+
def initialize(target)
|
10
|
+
@target = target
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class User
|
5
|
+
# username of user
|
6
|
+
attr_reader :username
|
7
|
+
# real name of user
|
8
|
+
attr_reader :real_name
|
9
|
+
# mode of user
|
10
|
+
attr_reader :mode
|
11
|
+
# username:: username of user
|
12
|
+
# real_name:: real name of user
|
13
|
+
# mode:: default mode (see RFC 2812 for proper mode values)
|
14
|
+
# Create new User message
|
15
|
+
def initialize(username, real_name, mode=0)
|
16
|
+
@username = username
|
17
|
+
@real_name = real_name
|
18
|
+
@mode = mode
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class UserMode
|
5
|
+
# The bot's nick
|
6
|
+
attr_reader :nick
|
7
|
+
# mode to set/unset
|
8
|
+
attr_reader :mode
|
9
|
+
# nick:: The bot's nick
|
10
|
+
# mode:: mode to set/unset
|
11
|
+
# Create UserMode message
|
12
|
+
def initialize(nick, mode)
|
13
|
+
@nick = nick
|
14
|
+
@mode = mode
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Version
|
5
|
+
# target server to query
|
6
|
+
attr_reader :target
|
7
|
+
# target:: target server to query
|
8
|
+
# Query version of server. Connected server is queried
|
9
|
+
# if target is not defined
|
10
|
+
def initialize(target='')
|
11
|
+
@target = target
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Who
|
5
|
+
# mask to match
|
6
|
+
attr_reader :mask
|
7
|
+
# return only ops
|
8
|
+
attr_reader :op_only
|
9
|
+
# mask:: mask of clients to match
|
10
|
+
# only_ops:: only return operators
|
11
|
+
# Query for information matching given mask
|
12
|
+
def initialize(mask, op_only=false)
|
13
|
+
@mask = mask
|
14
|
+
@op_only = op_only
|
15
|
+
end
|
16
|
+
|
17
|
+
def only_ops?
|
18
|
+
return op_only
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class WhoWas
|
5
|
+
# nick to whowas
|
6
|
+
attr_reader :nick
|
7
|
+
# number of entries to return
|
8
|
+
attr_reader :count
|
9
|
+
# target server
|
10
|
+
attr_reader :target
|
11
|
+
# nick:: nick to whowas
|
12
|
+
# count:: number of entries to return
|
13
|
+
# target:: target server
|
14
|
+
# Information about a nick that no longer exists
|
15
|
+
def initialize(nick, count='', target='')
|
16
|
+
@nick = nick
|
17
|
+
@count = count
|
18
|
+
@target = target
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Messages
|
3
|
+
module Outgoing
|
4
|
+
class Whois
|
5
|
+
# nick to whois
|
6
|
+
attr_reader :nick
|
7
|
+
# server to query
|
8
|
+
attr_reader :target_server
|
9
|
+
# nick:: nick to whois
|
10
|
+
# target_server:: server to query
|
11
|
+
# Query information about a user
|
12
|
+
def initialize(nick, target_server='')
|
13
|
+
@nick = nick
|
14
|
+
@target_server = target_server
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Migrations
|
3
|
+
class InitializeModels < Sequel::Migration
|
4
|
+
|
5
|
+
def up
|
6
|
+
Database.db << "SET FOREIGN_KEY_CHECKS = 0" if Database.type == :mysql
|
7
|
+
Database.db.create_table(:nicks) do
|
8
|
+
primary_key :id, :null => false
|
9
|
+
varchar :nick, :null => false, :unique => true
|
10
|
+
varchar :username
|
11
|
+
varchar :real_name
|
12
|
+
varchar :address
|
13
|
+
varchar :host
|
14
|
+
varchar :source
|
15
|
+
timestamp :connected_at
|
16
|
+
varchar :connected_to
|
17
|
+
integer :seconds_idle
|
18
|
+
boolean :visible, :null => false, :default => false
|
19
|
+
boolean :away, :null => false, :default => false
|
20
|
+
boolean :botnick, :null => false, :default => false
|
21
|
+
end unless Database.db.table_exists?(:nicks)
|
22
|
+
Database.db.create_table(:channels) do
|
23
|
+
primary_key :id, :null => false
|
24
|
+
varchar :name, :null => false, :unique => true
|
25
|
+
varchar :password
|
26
|
+
boolean :autojoin, :null => false, :default => false
|
27
|
+
varchar :topic
|
28
|
+
boolean :quiet, :null => false, :default => false
|
29
|
+
boolean :parked, :null => false, :default => false
|
30
|
+
end unless Database.db.table_exists?(:channels)
|
31
|
+
Database.db.create_table(:auths) do
|
32
|
+
primary_key :id, :null => false
|
33
|
+
varchar :password
|
34
|
+
boolean :services, :null => false, :default => false
|
35
|
+
varchar :mask, :unique => true, :default => nil
|
36
|
+
boolean :authed, :null => false, :default => false
|
37
|
+
foreign_key :nick_id, :table => :nicks, :unique => true, :null => false, :key => :id
|
38
|
+
end unless Database.db.table_exists?(:auths)
|
39
|
+
Database.db.create_table(:groups) do
|
40
|
+
primary_key :id, :null => false
|
41
|
+
varchar :name, :null => false, :unique => true
|
42
|
+
end unless Database.db.table_exists?(:groups)
|
43
|
+
Database.db.create_table(:configs) do
|
44
|
+
primary_key :id, :null => false
|
45
|
+
varchar :name, :null => false, :unique => true
|
46
|
+
varchar :value
|
47
|
+
end unless Database.db.table_exists?(:configs)
|
48
|
+
Database.db.create_table(:servers) do
|
49
|
+
primary_key :id, :null => false
|
50
|
+
varchar :host, :null => false
|
51
|
+
integer :port, :null => false, :default => 6667
|
52
|
+
integer :priority, :null => false, :default => 0
|
53
|
+
boolean :connected, :null => false, :default => false
|
54
|
+
index [:host, :port], :unique => true
|
55
|
+
end unless Database.db.table_exists?(:servers)
|
56
|
+
Database.db.create_table(:settings) do
|
57
|
+
primary_key :id, :null => false
|
58
|
+
varchar :name, :null => false, :unique => true
|
59
|
+
text :value
|
60
|
+
end unless Database.db.table_exists?(:settings)
|
61
|
+
Database.db.create_table(:signatures) do
|
62
|
+
primary_key :id, :null => false
|
63
|
+
varchar :signature, :null => false
|
64
|
+
varchar :params
|
65
|
+
foreign_key :group_id, :table => :groups, :default => nil, :key => :id
|
66
|
+
varchar :method, :null => false
|
67
|
+
varchar :plugin, :null => false
|
68
|
+
varchar :description
|
69
|
+
varchar :requirement, :null => false, :default => 'both'
|
70
|
+
end unless Database.db.table_exists?(:signatures)
|
71
|
+
Database.db.create_table(:triggers) do
|
72
|
+
primary_key :id, :null => false
|
73
|
+
varchar :trigger, :unique => true, :null => false
|
74
|
+
boolean :active, :null => false, :default => false
|
75
|
+
end unless Database.db.table_exists?(:triggers)
|
76
|
+
Database.db.create_table(:auth_groups) do
|
77
|
+
foreign_key :group_id, :table => :groups, :null => false, :key => :id
|
78
|
+
foreign_key :auth_id, :table => :auths, :null => false, :key => :id
|
79
|
+
primary_key [:group_id, :auth_id]
|
80
|
+
end unless Database.db.table_exists?(:auth_groups)
|
81
|
+
Database.db.create_table(:channel_modes) do
|
82
|
+
primary_key :id, :null => false
|
83
|
+
varchar :mode, :null => false
|
84
|
+
foreign_key :channel_id, :table => :channels, :unique => true, :null => false, :key => :id
|
85
|
+
end unless Database.db.table_exists?(:channel_modes)
|
86
|
+
Database.db.create_table(:nick_channels) do
|
87
|
+
foreign_key :nick_id, :table => :nicks, :null => false, :key => :id
|
88
|
+
foreign_key :channel_id, :table => :channels, :null => false, :key => :id
|
89
|
+
primary_key [:nick_id, :channel_id]
|
90
|
+
end unless Database.db.table_exists?(:nick_channels)
|
91
|
+
Database.db.create_table(:nick_groups) do
|
92
|
+
foreign_key :group_id, :table => :groups, :null => false, :key => :id
|
93
|
+
foreign_key :nick_id, :table => :nicks, :null => false, :key => :id
|
94
|
+
primary_key [:nick_id, :group_id]
|
95
|
+
end unless Database.db.table_exists?(:nick_groups)
|
96
|
+
Database.db.create_table(:nick_modes) do
|
97
|
+
primary_key :id, :null => false
|
98
|
+
varchar :mode, :null => false
|
99
|
+
foreign_key :nick_id, :table => :nicks, :null => false, :key => :id
|
100
|
+
foreign_key :channel_id, :table => :channels, :key => :id
|
101
|
+
index [:nick_id, :channel_id]
|
102
|
+
end unless Database.db.table_exists?(:nick_modes)
|
103
|
+
Database.db << "SET FOREIGN_KEY_CHECKS = 1" if Database.type == :mysql
|
104
|
+
end
|
105
|
+
|
106
|
+
def down
|
107
|
+
[:nick_modes, :nick_groups, :nick_channels, :channel_modes, :auth_groups,
|
108
|
+
:triggers, :signatures, :settings, :servers, :configs, :groups, :auths,
|
109
|
+
:channels, :nicks].each do |table|
|
110
|
+
Database.db.drop_table(table) if Database.db.table_exists?(table)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Migrations
|
3
|
+
class PersistentSigs < Sequel::Migration
|
4
|
+
|
5
|
+
def up
|
6
|
+
Database.db.add_column :signatures, :enabled, :boolean, :null => false, :default => true
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
Database.db.drop_column :signatures, :enabled
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Migrations
|
3
|
+
class AuthRestructureModeFix < Sequel::Migration
|
4
|
+
|
5
|
+
def up
|
6
|
+
Database.db.drop_column :auths, :mask
|
7
|
+
Database.db.create_table(:auth_masks) do
|
8
|
+
primary_key :id, :null => false
|
9
|
+
varchar :mask, :null => false, :unique => true
|
10
|
+
end
|
11
|
+
Database.db.create_table(:auth_masks_groups) do
|
12
|
+
foreign_key :auth_mask_id, :table => :auth_masks, :null => false
|
13
|
+
foreign_key :group_id, :null => false
|
14
|
+
primary_key [:auth_mask_id, :group_id]
|
15
|
+
end
|
16
|
+
Database.db.create_table(:auth_masks_nicks) do
|
17
|
+
foreign_key :auth_mask_id, :table => :auth_masks, :null => false
|
18
|
+
foreign_key :nick_id, :null => false
|
19
|
+
primary_key [:nick_id, :auth_mask_id]
|
20
|
+
end
|
21
|
+
Database.db.drop_table :nick_groups
|
22
|
+
end
|
23
|
+
|
24
|
+
def down
|
25
|
+
Database.db.drop_table(:auth_masks_group)
|
26
|
+
Database.db.drop_table(:auth_masks_nicks)
|
27
|
+
Database.db.drop_table(:auth_masks)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Migrations
|
3
|
+
class ModeIndexFix < Sequel::Migration
|
4
|
+
|
5
|
+
def up
|
6
|
+
Database.db.drop_index :nick_modes, [:nick_id, :channel_id]
|
7
|
+
Database.db.add_index :nick_modes, [:nick_id, :channel_id], :unique => true
|
8
|
+
Database.db.drop_column :nick_modes, :mode
|
9
|
+
Database.db.add_column :nick_modes, :mode, :varchar, :null => true, :default => ''
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
Database.db.drop_index :nick_modes, [:nick_id, :channel_id]
|
14
|
+
Database.db.add_index :nick_modes, [:nick_id, :channel_id]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ModSpox
|
2
|
+
module Migrations
|
3
|
+
class NickModeNoPark < Sequel::Migration
|
4
|
+
|
5
|
+
def up
|
6
|
+
Database.db.drop_column :channels, :parked
|
7
|
+
Database.db.add_column :nicks, :mode, :varchar, :null => true, :default => ''
|
8
|
+
Database.db.drop_table :channel_modes
|
9
|
+
Database.db.add_column :channels, :mode, :varchar, :null => true, :default => ''
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
Database.db.drop_column :nicks, :mode
|
14
|
+
Database.add_column :nicks, :parked, :bool, :null => false, :default => true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|