mod_spox 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CHANGELOG +16 -0
  2. data/INSTALL +4 -1
  3. data/bin/mod_spox +3 -1
  4. data/data/mod_spox/extras/AOLSpeak.rb +2 -2
  5. data/data/mod_spox/extras/AutoKick.rb +3 -8
  6. data/data/mod_spox/extras/AutoMode.rb +135 -0
  7. data/data/mod_spox/extras/EightBall.rb +1 -0
  8. data/data/mod_spox/extras/Headers.rb +4 -3
  9. data/data/mod_spox/extras/PhpFuncLookup.rb +14 -11
  10. data/data/mod_spox/extras/Roulette.rb +3 -3
  11. data/data/mod_spox/extras/Search.rb +3 -2
  12. data/data/mod_spox/extras/Talk.rb +1 -9
  13. data/data/mod_spox/extras/Translate.rb +3 -3
  14. data/data/mod_spox/extras/UrbanDictionary.rb +5 -3
  15. data/data/mod_spox/extras/Weather.rb +5 -4
  16. data/data/mod_spox/plugins/Authenticator.rb +2 -2
  17. data/data/mod_spox/plugins/Banner.rb +207 -2
  18. data/data/mod_spox/plugins/Helper.rb +1 -1
  19. data/data/mod_spox/plugins/PluginLoader.rb +22 -6
  20. data/data/mod_spox/plugins/Triggers.rb +6 -4
  21. data/lib/mod_spox/Action.rb +2 -0
  22. data/lib/mod_spox/BaseConfig.rb +2 -0
  23. data/lib/mod_spox/Bot.rb +32 -6
  24. data/lib/mod_spox/BotConfig.rb +3 -0
  25. data/lib/mod_spox/Cache.rb +57 -0
  26. data/lib/mod_spox/ConfigurationWizard.rb +6 -2
  27. data/lib/mod_spox/Helpers.rb +36 -18
  28. data/lib/mod_spox/Loader.rb +5 -54
  29. data/lib/mod_spox/Logger.rb +49 -3
  30. data/lib/mod_spox/MessageFactory.rb +5 -0
  31. data/lib/mod_spox/Monitors.rb +14 -12
  32. data/lib/mod_spox/Pipeline.rb +38 -6
  33. data/lib/mod_spox/Plugin.rb +3 -0
  34. data/lib/mod_spox/PluginHolder.rb +22 -0
  35. data/lib/mod_spox/PluginManager.rb +123 -25
  36. data/lib/mod_spox/Pool.rb +52 -23
  37. data/lib/mod_spox/Socket.rb +21 -10
  38. data/lib/mod_spox/Timer.rb +32 -6
  39. data/lib/mod_spox/handlers/BadNick.rb +2 -0
  40. data/lib/mod_spox/handlers/Bounce.rb +3 -0
  41. data/lib/mod_spox/handlers/Created.rb +2 -0
  42. data/lib/mod_spox/handlers/Handler.rb +5 -0
  43. data/lib/mod_spox/handlers/Invite.rb +2 -0
  44. data/lib/mod_spox/handlers/Join.rb +21 -5
  45. data/lib/mod_spox/handlers/Kick.rb +2 -0
  46. data/lib/mod_spox/handlers/LuserChannels.rb +2 -0
  47. data/lib/mod_spox/handlers/LuserClient.rb +1 -0
  48. data/lib/mod_spox/handlers/LuserMe.rb +1 -0
  49. data/lib/mod_spox/handlers/LuserOp.rb +2 -0
  50. data/lib/mod_spox/handlers/LuserUnknown.rb +2 -0
  51. data/lib/mod_spox/handlers/Mode.rb +2 -0
  52. data/lib/mod_spox/handlers/Motd.rb +5 -2
  53. data/lib/mod_spox/handlers/MyInfo.rb +2 -0
  54. data/lib/mod_spox/handlers/Names.rb +5 -1
  55. data/lib/mod_spox/handlers/Nick.rb +2 -0
  56. data/lib/mod_spox/handlers/NickInUse.rb +2 -0
  57. data/lib/mod_spox/handlers/Notice.rb +16 -4
  58. data/lib/mod_spox/handlers/Part.rb +2 -0
  59. data/lib/mod_spox/handlers/Ping.rb +2 -0
  60. data/lib/mod_spox/handlers/Pong.rb +2 -0
  61. data/lib/mod_spox/handlers/Privmsg.rb +16 -4
  62. data/lib/mod_spox/handlers/Quit.rb +2 -0
  63. data/lib/mod_spox/handlers/Topic.rb +2 -0
  64. data/lib/mod_spox/handlers/Welcome.rb +3 -0
  65. data/lib/mod_spox/handlers/Who.rb +3 -1
  66. data/lib/mod_spox/handlers/Whois.rb +8 -0
  67. data/lib/mod_spox/handlers/YourHost.rb +2 -0
  68. data/lib/mod_spox/messages/Messages.rb +6 -0
  69. data/lib/mod_spox/messages/incoming/BadNick.rb +1 -0
  70. data/lib/mod_spox/messages/incoming/Bounce.rb +1 -0
  71. data/lib/mod_spox/messages/incoming/Created.rb +1 -0
  72. data/lib/mod_spox/messages/incoming/Invite.rb +1 -0
  73. data/lib/mod_spox/messages/incoming/Join.rb +1 -0
  74. data/lib/mod_spox/messages/incoming/Kick.rb +1 -0
  75. data/lib/mod_spox/messages/incoming/LuserChannels.rb +1 -0
  76. data/lib/mod_spox/messages/incoming/LuserClient.rb +1 -0
  77. data/lib/mod_spox/messages/incoming/LuserMe.rb +1 -0
  78. data/lib/mod_spox/messages/incoming/LuserOp.rb +1 -0
  79. data/lib/mod_spox/messages/incoming/LuserUnknown.rb +1 -0
  80. data/lib/mod_spox/messages/incoming/Mode.rb +1 -0
  81. data/lib/mod_spox/messages/incoming/Motd.rb +1 -0
  82. data/lib/mod_spox/messages/incoming/MyInfo.rb +1 -0
  83. data/lib/mod_spox/messages/incoming/Names.rb +1 -0
  84. data/lib/mod_spox/messages/incoming/Nick.rb +1 -0
  85. data/lib/mod_spox/messages/incoming/NickInUse.rb +1 -0
  86. data/lib/mod_spox/messages/incoming/Notice.rb +1 -0
  87. data/lib/mod_spox/messages/incoming/Part.rb +1 -0
  88. data/lib/mod_spox/messages/incoming/Ping.rb +1 -0
  89. data/lib/mod_spox/messages/incoming/Pong.rb +1 -0
  90. data/lib/mod_spox/messages/incoming/Privmsg.rb +1 -0
  91. data/lib/mod_spox/messages/incoming/Quit.rb +1 -0
  92. data/lib/mod_spox/messages/incoming/Topic.rb +1 -0
  93. data/lib/mod_spox/messages/incoming/TopicInfo.rb +1 -0
  94. data/lib/mod_spox/messages/incoming/Welcome.rb +1 -0
  95. data/lib/mod_spox/messages/incoming/Who.rb +1 -0
  96. data/lib/mod_spox/messages/incoming/Whois.rb +1 -0
  97. data/lib/mod_spox/messages/incoming/YourHost.rb +1 -0
  98. data/lib/mod_spox/messages/internal/NickRequest.rb +1 -0
  99. data/lib/mod_spox/messages/internal/NickResponse.rb +1 -0
  100. data/lib/mod_spox/messages/internal/PluginLoadRequest.rb +1 -0
  101. data/lib/mod_spox/messages/internal/PluginLoadResponse.rb +1 -0
  102. data/lib/mod_spox/messages/internal/PluginModuleRequest.rb +1 -0
  103. data/lib/mod_spox/messages/internal/PluginModuleResponse.rb +1 -0
  104. data/lib/mod_spox/messages/internal/PluginReload.rb +10 -0
  105. data/lib/mod_spox/messages/internal/PluginRequest.rb +1 -0
  106. data/lib/mod_spox/messages/internal/PluginResponse.rb +1 -0
  107. data/lib/mod_spox/messages/internal/PluginUnloadRequest.rb +1 -0
  108. data/lib/mod_spox/messages/internal/PluginUnloadResponse.rb +1 -0
  109. data/lib/mod_spox/messages/internal/StatusResponse.rb +1 -0
  110. data/lib/mod_spox/messages/internal/TimerAdd.rb +1 -0
  111. data/lib/mod_spox/messages/internal/TimerClear.rb +8 -0
  112. data/lib/mod_spox/messages/internal/TimerResponse.rb +1 -0
  113. data/lib/mod_spox/messages/outgoing/Away.rb +1 -0
  114. data/lib/mod_spox/messages/outgoing/Notice.rb +1 -0
  115. data/lib/mod_spox/messages/outgoing/Ping.rb +1 -0
  116. data/lib/mod_spox/messages/outgoing/Quit.rb +1 -0
  117. data/lib/mod_spox/messages/outgoing/Raw.rb +16 -0
  118. data/lib/mod_spox/models/Models.rb +4 -0
  119. data/lib/mod_spox/models/Nick.rb +9 -0
  120. data/lib/mod_spox/models/Setting.rb +3 -5
  121. data/lib/mod_spox/models/Signature.rb +2 -3
  122. metadata +8 -2
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Privmsg'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Ping'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/incoming/Message'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Incoming
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Request'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Response'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Request'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Response'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Request'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Response'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,7 +1,17 @@
1
1
  module ModSpox
