cinch 1.1.3 → 2.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -0
- data/README.md +3 -3
- data/docs/bot_options.md +435 -0
- data/docs/changes.md +440 -0
- data/docs/common_mistakes.md +35 -0
- data/docs/common_tasks.md +47 -0
- data/docs/encodings.md +67 -0
- data/docs/events.md +272 -0
- data/docs/logging.md +5 -0
- data/docs/migrating.md +267 -0
- data/docs/readme.md +18 -0
- data/examples/plugins/custom_prefix.rb +1 -1
- data/examples/plugins/dice_roll.rb +38 -0
- data/examples/plugins/lambdas.rb +1 -1
- data/examples/plugins/memo.rb +16 -10
- data/examples/plugins/url_shorten.rb +1 -0
- data/lib/cinch.rb +5 -60
- data/lib/cinch/ban.rb +13 -7
- data/lib/cinch/bot.rb +228 -403
- data/lib/cinch/{cache_manager.rb → cached_list.rb} +5 -1
- data/lib/cinch/callback.rb +3 -0
- data/lib/cinch/channel.rb +119 -195
- data/lib/cinch/{channel_manager.rb → channel_list.rb} +6 -3
- data/lib/cinch/configuration.rb +73 -0
- data/lib/cinch/configuration/bot.rb +47 -0
- data/lib/cinch/configuration/dcc.rb +16 -0
- data/lib/cinch/configuration/plugins.rb +41 -0
- data/lib/cinch/configuration/sasl.rb +17 -0
- data/lib/cinch/configuration/ssl.rb +19 -0
- data/lib/cinch/configuration/storage.rb +37 -0
- data/lib/cinch/configuration/timeouts.rb +14 -0
- data/lib/cinch/constants.rb +531 -369
- data/lib/cinch/dcc.rb +12 -0
- data/lib/cinch/dcc/dccable_object.rb +37 -0
- data/lib/cinch/dcc/incoming.rb +1 -0
- data/lib/cinch/dcc/incoming/send.rb +131 -0
- data/lib/cinch/dcc/outgoing.rb +1 -0
- data/lib/cinch/dcc/outgoing/send.rb +115 -0
- data/lib/cinch/exceptions.rb +8 -1
- data/lib/cinch/formatting.rb +106 -0
- data/lib/cinch/handler.rb +104 -0
- data/lib/cinch/handler_list.rb +86 -0
- data/lib/cinch/helpers.rb +167 -10
- data/lib/cinch/irc.rb +525 -110
- data/lib/cinch/isupport.rb +11 -9
- data/lib/cinch/logger.rb +168 -0
- data/lib/cinch/logger/formatted_logger.rb +72 -55
- data/lib/cinch/logger/zcbot_logger.rb +9 -24
- data/lib/cinch/logger_list.rb +62 -0
- data/lib/cinch/mask.rb +19 -10
- data/lib/cinch/message.rb +94 -28
- data/lib/cinch/message_queue.rb +70 -28
- data/lib/cinch/mode_parser.rb +6 -1
- data/lib/cinch/network.rb +104 -0
- data/lib/cinch/{rubyext/queue.rb → open_ended_queue.rb} +8 -1
- data/lib/cinch/pattern.rb +24 -4
- data/lib/cinch/plugin.rb +352 -177
- data/lib/cinch/plugin_list.rb +35 -0
- data/lib/cinch/rubyext/float.rb +3 -0
- data/lib/cinch/rubyext/module.rb +7 -0
- data/lib/cinch/rubyext/string.rb +9 -0
- data/lib/cinch/sasl.rb +34 -0
- data/lib/cinch/sasl/dh_blowfish.rb +71 -0
- data/lib/cinch/sasl/diffie_hellman.rb +47 -0
- data/lib/cinch/sasl/mechanism.rb +6 -0
- data/lib/cinch/sasl/plain.rb +26 -0
- data/lib/cinch/storage.rb +62 -0
- data/lib/cinch/storage/null.rb +12 -0
- data/lib/cinch/storage/yaml.rb +96 -0
- data/lib/cinch/syncable.rb +13 -1
- data/lib/cinch/target.rb +144 -0
- data/lib/cinch/timer.rb +145 -0
- data/lib/cinch/user.rb +169 -225
- data/lib/cinch/{user_manager.rb → user_list.rb} +7 -2
- data/lib/cinch/utilities/deprecation.rb +12 -0
- data/lib/cinch/utilities/encoding.rb +54 -0
- data/lib/cinch/utilities/kernel.rb +13 -0
- data/lib/cinch/utilities/string.rb +13 -0
- data/lib/cinch/version.rb +4 -0
- metadata +88 -47
- data/lib/cinch/logger/logger.rb +0 -44
- data/lib/cinch/logger/null_logger.rb +0 -18
- data/lib/cinch/rubyext/infinity.rb +0 -1
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -60,7 +60,7 @@ Features
|
|
60
60
|
### Documentation
|
61
61
|
|
62
62
|
Cinch provides a documented API, which is online for your viewing pleasure
|
63
|
-
[here](http://rubydoc.info/
|
63
|
+
[here](http://rubydoc.info/gems/cinch/frames).
|
64
64
|
|
65
65
|
### Object Oriented
|
66
66
|
|
@@ -147,8 +147,7 @@ messages:
|
|
147
147
|
Authors
|
148
148
|
-------
|
149
149
|
|
150
|
-
* [
|
151
|
-
* [Dominik Honnef](http://fork-bomb.org)
|
150
|
+
* [Dominik Honnef](http://dominik.honnef.co)
|
152
151
|
|
153
152
|
Contribute
|
154
153
|
----------
|
@@ -171,3 +170,4 @@ to check it out.
|
|
171
170
|
discussing design decisions etc)
|
172
171
|
- Emil Loer (http://github.com/thedjinn) for improving the handling of
|
173
172
|
unexpected disconnects and reconnects.
|
173
|
+
- Check the list of authors for smaller contributions
|
data/docs/bot_options.md
ADDED
@@ -0,0 +1,435 @@
|
|
1
|
+
# @title Bot options
|
2
|
+
|
3
|
+
# Options
|
4
|
+
Note: This page describes options of Cinch. It does not describe how
|
5
|
+
to set options specific to plugins.
|
6
|
+
|
7
|
+
## channels
|
8
|
+
Type
|
9
|
+
: Array<String>
|
10
|
+
|
11
|
+
Default value
|
12
|
+
: `[]`
|
13
|
+
|
14
|
+
Description
|
15
|
+
: Channels in this list will be joined upon connecting.
|
16
|
+
|
17
|
+
|
18
|
+
### Notes
|
19
|
+
- To automatically join password-protected channels, just append the
|
20
|
+
password to the channel's name, separated by a space, e.g.
|
21
|
+
`"#mychannel mypassword"`.
|
22
|
+
|
23
|
+
## dcc
|
24
|
+
|
25
|
+
### dcc.own_ip
|
26
|
+
Type
|
27
|
+
: String
|
28
|
+
|
29
|
+
Default value
|
30
|
+
: `nil`
|
31
|
+
|
32
|
+
Description
|
33
|
+
: The external IP which should be used for outgoing DCC SENDs. For
|
34
|
+
more information see {Cinch::DCC::Outgoing::Send}.
|
35
|
+
|
36
|
+
## delay_joins
|
37
|
+
Type
|
38
|
+
: Number, Symbol
|
39
|
+
|
40
|
+
Default value
|
41
|
+
: `0`
|
42
|
+
|
43
|
+
Description
|
44
|
+
: Delay joining channels N seconds after connecting, or until the event S fires.
|
45
|
+
|
46
|
+
### Notes
|
47
|
+
- This is especially useful in combination with the /cinch-identify/ plugin, which will trigger the `:identified` event.
|
48
|
+
|
49
|
+
## encoding
|
50
|
+
Type
|
51
|
+
: String, Encoding
|
52
|
+
|
53
|
+
Default value
|
54
|
+
: `:irc`
|
55
|
+
|
56
|
+
Description
|
57
|
+
: This determines which encoding text received from IRC will have.
|
58
|
+
|
59
|
+
|
60
|
+
### Notes
|
61
|
+
- {file:encodings.md More information on how Cinch handles encoding issues}
|
62
|
+
|
63
|
+
## local_host
|
64
|
+
Type
|
65
|
+
: String
|
66
|
+
|
67
|
+
Default value
|
68
|
+
: `nil`
|
69
|
+
|
70
|
+
Description
|
71
|
+
: Which IP/host to bind to when connecting. This is useful for using
|
72
|
+
so called "vhosts".
|
73
|
+
|
74
|
+
## max_messages
|
75
|
+
Type
|
76
|
+
: Fixnum
|
77
|
+
|
78
|
+
Default value
|
79
|
+
: `nil`
|
80
|
+
|
81
|
+
Description
|
82
|
+
: When an overlong message gets split, only `max_messages` parts will
|
83
|
+
be sent to the recipient.
|
84
|
+
|
85
|
+
|
86
|
+
### Notes
|
87
|
+
- Set this option to `nil` to disable any limit.
|
88
|
+
|
89
|
+
## max_reconnect_delay
|
90
|
+
Type
|
91
|
+
: Fixnum
|
92
|
+
|
93
|
+
Default value
|
94
|
+
: `300`
|
95
|
+
|
96
|
+
Descriptipn
|
97
|
+
: With every unsuccessful reconnection attempt, Cinch increases the
|
98
|
+
delay between new attempts. This setting is the maximum number of
|
99
|
+
seconds to wait between two attempts.
|
100
|
+
|
101
|
+
## messages_per_second
|
102
|
+
Type
|
103
|
+
: Float
|
104
|
+
|
105
|
+
Default value
|
106
|
+
: Network dependent
|
107
|
+
|
108
|
+
Description
|
109
|
+
: How many incoming messages the server processes per second. This is
|
110
|
+
used for throttling.
|
111
|
+
|
112
|
+
|
113
|
+
### Notes
|
114
|
+
- If your bot gets kicked for excess flood, try lowering the value of
|
115
|
+
`messages_per_second`.
|
116
|
+
- See also: {file:bot_options.md#serverqueuesize `server_queue_size`}
|
117
|
+
|
118
|
+
## message_split_end
|
119
|
+
Type
|
120
|
+
: String
|
121
|
+
|
122
|
+
Default value
|
123
|
+
: `" ..."`
|
124
|
+
|
125
|
+
Description
|
126
|
+
: When a message is too long to be sent as a whole, it will be split
|
127
|
+
and the value of this option will be appended to all but the last
|
128
|
+
parts of the message.
|
129
|
+
|
130
|
+
|
131
|
+
## message_split_start
|
132
|
+
Type
|
133
|
+
: String
|
134
|
+
|
135
|
+
Default value
|
136
|
+
: `"... "`
|
137
|
+
|
138
|
+
Description
|
139
|
+
: When a message is too long to be sent as a whole, it will be split
|
140
|
+
and the value of this option will be prepended to all but the first
|
141
|
+
parts of the message.
|
142
|
+
|
143
|
+
## modes
|
144
|
+
Type
|
145
|
+
: Array<String>
|
146
|
+
|
147
|
+
Default value
|
148
|
+
: []
|
149
|
+
|
150
|
+
Description
|
151
|
+
: An array of modes the bot should set on itself after connecting.
|
152
|
+
|
153
|
+
## nick
|
154
|
+
Type
|
155
|
+
: String
|
156
|
+
|
157
|
+
Default value
|
158
|
+
: `"cinch"`
|
159
|
+
|
160
|
+
Description
|
161
|
+
: The nickname the bot will use.
|
162
|
+
|
163
|
+
|
164
|
+
### Notes
|
165
|
+
- If the nickname is in use, Cinch will append underscores until it
|
166
|
+
finds a free nick.
|
167
|
+
- You really should set this option instead of using the default.
|
168
|
+
|
169
|
+
## nicks
|
170
|
+
Type
|
171
|
+
: Array<String>
|
172
|
+
|
173
|
+
Default value
|
174
|
+
: `nil`
|
175
|
+
|
176
|
+
Description
|
177
|
+
: This option overrules {file:bot_options.md#nick `nick`} and allows Cinch
|
178
|
+
to try multiple nicks before adding underscores.
|
179
|
+
|
180
|
+
|
181
|
+
## password
|
182
|
+
Type
|
183
|
+
: String
|
184
|
+
|
185
|
+
Default value
|
186
|
+
: `nil`
|
187
|
+
|
188
|
+
Description
|
189
|
+
: A server password for access to private servers.
|
190
|
+
|
191
|
+
|
192
|
+
### Notes
|
193
|
+
- Some networks allow you to use the server password for
|
194
|
+
authenticating with services (e.g. NickServ).
|
195
|
+
|
196
|
+
|
197
|
+
## ping_interval
|
198
|
+
Type
|
199
|
+
: Number
|
200
|
+
|
201
|
+
Default value
|
202
|
+
: `120`
|
203
|
+
|
204
|
+
Description
|
205
|
+
: The server will be pinged every X seconds, to keep the connection
|
206
|
+
alive.
|
207
|
+
|
208
|
+
|
209
|
+
### Notes
|
210
|
+
- The ping interval should be smaller than
|
211
|
+
{file:bot_options.md#timeoutsread `timeouts.read`} to prevent Cinch from
|
212
|
+
falsely declaring a connection dead.
|
213
|
+
|
214
|
+
|
215
|
+
## plugins
|
216
|
+
|
217
|
+
### plugins.plugins
|
218
|
+
Type
|
219
|
+
: Array<Class>
|
220
|
+
|
221
|
+
Default value
|
222
|
+
: `[]`
|
223
|
+
|
224
|
+
Description
|
225
|
+
: A list of plugins to register.
|
226
|
+
|
227
|
+
|
228
|
+
#### Notes
|
229
|
+
- An example: `[Plugin1, Plugin2, Plugin3]` -- Note that we are adding
|
230
|
+
the plugin **classes** to the list.
|
231
|
+
|
232
|
+
### plugins.prefix
|
233
|
+
Type
|
234
|
+
: String, Regexp, Lambda
|
235
|
+
|
236
|
+
Default value
|
237
|
+
: `/^!/`
|
238
|
+
|
239
|
+
Description
|
240
|
+
: A prefix that will be prepended to all plugin commands.
|
241
|
+
|
242
|
+
|
243
|
+
### plugins.suffix
|
244
|
+
Type
|
245
|
+
: String, Regexp, Lambda
|
246
|
+
|
247
|
+
Default value
|
248
|
+
: `nil`
|
249
|
+
|
250
|
+
Description
|
251
|
+
: A suffix that will be appended to all plugin commands.
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
### plugins.options
|
256
|
+
Type
|
257
|
+
: Hash
|
258
|
+
|
259
|
+
Default value
|
260
|
+
: `Hash.new {|h,k| h[k] = {}}`
|
261
|
+
|
262
|
+
Description
|
263
|
+
: Options specific to plugins.
|
264
|
+
|
265
|
+
|
266
|
+
#### Notes
|
267
|
+
- Information on plugins and options for those will be made available
|
268
|
+
in a separate document soon.
|
269
|
+
|
270
|
+
|
271
|
+
## port
|
272
|
+
Type
|
273
|
+
: Fixnum
|
274
|
+
|
275
|
+
Default value
|
276
|
+
: `6667`
|
277
|
+
|
278
|
+
Description
|
279
|
+
: The port the IRC server is listening on
|
280
|
+
|
281
|
+
|
282
|
+
## realname
|
283
|
+
Type
|
284
|
+
: String
|
285
|
+
|
286
|
+
Default value
|
287
|
+
: `"cinch"`
|
288
|
+
|
289
|
+
Description
|
290
|
+
: The real name Cinch will connect with.
|
291
|
+
|
292
|
+
## reconnect
|
293
|
+
Type
|
294
|
+
: Boolean
|
295
|
+
|
296
|
+
Default value
|
297
|
+
: `true`
|
298
|
+
|
299
|
+
Description
|
300
|
+
: Should Cinch attempt to reconnect after a connection loss?
|
301
|
+
|
302
|
+
## sasl
|
303
|
+
|
304
|
+
### sasl.username
|
305
|
+
Type
|
306
|
+
: String
|
307
|
+
|
308
|
+
Default value
|
309
|
+
: `nil`
|
310
|
+
|
311
|
+
Description
|
312
|
+
: The username to use for SASL authentication.
|
313
|
+
|
314
|
+
### sasl.password
|
315
|
+
Type
|
316
|
+
: String
|
317
|
+
|
318
|
+
Default value
|
319
|
+
: `nil`
|
320
|
+
|
321
|
+
Description
|
322
|
+
: The password to use for SASL authentication.
|
323
|
+
|
324
|
+
## server
|
325
|
+
Type
|
326
|
+
: String
|
327
|
+
|
328
|
+
Default value
|
329
|
+
: `"localhost"`
|
330
|
+
|
331
|
+
Description
|
332
|
+
: The IRC server to connect to
|
333
|
+
|
334
|
+
|
335
|
+
## server_queue_size
|
336
|
+
Type
|
337
|
+
: Fixnum
|
338
|
+
|
339
|
+
Default value
|
340
|
+
: Network dependent
|
341
|
+
|
342
|
+
Description
|
343
|
+
: The number of incoming messages the server will queue, before
|
344
|
+
killing the bot for excess flood.
|
345
|
+
|
346
|
+
|
347
|
+
### Notes
|
348
|
+
- If your bot gets kicked for excess flood, try lowering the value of
|
349
|
+
`server_queue_size`.
|
350
|
+
- See also: {file:bot_options.md#messagespersecond `messages_per_second`}
|
351
|
+
|
352
|
+
## ssl
|
353
|
+
|
354
|
+
### ssl.use
|
355
|
+
Type
|
356
|
+
: Boolean
|
357
|
+
|
358
|
+
Default value
|
359
|
+
: `false`
|
360
|
+
|
361
|
+
Description
|
362
|
+
: Sets if SSL should be used
|
363
|
+
|
364
|
+
### ssl.verify
|
365
|
+
Type
|
366
|
+
: Boolean
|
367
|
+
|
368
|
+
Default value
|
369
|
+
: `false`
|
370
|
+
|
371
|
+
Description
|
372
|
+
: Sets if the SSL certificate should be verified
|
373
|
+
|
374
|
+
|
375
|
+
### ssl.ca_path
|
376
|
+
Type
|
377
|
+
: String
|
378
|
+
|
379
|
+
Default value
|
380
|
+
: `"/etc/ssl/certs"`
|
381
|
+
|
382
|
+
Description
|
383
|
+
: The path to a directory with certificates. This has to be set
|
384
|
+
properly for {file:bot_options.md#sslverify `ssl.verify`} to work.
|
385
|
+
|
386
|
+
|
387
|
+
### ssl.client_cert
|
388
|
+
Type
|
389
|
+
: String
|
390
|
+
|
391
|
+
Default value
|
392
|
+
: `nil`
|
393
|
+
|
394
|
+
Description
|
395
|
+
: The path to a client certificate, which some networks can use for
|
396
|
+
authentication (see {http://www.oftc.net/oftc/NickServ/CertFP})
|
397
|
+
|
398
|
+
|
399
|
+
#### Notes
|
400
|
+
- You will want to set the correct port when using SSL
|
401
|
+
|
402
|
+
## user
|
403
|
+
Type
|
404
|
+
: String
|
405
|
+
|
406
|
+
Default value
|
407
|
+
: `"cinch"`
|
408
|
+
|
409
|
+
Description
|
410
|
+
: The user name to use when connecting to the IRC server.
|
411
|
+
|
412
|
+
## timeouts
|
413
|
+
|
414
|
+
### timeouts.read
|
415
|
+
Type
|
416
|
+
: Number
|
417
|
+
|
418
|
+
Default value
|
419
|
+
: `240`
|
420
|
+
|
421
|
+
Description
|
422
|
+
: If no data has been received for this amount of seconds, the
|
423
|
+
connection will be considered dead.
|
424
|
+
|
425
|
+
|
426
|
+
### timeouts.connect
|
427
|
+
Type
|
428
|
+
: Number
|
429
|
+
|
430
|
+
Default value
|
431
|
+
: `10`
|
432
|
+
|
433
|
+
Description
|
434
|
+
: Give up connecting after his amount of seconds.
|
435
|
+
|