mod_spox 0.1.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +36 -0
- data/INSTALL +2 -2
- data/README +0 -1
- data/bin/mod_spox +51 -12
- data/data/mod_spox/extras/AOLSpeak.rb +5 -18
- data/data/mod_spox/extras/AutoKick.rb +44 -23
- data/data/mod_spox/extras/AutoMode.rb +2 -5
- data/data/mod_spox/extras/AutoRejoin.rb +21 -0
- data/data/mod_spox/extras/Bouncer.rb +10 -10
- data/data/mod_spox/extras/Bytes.rb +12 -0
- data/data/mod_spox/extras/Confess.rb +131 -52
- data/data/mod_spox/extras/DCC.rb +189 -0
- data/data/mod_spox/extras/DevWatch.rb +32 -33
- data/data/mod_spox/extras/FloodKicker.rb +129 -0
- data/data/mod_spox/extras/GoogleIt.rb +13 -0
- data/data/mod_spox/extras/Headers.rb +31 -4
- data/data/mod_spox/extras/Karma.rb +103 -49
- data/data/mod_spox/extras/Logger.rb +45 -30
- data/data/mod_spox/extras/LolSpeak.rb +1 -1
- data/data/mod_spox/extras/NickServ.rb +83 -0
- data/data/mod_spox/extras/PhpCli.rb +12 -15
- data/data/mod_spox/extras/PhpFuncLookup.rb +57 -25
- data/data/mod_spox/extras/Quotes.rb +5 -4
- data/data/mod_spox/extras/RegexTracker.rb +160 -0
- data/data/mod_spox/extras/Roulette.rb +22 -23
- data/data/mod_spox/extras/Search.rb +3 -2
- data/data/mod_spox/extras/Slashdot.rb +35 -0
- data/data/mod_spox/extras/Topten.rb +5 -5
- data/data/mod_spox/extras/TracTicket.rb +68 -0
- data/data/mod_spox/extras/Translate.rb +69 -30
- data/data/mod_spox/extras/Twitter.rb +372 -0
- data/data/mod_spox/extras/UrbanDictionary.rb +21 -12
- data/data/mod_spox/extras/Weather.rb +1 -1
- data/data/mod_spox/plugins/Authenticator.rb +63 -30
- data/data/mod_spox/plugins/Banner.rb +164 -151
- data/data/mod_spox/plugins/Helper.rb +18 -7
- data/data/mod_spox/plugins/PluginLoader.rb +46 -22
- data/data/mod_spox/plugins/PoolConfig.rb +52 -0
- data/data/mod_spox/plugins/Quitter.rb +1 -1
- data/data/mod_spox/plugins/Status.rb +28 -0
- data/lib/mod_spox/Action.rb +20 -3
- data/lib/mod_spox/BaseConfig.rb +1 -0
- data/lib/mod_spox/Bot.rb +98 -75
- data/lib/mod_spox/BotConfig.rb +14 -6
- data/lib/mod_spox/ConfigurationWizard.rb +94 -105
- data/lib/mod_spox/Database.rb +33 -13
- data/lib/mod_spox/Helpers.rb +67 -38
- data/lib/mod_spox/Loader.rb +25 -5
- data/lib/mod_spox/Logger.rb +20 -62
- data/lib/mod_spox/MessageFactory.rb +34 -25
- data/lib/mod_spox/Monitors.rb +5 -0
- data/lib/mod_spox/Pipeline.rb +40 -51
- data/lib/mod_spox/Plugin.rb +40 -9
- data/lib/mod_spox/PluginManager.rb +46 -38
- data/lib/mod_spox/Pool.rb +129 -143
- data/lib/mod_spox/Socket.rb +41 -50
- data/lib/mod_spox/Sockets.rb +211 -0
- data/lib/mod_spox/Timer.rb +86 -69
- data/lib/mod_spox/handlers/BadNick.rb +1 -1
- data/lib/mod_spox/handlers/Created.rb +1 -1
- data/lib/mod_spox/handlers/Handler.rb +9 -0
- data/lib/mod_spox/handlers/Invite.rb +1 -1
- data/lib/mod_spox/handlers/Join.rb +2 -2
- data/lib/mod_spox/handlers/Kick.rb +1 -1
- data/lib/mod_spox/handlers/LuserChannels.rb +1 -1
- data/lib/mod_spox/handlers/LuserOp.rb +1 -1
- data/lib/mod_spox/handlers/LuserUnknown.rb +1 -1
- data/lib/mod_spox/handlers/Mode.rb +2 -2
- data/lib/mod_spox/handlers/MyInfo.rb +1 -1
- data/lib/mod_spox/handlers/Names.rb +1 -1
- data/lib/mod_spox/handlers/Nick.rb +20 -3
- data/lib/mod_spox/handlers/NickInUse.rb +3 -3
- data/lib/mod_spox/handlers/Notice.rb +5 -15
- data/lib/mod_spox/handlers/Part.rb +1 -1
- data/lib/mod_spox/handlers/Ping.rb +1 -1
- data/lib/mod_spox/handlers/Pong.rb +1 -1
- data/lib/mod_spox/handlers/Privmsg.rb +2 -2
- data/lib/mod_spox/handlers/Quit.rb +1 -1
- data/lib/mod_spox/handlers/Topic.rb +2 -1
- data/lib/mod_spox/handlers/Welcome.rb +3 -3
- data/lib/mod_spox/handlers/Who.rb +9 -7
- data/lib/mod_spox/handlers/Whois.rb +29 -16
- data/lib/mod_spox/handlers/YourHost.rb +1 -1
- data/lib/mod_spox/messages/incoming/Privmsg.rb +38 -19
- 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/StatusRequest.rb +2 -1
- data/lib/mod_spox/messages/outgoing/Privmsg.rb +21 -5
- data/lib/mod_spox/migrations/001_initialize_models.rb +115 -0
- data/lib/mod_spox/models/Auth.rb +24 -16
- data/lib/mod_spox/models/AuthGroup.rb +4 -3
- data/lib/mod_spox/models/Channel.rb +20 -12
- data/lib/mod_spox/models/ChannelMode.rb +2 -2
- data/lib/mod_spox/models/Config.rb +11 -3
- data/lib/mod_spox/models/Group.rb +6 -1
- data/lib/mod_spox/models/Nick.rb +93 -33
- data/lib/mod_spox/models/NickChannel.rb +8 -6
- data/lib/mod_spox/models/NickGroup.rb +16 -0
- data/lib/mod_spox/models/NickMode.rb +3 -3
- data/lib/mod_spox/models/Server.rb +6 -2
- data/lib/mod_spox/models/Setting.rb +12 -6
- data/lib/mod_spox/models/Signature.rb +7 -13
- data/lib/mod_spox/models/Trigger.rb +1 -1
- metadata +125 -100
@@ -2,7 +2,7 @@ class Authenticator < ModSpox::Plugin
|
|
2
2
|
def initialize(pipeline)
|
3
3
|
super(pipeline)
|
4
4
|
group = Models::Group.filter(:name => 'admin').first
|
5
|
-
Models::Signature.find_or_create(:signature => 'auth (\S+)', :plugin => name, :method => 'authenticate',
|
5
|
+
Models::Signature.find_or_create(:signature => 'auth (\S+)', :plugin => name, :method => 'authenticate',
|
6
6
|
:description => 'Authenticate with bot using a password').params = [:password]
|
7
7
|
Models::Signature.find_or_create(:signature => 'ident', :plugin => name, :method => 'send_whois',
|
8
8
|
:description => 'Instructs the bot to check your NickServ status')
|
@@ -18,13 +18,13 @@ class Authenticator < ModSpox::Plugin
|
|
18
18
|
:group_id => group.pk, :description => 'List all available authentication masks')
|
19
19
|
Models::Signature.find_or_create(:signature => 'auth nick ident (\S+) (true|false)', :plugin => name, :method => 'nick_ident',
|
20
20
|
:group_id => group.pk, :description => 'Allow authentication to nicks identified to NickServ').params = [:nick, :ident]
|
21
|
-
Models::Signature.find_or_create(:signature => 'auth nick password (\S+) (\S+)', :plugin => name, :method => 'nick_pass',
|
21
|
+
Models::Signature.find_or_create(:signature => 'auth nick password (\S+) (\S+)', :plugin => name, :method => 'nick_pass',
|
22
22
|
:group_id => group.pk, :description => 'Set authentication password for nick').params = [:nick, :password]
|
23
23
|
Models::Signature.find_or_create(:signature => 'auth nick clear password (\S+)', :plugin => name, :method => 'clear_pass',
|
24
24
|
:group_id => group.pk, :description => 'Clear nicks authentication password').params = [:nick]
|
25
|
-
Models::Signature.find_or_create(:signature => 'auth nick info (\S+)', :plugin => name, :method => 'nick_info',
|
25
|
+
Models::Signature.find_or_create(:signature => 'auth nick info (\S+)', :plugin => name, :method => 'nick_info',
|
26
26
|
:group_id => group.pk, :description => 'Return authentication information about given nick').params = [:nick]
|
27
|
-
Models::Signature.find_or_create(:signature => 'auth nick set (\S+) (\S+)', :plugin => name, :method => 'set_nick',
|
27
|
+
Models::Signature.find_or_create(:signature => 'auth nick set (\S+) (\S+)', :plugin => name, :method => 'set_nick',
|
28
28
|
:group_id => group.pk, :description => 'Set the group for a given nick').params = [:nick, :group]
|
29
29
|
Models::Signature.find_or_create(:signature => 'auth nick unset (\S+) (\S+)', :plugin => name, :method => 'unset_nick',
|
30
30
|
:group_id => group.pk, :description => 'Unset the group for a given nick').params = [:nick, :group]
|
@@ -34,8 +34,14 @@ class Authenticator < ModSpox::Plugin
|
|
34
34
|
:group_id => group.pk, :description => 'List members of given group').params = [:group]
|
35
35
|
Models::Signature.find_or_create(:signature => 'groups', :plugin => name, :method => 'show_groups',
|
36
36
|
:description => 'Show user groups they are currently a member of')
|
37
|
+
@whois_cache = []
|
38
|
+
@nickserv_nicks = []
|
39
|
+
populate_nickserv
|
40
|
+
@pipeline.hook(self, :check_join, :Incoming_Join)
|
41
|
+
@pipeline.hook(self, :check_nicks, :Incoming_Who)
|
42
|
+
@pipeline.hook(self, :check_nicks, :Incoming_Names)
|
37
43
|
end
|
38
|
-
|
44
|
+
|
39
45
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
40
46
|
# params:: Signature parameters
|
41
47
|
# Authenticate a user by password
|
@@ -45,9 +51,9 @@ class Authenticator < ModSpox::Plugin
|
|
45
51
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, 'Authentication was successful')
|
46
52
|
else
|
47
53
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, 'Authentication failed')
|
48
|
-
end
|
54
|
+
end
|
49
55
|
end
|
50
|
-
|
56
|
+
|
51
57
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
52
58
|
# params:: Signature parameters
|
53
59
|
# Add an authentication mask
|
@@ -63,7 +69,7 @@ class Authenticator < ModSpox::Plugin
|
|
63
69
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Authentication failed to add mask. Reason: #{boom}")
|
64
70
|
end
|
65
71
|
end
|
66
|
-
|
72
|
+
|
67
73
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
68
74
|
# params:: Signature parameters
|
69
75
|
# Add an authentication group to a given mask
|
@@ -79,7 +85,7 @@ class Authenticator < ModSpox::Plugin
|
|
79
85
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Failed to find mask with ID: #{params[:id]}")
|
80
86
|
end
|
81
87
|
end
|
82
|
-
|
88
|
+
|
83
89
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
84
90
|
# params:: Signature parameters
|
85
91
|
# Remove an authentication group from a given mask
|
@@ -95,7 +101,7 @@ class Authenticator < ModSpox::Plugin
|
|
95
101
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Failed to find mask with ID: #{params[:id]}")
|
96
102
|
end
|
97
103
|
end
|
98
|
-
|
104
|
+
|
99
105
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
100
106
|
# params:: Signature parameters
|
101
107
|
# List all authentication masks
|
@@ -109,7 +115,7 @@ class Authenticator < ModSpox::Plugin
|
|
109
115
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "\2ID:\2 #{a.pk}: \2mask:\2 #{a.mask} \2groups:\2 #{groups.join(', ')}")
|
110
116
|
end
|
111
117
|
end
|
112
|
-
|
118
|
+
|
113
119
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
114
120
|
# params:: Signature parameters
|
115
121
|
# Remove given authentication mask
|
@@ -122,12 +128,12 @@ class Authenticator < ModSpox::Plugin
|
|
122
128
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "\2Failed\2: Could not find an authentication mask with ID: #{params[:id]}")
|
123
129
|
end
|
124
130
|
end
|
125
|
-
|
131
|
+
|
126
132
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
127
133
|
# params:: Signature parameters
|
128
134
|
# Set nick authentication by NickServ
|
129
135
|
def nick_ident(message, params)
|
130
|
-
nick = Models::Nick.
|
136
|
+
nick = Models::Nick.locate(params[:nick])
|
131
137
|
if(params[:ident] == 'true')
|
132
138
|
nick.auth.update_with_params(:services => true)
|
133
139
|
else
|
@@ -135,26 +141,26 @@ class Authenticator < ModSpox::Plugin
|
|
135
141
|
end
|
136
142
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Nick #{params[:nick]} has been updated. Services for authentication has been set to #{params[:ident]}")
|
137
143
|
end
|
138
|
-
|
139
|
-
|
144
|
+
|
145
|
+
|
140
146
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
141
147
|
# params:: Signature parameters
|
142
148
|
# Set password for given nick
|
143
149
|
def nick_pass(message, params)
|
144
|
-
nick = Models::Nick.
|
150
|
+
nick = Models::Nick.locate(params[:nick])
|
145
151
|
nick.auth.password = params[:password]
|
146
152
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Nick #{params[:nick]} has been updated. Password has been set.")
|
147
153
|
end
|
148
|
-
|
154
|
+
|
149
155
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
150
156
|
# params:: Signature parameters
|
151
157
|
# Clear password field for given nick
|
152
|
-
def
|
153
|
-
nick = Models::Nick.
|
158
|
+
def clear_pass(message, params)
|
159
|
+
nick = Models::Nick.locate(params[:nick])
|
154
160
|
nick.auth.password = nil
|
155
|
-
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Nick #{params[:nick]} has been updated. Password has been
|
161
|
+
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Nick #{params[:nick]} has been updated. Password has been unset.")
|
156
162
|
end
|
157
|
-
|
163
|
+
|
158
164
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
159
165
|
# params:: Signature parameters
|
160
166
|
# Display info for given nick
|
@@ -164,7 +170,9 @@ class Authenticator < ModSpox::Plugin
|
|
164
170
|
info = []
|
165
171
|
info << "\2INFO [#{nick.nick}]:\2"
|
166
172
|
groups = []
|
167
|
-
nick.
|
173
|
+
Models::AuthGroup.filter(:auth_id => nick.auth.pk).each do |ag|
|
174
|
+
groups << ag.group.name
|
175
|
+
end
|
168
176
|
info << "Groups: #{groups.uniq.sort.join(', ')}."
|
169
177
|
nick.auth.password.nil? ? info << 'Password has not been set.' : info << 'Password has been set.'
|
170
178
|
nick.auth.services ? info << 'Nickserv ident is enabled.' : info << 'Nickserv ident is disabled.'
|
@@ -173,7 +181,7 @@ class Authenticator < ModSpox::Plugin
|
|
173
181
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "I have no record of nick: #{params[:nick]}")
|
174
182
|
end
|
175
183
|
end
|
176
|
-
|
184
|
+
|
177
185
|
def show_groups(message, params)
|
178
186
|
groups = []
|
179
187
|
message.source.auth_groups.each{|g| groups << g.name}
|
@@ -183,22 +191,22 @@ class Authenticator < ModSpox::Plugin
|
|
183
191
|
reply message.replyto, "\2Groups (#{message.source.nick}):\2 #{groups.join(', ')}"
|
184
192
|
end
|
185
193
|
end
|
186
|
-
|
194
|
+
|
187
195
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
188
196
|
# params:: Signature parameters
|
189
197
|
# Add given nick to authentication group
|
190
198
|
def set_nick(message, params)
|
191
199
|
group = Models::Group.filter(:name => params[:group]).first
|
192
|
-
nick = Models::Nick.
|
200
|
+
nick = Models::Nick.locate(params[:nick])
|
193
201
|
if(group)
|
194
|
-
nick.group = group
|
202
|
+
nick.auth.group = group
|
195
203
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Nick #{params[:nick]} has been added to the group: #{params[:group]}")
|
196
204
|
else
|
197
205
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Failed to find authentication group: #{params[:group]}")
|
198
206
|
|
199
207
|
end
|
200
208
|
end
|
201
|
-
|
209
|
+
|
202
210
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
203
211
|
# params:: Signature parameters
|
204
212
|
# Remove given nick from authenticationg group
|
@@ -213,14 +221,15 @@ class Authenticator < ModSpox::Plugin
|
|
213
221
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "Failed to find group: #{params[:group]}") unless group
|
214
222
|
end
|
215
223
|
end
|
216
|
-
|
224
|
+
|
217
225
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
218
226
|
# params:: Signature parameters
|
219
227
|
# Send WHOIS for nick
|
220
228
|
def send_whois(message, params)
|
229
|
+
message.source.clear_auth
|
221
230
|
@pipeline << Messages::Outgoing::Whois.new(message.source.nick)
|
222
231
|
end
|
223
|
-
|
232
|
+
|
224
233
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
225
234
|
# params:: Signature parameters
|
226
235
|
# Display all available authentication groups
|
@@ -229,7 +238,7 @@ class Authenticator < ModSpox::Plugin
|
|
229
238
|
Models::Group.all.each{|g| groups << g.name}
|
230
239
|
@pipeline << Messages::Outgoing::Privmsg.new(message.replyto, "\2Groups:\2 #{groups.join(', ')}")
|
231
240
|
end
|
232
|
-
|
241
|
+
|
233
242
|
# message:: ModSpox::Messages::Incoming::Privmsg
|
234
243
|
# params:: Signature parameters
|
235
244
|
# Display info about given group
|
@@ -255,4 +264,28 @@ class Authenticator < ModSpox::Plugin
|
|
255
264
|
end
|
256
265
|
end
|
257
266
|
|
267
|
+
# Populates array with nicks that authenticate by nickserv
|
268
|
+
def populate_nickserv
|
269
|
+
Models::Auth.filter('services = ?', true).each do |auth|
|
270
|
+
@nickserv_nicks << auth.nick.nick.downcase
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def check_nickserv(nick)
|
275
|
+
if(@nickserv_nicks.include?(nick.nick.downcase))
|
276
|
+
if(!nick.auth.authed && !@whois_cache.include?(nick.nick.downcase))
|
277
|
+
@pipeline << Messages::Outgoing::Whois.new(nick)
|
278
|
+
@whois_cache << nick.nick.downcase
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
def check_join(message)
|
284
|
+
check_nickserv(message.nick)
|
285
|
+
end
|
286
|
+
|
287
|
+
def check_nicks(message)
|
288
|
+
message.nicks.each{|nick| check_nickserv(nick) }
|
289
|
+
end
|
290
|
+
|
258
291
|
end
|