2
2
  module Messages
3
3
  module Internal
4
+ # Sends message to reload plugin. If new and stale
5
+ # attributes are set, only that plugin will be reloaded
4
6
  class PluginReload
7
+ # Path to new plugin to load
8
+ attr_reader :fresh
9
+ # Path to stale plugin to remove
10
+ attr_reader :stale
11
+ def initialize(fresh=nil, stale=nil)
12
+ @fresh = fresh
13
+ @stale = stale
14
+ end
5
15
  end
6
16
  end
7
17
  end
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Request'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Response'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/PluginLoadRequest'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/PluginLoadResponse'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Response'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Request'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -2,6 +2,14 @@ module ModSpox
2
2
  module Messages
3
3
  module Internal
4
4
  class TimerClear
5
+ attr_reader :plugin
6
+ def initialize(plugin=nil)
7
+ if(plugin.nil?)
8
+ @plugin = nil
9
+ else
10
+ @plugin = plugin.is_a?(ModSpox::Plugin) ? plugin.name.to_sym : plugin.to_sym
11
+ end
12
+ end
5
13
  end
6
14
  end
7
15
  end
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/internal/Response'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Internal
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/outgoing/Simple'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Outgoing
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/outgoing/Privmsg'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Outgoing
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/outgoing/Simple'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Outgoing
@@ -1,3 +1,4 @@
1
+ require 'mod_spox/messages/outgoing/Simple'
1
2
  module ModSpox
2
3
  module Messages
3
4
  module Outgoing
@@ -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,4 @@
1
+ # Quick loader for all models
2
+ Dir.new(File.dirname(__FILE__)).each do |f|
3
+ require File.dirname(__FILE__) + '/' + f if f =~ /\.rb$/
4
+ end
@@ -120,6 +120,15 @@ module ModSpox
120
120
  return false
121
121
  end
122
122
 
123
+ # channel:: Models::Channel
124
+ # Return if nick is voiced in given channel
125
+ def is_voice?(channel)
126
+ NickMode.filter(:channel_id => channel.pk, :nick_id => pk).each do |mode|
127
+ return true if mode.mode == 'v'
128
+ end
129
+ return false
130
+ end
131
+
123
132
  # Purge all nick information
124
133
  def self.clean
125
134
  Nick.set(:username => nil, :real_name => nil, :address => nil,
@@ -1,5 +1,3 @@
1
- require 'base64'
2
-
3
1
  module ModSpox
4
2
  module Models
5
3
  # Attributes provided by model:
@@ -11,11 +9,11 @@ module ModSpox
11
9
  class Setting < Sequel::Model(:settings)
12
10
 
13
11
  def value=(val)
14
- update_values(:value => Base64.encode64(Marshal.dump(val)))
12
+ update_values(:value => [Marshal.dump(val)].pack('m'))
15
13
  end
16
14
 
17
15
  def value
18
- return values[:value] ? Marshal.load(Base64.decode64(values[:value])) : nil
16
+ return values[:value] ? Marshal.load(values[:value].unpack('m')[0]) : nil
19
17
  end
20
18
 
21
19
  # key:: name of the setting
@@ -33,7 +31,7 @@ module ModSpox
33
31
  def self.[]=(key, val)
34
32
  key = key.to_s if key.is_a?(Symbol)
35
33
  model = Setting.find_or_create(:name => key)
36
- model.update_with_params(:value => Base64.encode64(Marshal.dump(val)))
34
+ model.update_with_params(:value => [Marshal.dump(val)].pack('m'))
37
35
  end
38
36
  end
39
37
  end
@@ -1,4 +1,3 @@
1
- require 'base64'
2
1
  module ModSpox
3
2
  module Models
4
3
  # Attributes provided by model:
@@ -19,11 +18,11 @@ module ModSpox
19
18
  end
20
19
 
21
20
  def signature=(sig)
22
- update_values(:signature => Base64.encode64(Marshal.dump(sig)))
21
+ update_values(:signature => [Marshal.dump(sig)].pack('m'))
23
22
  end
24
23
 
25
24
  def signature
26
- return values[:signature] ? Marshal.load(Base64.decode64(values[:signature])) : nil
25
+ return values[:signature] ? Marshal.load(values[:signature].unpack('m')[0]) : nil
27
26
  end
28
27
 
29
28
  def group
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: mod_spox
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.4
7
- date: 2008-05-09 00:00:00 -07:00
6
+ version: 0.0.5
7
+ date: 2008-06-12 00:00:00 -07:00
8
8
  summary: The mod_spox IRC robot
9
9
  require_paths:
10
10
  - lib
@@ -45,6 +45,7 @@ files:
45
45
  - lib/mod_spox/models/Channel.rb
46
46
  - lib/mod_spox/models/NickMode.rb
47
47
  - lib/mod_spox/models/Group.rb
48
+ - lib/mod_spox/models/Models.rb
48
49
  - lib/mod_spox/migration/001_create_channel_modes.rb
49
50
  - lib/mod_spox/migration/001_create_nick_modes.rb
50
51
  - lib/mod_spox/migration/001_create_nick_channels.rb
@@ -160,6 +161,7 @@ files:
160
161
  - lib/mod_spox/messages/outgoing/ServList.rb
161
162
  - lib/mod_spox/messages/outgoing/List.rb
162
163
  - lib/mod_spox/messages/outgoing/UserHost.rb
164
+ - lib/mod_spox/messages/outgoing/Raw.rb
163
165
  - lib/mod_spox/messages/internal/PluginModuleRequest.rb
164
166
  - lib/mod_spox/messages/internal/PluginLoadResponse.rb
165
167
  - lib/mod_spox/messages/internal/PluginResponse.rb
@@ -190,6 +192,7 @@ files:
190
192
  - lib/mod_spox/messages/internal/BotInitialized.rb
191
193
  - lib/mod_spox/messages/internal/PluginUnloadRequest.rb
192
194
  - lib/mod_spox/messages/internal/Shutdown.rb
195
+ - lib/mod_spox/messages/Messages.rb
193
196
  - lib/mod_spox/Exceptions.rb
194
197
  - lib/mod_spox/Action.rb
195
198
  - lib/mod_spox/Logger.rb
@@ -209,6 +212,8 @@ files:
209
212
  - lib/mod_spox/Loader.rb
210
213
  - lib/mod_spox/BotConfig.rb
211
214
  - lib/mod_spox/MessageFactory.rb
215
+ - lib/mod_spox/PluginHolder.rb
216
+ - lib/mod_spox/Cache.rb
212
217
  - bin/mod_spox
213
218
  - data/mod_spox/plugins/Initializer.rb
214
219
  - data/mod_spox/plugins/Parter.rb
@@ -243,6 +248,7 @@ files:
243
248
  - data/mod_spox/extras/AOLSpeak.rb
244
249
  - data/mod_spox/extras/Logger.rb
245
250
  - data/mod_spox/extras/Topten.rb
251
+ - data/mod_spox/extras/AutoMode.rb
246
252
  test_files: []
247
253
 
248
254
  rdoc_options: []