summaryrefslogtreecommitdiff
blob: 2ee09a8383408e0e749cbf31953e75a2ebaad285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
Index: others/amazon.py
===================================================================
RCS file: /cvsroot/supybot/supybot/others/amazon.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- others/amazon.py	4 Dec 2003 01:56:50 -0000	1.5
+++ others/amazon.py	17 May 2004 14:37:44 -0000	1.6
@@ -55,8 +55,8 @@
 
 __author__ = "Mark Pilgrim (f8dy@diveintomark.org)"
 __version__ = "0.61"
-__cvsversion__ = "$Revision: 1.1 $"[11:-2]
-__date__ = "$Date: 2004/06/26 19:49:29 $"[7:-2]
+__cvsversion__ = "$Revision: 1.1 $"[11:-2]
+__date__ = "$Date: 2004/06/26 19:49:29 $"[7:-2]
 __copyright__ = "Copyright (c) 2002 Mark Pilgrim"
 __license__ = "Python"
 # Powersearch and return object type fix by Joseph Reagle <geek@goatee.net>
@@ -174,7 +174,7 @@
     return rc
 
 def buildURL(search_type, keyword, product_line, type, page, license_key):
-    url = "http://xml.amazon.com/onca/xml?v=1.0&f=xml&t=webservices-20"
+    url = "http://xml.amazon.com/onca/xml3?v=2.0&f=xml&t=webservices-20"
     url += "&dev-t=%s" % license_key.strip()
     url += "&type=%s" % type
     if page:
Index: others/babelfish.py
===================================================================
RCS file: /cvsroot/supybot/supybot/others/babelfish.py,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- others/babelfish.py	21 Aug 2003 12:25:35 -0000	1.3
+++ others/babelfish.py	9 Jun 2004 23:43:37 -0000	1.5
@@ -53,7 +53,7 @@
 BabelizerIOError
     Thrown for various networking and IO errors.
 
-Version: $Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $
+Version: $Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $
 Author: Jonathan Feinberg <jdf@pobox.com>
 """
 import re, string, urllib
@@ -66,6 +66,7 @@
 """
 __where = [ re.compile(r'lang=..>([^<]*)</div'),
             re.compile(r'name=\"q\" value=\"([^\"]*)\">'),
+            re.compile(r'div style=padding:10px;>([^<]+)</div'),
           ]
 
 __languages = { 'english'   : 'en',
@@ -142,6 +143,7 @@
     for i in range(limit):
         phrase = translate(phrase, next, flip[next])
         if seen.has_key(phrase):
+            next = flip[next]
             break
         seen[phrase] = 1
         if callback:
Index: plugins/Bugzilla.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Bugzilla.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- plugins/Bugzilla.py	6 Feb 2004 04:36:21 -0000	1.38
+++ plugins/Bugzilla.py	1 May 2004 19:53:28 -0000	1.39
@@ -34,15 +34,13 @@
 Bugzilla bug retriever
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import os
 import re
 import csv
 import getopt
-import string
 import urllib
-import urllib2
 import xml.dom.minidom as minidom
 
 from itertools import imap, ifilter
@@ -55,6 +53,7 @@
 import plugins
 import ircutils
 import privmsgs
+import webutils
 import callbacks
 import structures
 
@@ -230,18 +229,26 @@
         """Given a URL and query list for a CSV bug list, it'll return
         all the bugs in a dict
         """
-        u = urllib2.urlopen(url + '/buglist.cgi', string.join(query, '&'))
+        bugs = {}    
+        try:
+            url = '%s/buglist.cgi?%s' % (url, '&'.join(query))
+            u = webutils.getUrlFd(url)
+        except webutils.WebError, e:
+            return bugs
         # actually read in the file
         csvreader = csv.reader(u)
         # read header
         fields = csvreader.next()
         # read the rest of the list
-        bugs = {}    
         for bug in csvreader:
+            if isinstance(bug, basestring):
+                bugid = bug
+            else:
+                bugid = bug[0]
             try:
-                bugid = int(bug[0])
+                bugid = int(bugid)
             except ValueError:
-                bugid = bug[0]
+                pass
             bugs[bugid] = {}
             i = 1
             for f in fields[1:]:
@@ -278,6 +285,9 @@
         bugs = self.urlquery2bugslist(url, query)
         bugids = bugs.keys()
         bugids.sort()
+        if not bugs:
+            irc.error('I could not find any bugs.')
+            return
         s = '%s match %r (%s): %s.' % \
             (utils.nItems('bug', len(bugs)), searchstr,
              ' AND '.join(keywords), utils.commaAndify(map(str, bugids)))
@@ -373,11 +383,9 @@
 
     def _getbugxml(self, url, desc):
         try:
-            fh = urllib2.urlopen(url)
-        except urllib2.HTTPError, e:
+            bugxml = webutils.getUrl(url)
+        except webutils.WebError, e:
             raise IOError, 'Connection to %s bugzilla failed' % desc
-        bugxml = fh.read()
-        fh.close()
         if not bugxml:
             raise IOError, 'Error getting bug content from %s' % desc
         return bugxml
Index: plugins/Debian.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Debian.py,v
retrieving revision 1.53
retrieving revision 1.56
diff -u -r1.53 -r1.56
--- plugins/Debian.py	1 Apr 2004 17:09:20 -0000	1.53
+++ plugins/Debian.py	6 Jun 2004 21:18:18 -0000	1.56
@@ -33,7 +33,8 @@
 This is a module to contain Debian-specific commands.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = "James Vega (jamessan) <jamessan@users.sf.net>"
 
 import plugins
 
@@ -130,7 +131,7 @@
             glob = rest.pop()
             regexp = fnmatch.translate(glob.lstrip('/'))
             regexp = regexp.rstrip('$')
-            regexp += ".* "
+            regexp = ".*%s.* " % regexp
         try:
             re_obj = re.compile(regexp, re.I)
         except re.error, e:
@@ -138,12 +139,12 @@
             return
         if self.registryValue('pythonZgrep'):
             fd = gzip.open(self.contents)
-            r = imap(lambda tup: tup[0], 
+            r = imap(lambda tup: tup[0],
                      ifilter(lambda tup: tup[0],
                              imap(lambda line:(re_obj.search(line), line),fd)))
         else:
             try:
-                (r, w) = popen2.popen4(['zgrep', '-e', regexp, self.contents])
+                (r, w) = popen2.popen4(['zgrep', '-ie', regexp, self.contents])
                 w.close()
             except TypeError:
                 # We're on Windows.
@@ -160,7 +161,9 @@
                                    'please narrow your search.')
                     return
                 try:
-                    (filename, pkg_list) = line[:-1].split()
+                    if hasattr(line, 'group'): # we're actually using
+                        line = line.group(0)   # pythonZgrep  :(
+                    (filename, pkg_list) = line.split()
                     if filename == 'FILE':
                         # This is the last line before the actual files.
                         continue
@@ -261,7 +264,7 @@
         try:
             fd = webutils.getUrlFd('http://incoming.debian.org/')
         except webutils.WebError, e:
-            irc.error(e)
+            irc.error(str(e))
             return
         for line in fd:
             m = self._incomingRe.search(line)
@@ -300,7 +303,7 @@
             fd = webutils.getUrlFd(
                 'http://packages.debian.org/unstable/newpkg_%s' % section)
         except webutils.WebError, e:
-            irc.error(e)
+            irc.error(str(e))
         packages = []
         #self.log.warning(section)
         #self.log.warning(glob)
@@ -357,7 +360,7 @@
             irc.reply(resp)
         else:
             irc.reply('I was unable to properly parse the BTS page.')
-        
+
 Class = Debian
 
 # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
Index: plugins/Dunno.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Dunno.py,v
retrieving revision 1.19
retrieving revision 1.22
diff -u -r1.19 -r1.22
--- plugins/Dunno.py	5 Feb 2004 06:00:45 -0000	1.19
+++ plugins/Dunno.py	6 May 2004 16:33:43 -0000	1.22
@@ -34,7 +34,8 @@
 random "I dunno"-like responses.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = "Daniel DiPaolo (Strike) <ddipaolo@users.sf.net>"
 
 import os
 import time
@@ -95,17 +96,19 @@
         """
         # Must be registered to use this
         try:
-            id = ircdb.users.getUserId(msg.prefix)
+            user_id = ircdb.users.getUserId(msg.prefix)
         except KeyError:
             irc.errorNotRegistered()
             return
-        text = privmsgs.getArgs(args, required=1)
+        text = privmsgs.getArgs(args)
         cursor = self.db.cursor()
-        cursor.execute("""INSERT INTO dunnos
-                          VALUES(NULL, %s, %s, %s)""",
-                          id, int(time.time()), text)
+        at = int(time.time())
+        cursor.execute("""INSERT INTO dunnos VALUES(NULL, %s, %s, %s)""",
+                          user_id, at, text)
         self.db.commit()
-        irc.replySuccess()
+        cursor.execute("""SELECT id FROM dunnos WHERE added_at=%s""", at)
+        id = cursor.fetchone()[0]
+        irc.replySuccess('Dunno #%s added.' % id)
 
     def remove(self, irc, msg, args):
         """<id>
@@ -120,19 +123,17 @@
             return
         dunno_id = privmsgs.getArgs(args, required=1)
         cursor = self.db.cursor()
-        cursor.execute("""SELECT added_by, dunno
-                          FROM dunnos
-                          WHERE id = %s""" % dunno_id)
+        cursor.execute("""SELECT added_by, dunno FROM dunnos
+                          WHERE id=%s""", dunno_id)
         if cursor.rowcount == 0:
-            irc.error('No dunno with id: %s' % dunno_id)
+            irc.error('No dunno with id #%s.' % dunno_id)
             return
         (added_by, dunno) = cursor.fetchone()
         if not (ircdb.checkCapability(user_id, 'admin') or \
                 added_by == user_id):
-            irc.error('Only admins and the dunno creator may delete a '
-                           'dunno.')
+            irc.error('Only admins and the dunno creator may delete a dunno.')
             return
-        cursor.execute("""DELETE FROM dunnos WHERE id = %s""" % dunno_id)
+        cursor.execute("""DELETE FROM dunnos WHERE id=%s""", dunno_id)
         self.db.commit()
         irc.replySuccess()
 
@@ -145,13 +146,12 @@
         text = privmsgs.getArgs(args, required=1)
         glob = "%" + text + "%"
         cursor = self.db.cursor()
-        cursor.execute("""SELECT id FROM dunnos
-                          WHERE dunno LIKE %s""", glob)
+        cursor.execute("""SELECT id FROM dunnos WHERE dunno LIKE %s""", glob)
         if cursor.rowcount == 0:
             irc.error('No dunnos with %r found.' % text)
             return
         ids = [str(t[0]) for t in cursor.fetchall()]
-        s = 'Dunno search for %r (%s found): %s' % \
+        s = 'Dunno search for %r (%s found): %s.' % \
             (text, len(ids), utils.commaAndify(ids))
         irc.reply(s)
 
@@ -164,15 +164,15 @@
         try:
             id = int(id)
         except ValueError:
-            irc.error('%r is not a valid dunno id' % id)
+            irc.error('%r is not a valid dunno id.' % id)
             return
         cursor = self.db.cursor()
-        cursor.execute("""SELECT dunno FROM dunnos WHERE id = %s""", id)
+        cursor.execute("""SELECT dunno FROM dunnos WHERE id=%s""", id)
         if cursor.rowcount == 0:
-            irc.error('No dunno found with id #%s' % id)
+            irc.error('No dunno found with id #%s.' % id)
             return
         dunno = cursor.fetchone()[0]
-        irc.reply("Dunno #%s: %r" % (id, dunno))
+        irc.reply("Dunno #%s: %r." % (id, dunno))
 
     def change(self, irc, msg, args):
         """<id> <regexp>
@@ -184,23 +184,23 @@
         try:
             user_id = ircdb.users.getUserId(msg.prefix)
         except KeyError:
-            irc.error(msg, conf.replyNotRegistered)
+            irc.errorNotRegistered()
             return
         # Check id arg
         try:
             id = int(id)
         except ValueError:
-            irc.error(msg, '%r is not a valid dunno id' % id)
+            irc.error('%r is not a valid dunno id.' % id)
             return
         cursor = self.db.cursor()
         cursor.execute("""SELECT dunno FROM dunnos WHERE id=%s""", id)
         if cursor.rowcount == 0:
-            irc.error(msg, 'There is no dunno #%s' % id)
+            irc.error('There is no dunno #%s.' % id)
             return
         try:
             replacer = utils.perlReToReplacer(regexp)
         except:
-            irc.error(msg, '%r is not a valid regexp' % regexp)
+            irc.error('%r is not a valid regular expression.' % regexp)
             return
         dunno = cursor.fetchone()[0]
         new_dunno = replacer(dunno)
Index: plugins/Enforcer.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Enforcer.py,v
retrieving revision 1.47
retrieving revision 1.49
diff -u -r1.47 -r1.49
--- plugins/Enforcer.py	5 Apr 2004 15:57:22 -0000	1.47
+++ plugins/Enforcer.py	28 Apr 2004 06:30:55 -0000	1.49
@@ -36,7 +36,8 @@
 empty channel in order to get ops.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
 
 import plugins
 
@@ -162,8 +163,14 @@
         return False    # Default.
 
     def _revenge(self, irc, channel, hostmask):
-        irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(hostmask)))
-        irc.queueMsg(ircmsgs.kick(channel,ircutils.nickFromHostmask(hostmask)))
+        nick = ircutils.nickFromHostmask(hostmask)
+        if irc.nick != nick:
+            irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(hostmask)))
+            irc.queueMsg(ircmsgs.kick(channel, nick))
+        else:
+            # This can happen if takeRevengeOnOps is True.
+            self.log.info('Tried to take revenge on myself.  '
+                          'Are you sure you want takeRevengeOnOps to be True?')
 
     def doKick(self, irc, msg):
         channel = msg.args[0]
Index: plugins/FunDB.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/FunDB.py,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- plugins/FunDB.py	13 Apr 2004 04:08:15 -0000	1.91
+++ plugins/FunDB.py	7 Jun 2004 05:17:50 -0000	1.92
@@ -33,7 +33,7 @@
 Provides fun commands that require a database to operate.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import plugins
 
@@ -344,9 +344,10 @@
             (id, insult) = cursor.fetchone()
             nick = re.sub(r'\bme\b', msg.nick, nick)
             nick = re.sub(r'\bmy\b', '%s\'s' % msg.nick, nick)
-            insult = insult.replace('$who', nick)
+            insult = '%s: %s' % (nick, insult.replace('$who', nick))
             showid = self.registryValue('showIds', channel)
-            irc.reply(self._formatResponse(insult, id, showid), to=nick)
+            irc.reply(self._formatResponse(insult, id, showid),
+                      prefixName=False)
 
     def excuse(self, irc, msg, args):
         """[<channel>] [<id>]
Index: plugins/Http.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Http.py,v
retrieving revision 1.138
retrieving revision 1.143
diff -u -r1.138 -r1.143
--- plugins/Http.py	26 Mar 2004 00:56:31 -0000	1.138
+++ plugins/Http.py	1 May 2004 19:25:19 -0000	1.143
@@ -250,7 +252,7 @@
             s = ', or '.join(defs)
             irc.reply('%s could be %s' % (acronym, s))
 
-    _netcraftre = re.compile(r'whatos text -->(.*?)<a href="/up/acc', re.S)
+    _netcraftre = re.compile(r'td align="left">\s+<a[^>]+>(.*?)<a href', re.S)
     def netcraft(self, irc, msg, args):
         """<hostname|ip>
 
@@ -263,8 +265,9 @@
         m = self._netcraftre.search(html)
         if m:
             html = m.group(1)
-            s = utils.htmlToText(html, tagReplace='').strip('\xa0 ')
-            irc.reply(s[9:]) # Snip off "the site"
+            s = utils.htmlToText(html, tagReplace='').strip()
+            s = s.rstrip('-').strip()
+            irc.reply(s) # Snip off "the site"
         elif 'We could not get any results' in html:
             irc.reply('No results found for %s.' % hostname)
         else:
Index: plugins/Python.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Python.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- plugins/Python.py	6 Feb 2004 04:36:21 -0000	1.33
+++ plugins/Python.py	2 Jun 2004 05:16:54 -0000	1.34
@@ -34,7 +34,7 @@
 written in) somehow.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import plugins
 
@@ -48,9 +48,11 @@
 
 # Stupid printing on import...
 from cStringIO import StringIO
-sys.stdout = StringIO()
-import this
-sys.stdout = sys.__stdout__
+try:
+    sys.stdout = StringIO()
+    import this
+finally:
+    sys.stdout = sys.__stdout__
 
 import conf
 import utils
Index: plugins/Relay.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Relay.py,v
retrieving revision 1.163
retrieving revision 1.166
diff -u -r1.163 -r1.166
--- plugins/Relay.py	18 Apr 2004 00:35:54 -0000	1.163
+++ plugins/Relay.py	10 May 2004 22:17:45 -0000	1.166
@@ -33,7 +33,8 @@
 Handles relaying between networks.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
 
 import plugins
 
@@ -217,7 +218,7 @@
         Starts relaying between the channel <channel> on all networks.  If on a
         network the bot isn't in <channel>, he'll join.  This commands is
         required even if the bot is in the channel on both networks; he won't
-        relay between those channels unless he's told to oin both
+        relay between those channels unless he's told to join both
         channels.
         """
         if not self.started:
@@ -596,6 +597,8 @@
             if msg.nick == irc.nick:
                 return
             (channel, newTopic) = msg.args
+            if channel not in self.registryValue('channels'):
+                return
             network = self.abbreviations[irc]
             if self.registryValue('topicSync', channel):
                 m = ircmsgs.topic(channel, newTopic)
Index: plugins/Scheduler.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Scheduler.py,v
retrieving revision 1.17
retrieving revision 1.19
diff -u -r1.17 -r1.19
--- plugins/Scheduler.py	29 Mar 2004 16:52:42 -0000	1.17
+++ plugins/Scheduler.py	27 May 2004 16:47:05 -0000	1.19
@@ -34,7 +34,8 @@
 or repeatedly run at a particular interval.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
 
 import plugins
 
@@ -62,7 +63,7 @@
             raise callbacks.Error, callbacks.ambiguousReply(ambiguous)
         def f():
             if remove:
-                del self.events[f.eventId]
+                del self.events[str(f.eventId)]
             self.Proxy(irc.irc, msg, tokens)
         return f
 
@@ -70,7 +71,7 @@
         """<seconds> <command>
 
         Schedules the command string <command> to run <seconds> seconds in the
-        future.  For example, 'schedule add [seconds 30m] "echo [cpu]"' will
+        future.  For example, 'scheduler add [seconds 30m] "echo [cpu]"' will
         schedule the command "cpu" to be sent to the channel the schedule add
         command was given in (with no prefixed nick, a consequence of using
         echo).
Index: plugins/Services.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Services.py,v
retrieving revision 1.43
retrieving revision 1.45
diff -u -r1.43 -r1.45
--- plugins/Services.py	16 Apr 2004 07:59:47 -0000	1.43
+++ plugins/Services.py	4 Jun 2004 06:14:29 -0000	1.45
@@ -33,7 +33,7 @@
 Services: Handles management of nicks with NickServ, and ops with ChanServ.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import plugins
 
@@ -56,8 +56,8 @@
     chanserv = something('What is your ChanServ named?', default='ChanServ')
     nickserv = something('What is your NickServ named?', default='NickServ')
     conf.supybot.plugins.Services.nick.setValue(nick)
-    conf.supybot.plugins.Services.password.setValue(password)
     conf.supybot.plugins.Services.NickServ.setValue(nickserv)
+    conf.supybot.plugins.Services.NickServ.password.setValue(password)
     conf.supybot.plugins.Services.ChanServ.setValue(chanserv)
 
 class ValidNickOrEmptyString(registry.String):
@@ -66,7 +66,7 @@
             raise registry.InvalidRegistryValue, \
                   'Value must be a valid nick or the empty string.'
         registry.String.setValue(self, v)
-            
+
 conf.registerPlugin('Services')
 # Not really ChannelValues: but we can have values for each network.  We
 # should probably document that this is possible.
Index: plugins/Sourceforge.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Sourceforge.py,v
retrieving revision 1.71
retrieving revision 1.74
diff -u -r1.71 -r1.74
--- plugins/Sourceforge.py	16 Apr 2004 16:31:17 -0000	1.71
+++ plugins/Sourceforge.py	1 May 2004 21:38:49 -0000	1.74
@@ -33,6 +33,9 @@
 Accesses Sourceforge.net for various things
 """
 
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = "James Vega (jamessan) <jamessan@users.sf.net>"
+
 import re
 import sets
 import getopt
@@ -43,7 +46,6 @@
 
 import conf
 import utils
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import plugins
 import ircutils
@@ -116,7 +118,7 @@
     _statusOpt = {'any':100, 'open':1, 'closed':2, 'deleted':3, 'pending':4}
 
     _projectURL = 'http://sourceforge.net/projects/'
-    _trackerURL = 'https://sourceforge.net/support/tracker.php?aid='
+    _trackerURL = 'http://sourceforge.net/support/tracker.php?aid='
     def __init__(self):
         callbacks.PrivmsgCommandAndRegexp.__init__(self)
         self.__class__.sf = self.__class__.sourceforge
@@ -150,6 +152,8 @@
     def _getTrackerList(self, url):
         try:
             text = webutils.getUrl(url)
+            if "No matches found." in text:
+                return 'No trackers were found.'
             head = '#%s: %s'
             resp = [head % entry for entry in self._formatResp(text)]
             if resp:
Index: plugins/Words.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/Words.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- plugins/Words.py	27 Mar 2004 13:30:46 -0000	1.22
+++ plugins/Words.py	29 Apr 2004 11:52:20 -0000	1.23
@@ -33,7 +33,7 @@
 This handles interesting things to do with a dictionary (words) database.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import supybot
 import plugins
@@ -104,10 +104,13 @@
         
     def getWord(self, dbHandler):
         db = dbHandler.getDb()
-        cur = db.cursor()
-        cur.execute("""SELECT word FROM words ORDER BY random() LIMIT 1""")
-        word = cur.fetchone()[0]
-        return word.lower()
+        cursor = db.cursor()
+        cursor.execute("""SELECT word FROM words ORDER BY random() LIMIT 1""")
+        if cursor.rowcount != 0:
+            word = cursor.fetchone()[0]
+            return word.lower()
+        else:
+            raise callbacks.Error, 'My words database is currently empty.'
 
     def letterPositions(self, letter, word):
         """
Index: scripts/supybot-adduser
===================================================================
RCS file: /cvsroot/supybot/supybot/scripts/supybot-adduser,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- scripts/supybot-adduser	7 Feb 2004 23:14:58 -0000	1.8
+++ scripts/supybot-adduser	29 Apr 2004 11:05:53 -0000	1.9
@@ -44,7 +44,7 @@
     conf.supybot.log.stdout.setValue(False)
     #conf.supybot.log.level.set('DEBUG')
     
-    parser = optparse.OptionParser(usage='Usage: %prog [options] <configFile>',
+    parser = optparse.OptionParser(usage='Usage: %prog [options] <users.conf>',
                                    version='supybot %s' % conf.version)
     parser.add_option('-u', '--username', action='store', default='',
                       dest='name',
@@ -64,7 +64,7 @@
                            'this option may be given multiple times.')
     (options, args) = parser.parse_args()
     if len(args) is not 1:
-        parser.error('specify the configuration file you\'d like to use.')
+        parser.error('Specify the users.conf file you\'d like to use.')
 
     filename = os.path.abspath(args[0])
     conf.supybot.directories.log.setValue('/')
Index: src/Admin.py
===================================================================
RCS file: /cvsroot/supybot/supybot/src/Admin.py,v
retrieving revision 1.34
retrieving revision 1.38
diff -u -r1.34 -r1.38
--- src/Admin.py	16 Apr 2004 07:39:55 -0000	1.34
+++ src/Admin.py	11 May 2004 17:41:54 -0000	1.38
@@ -34,7 +34,8 @@
 caller to have the 'admin' capability.  This plugin is loaded by default.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
 
 import fix
 
@@ -53,6 +54,7 @@
 import ircmsgs
 import ircutils
 import privmsgs
+import schedule
 import callbacks
 
     
@@ -78,6 +80,20 @@
         irc.queueMsg(ircmsgs.joins(chans, keys))
     do422 = do377 = do376
         
+    def do437(self, irc, msg):
+        """Nick/channel temporarily unavailable."""
+        target = msg.args[0]
+        if ircutils.isChannel(target): # We don't care about nicks.
+            t = time.time() + 30
+            # Let's schedule a rejoin.
+            def rejoin():
+                irc.queueMsg(ircmsgs.join(target))
+                # We don't need to schedule something because we'll get another
+                # 437 when we try to join later.
+            schedule.addEvent(rejoin, t)
+            self.log.info('Scheduling a rejoin to %s at %s; '
+                          'Channel temporarily unavailable.', target, t)
+            
     def do471(self, irc, msg):
         try:
             channel = msg.args[1]
@@ -196,7 +212,10 @@
 
     def doNick(self, irc, msg):
         if msg.nick == irc.nick or msg.args[0] == irc.nick:
-            del self.pendingNickChanges[irc]
+            try:
+                del self.pendingNickChanges[irc]
+            except KeyError:
+                self.log.debug('Got NICK without Admin.nick being called.')
             
     def nick(self, irc, msg, args):
         """<nick>
Index: src/socketDrivers.py
===================================================================
RCS file: /cvsroot/supybot/supybot/src/socketDrivers.py,v
retrieving revision 1.39
retrieving revision 1.41
diff -u -r1.39 -r1.41
--- src/socketDrivers.py	12 Apr 2004 21:44:03 -0000	1.39
+++ src/socketDrivers.py	19 Apr 2004 04:36:26 -0000	1.41
@@ -35,7 +35,7 @@
 
 from __future__ import division
 
-__revision__ ="$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ ="$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import fix
 
@@ -141,7 +141,8 @@
         self.irc.reset()
         self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         # We allow more time for the connect here, since it might take longer.
-        self.conn.settimeout(conf.supybot.drivers.poll()*10)
+        # At least 10 seconds.
+        self.conn.settimeout(max(10, conf.supybot.drivers.poll()*10))
         if self.reconnectWaitsIndex < len(self.reconnectWaits)-1:
             self.reconnectWaitsIndex += 1
         try:
Index: plugins/URL.py
===================================================================
RCS file: /cvsroot/supybot/supybot/plugins/URL.py,v
retrieving revision 1.35
retrieving revision 1.39
diff -u -r1.35 -r1.39
--- plugins/URL.py	27 Feb 2004 17:20:57 -0000	1.35
+++ plugins/URL.py	7 Jun 2004 19:45:49 -0000	1.39
@@ -35,7 +35,7 @@
 URLs in the database.
 """
 
-__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
+__revision__ = "$Id: supybot-0.77.2-cvsadditions-2004-06-10.patch,v 1.1 2004/06/26 19:49:29 liquidx Exp $"
 
 import plugins
 
@@ -171,8 +171,11 @@
         if not ircutils.isChannel(msg.args[0]):
             return
         channel = msg.args[0]
+        r = self.registryValue('nonSnarfingRegexp', channel)
         if self.registryValue('tinyurlSnarfer', channel):
             url = match.group(0)
+            if r and r.search(url):
+                return
             minlen = self.registryValue('tinyurlSnarfer.minimumLength',channel)
             if len(url) >= minlen:
                 db = self.getDb(channel)
@@ -195,10 +198,15 @@
         if callbacks.addressed(irc.nick, msg):
             return
         channel = msg.args[0]
+        r = self.registryValue('nonSnarfingRegexp', channel)
+        #self.log.warning('Title: %r' % r)
         if self.registryValue('titleSnarfer', channel):
             url = match.group(0)
+            if r and r.search(url):
+                return
             try:
-                text = webutils.getUrl(url, size=conf.supybot.httpPeekSize())
+                size = conf.supybot.httpPeekSize()
+                text = webutils.getUrl(url, size=size)
             except webutils.WebError, e:
                 self.log.info('Couldn\'t snarf title of %s, %s.', url, e)
                 return
@@ -221,7 +229,7 @@
                           WHERE tinyurl=%s""", id, tinyurl)
         db.commit()
 
-    _tinyRe = re.compile(r'(http://tinyurl\.com/\w+)</blockquote>')
+    _tinyRe = re.compile(r'<blockquote><b>(http://tinyurl\.com/\w+)</b>')
     def _getTinyUrl(self, url, channel, cmd=False):
         db = self.getDb(channel)
         cursor = db.cursor()
@@ -279,14 +287,14 @@
         Returns a TinyURL.com version of <url>
         """
         url = privmsgs.getArgs(args)
-        if len(url) < 24:
-            irc.error(
-                      'Stop being a lazy-biotch and type the URL yourself.')
+        if len(url) < 20:
+            irc.error('Stop being a lazy-biotch and type the URL yourself.')
             return
         channel = msg.args[0]
         snarf = self.registryValue('tinyurlSnarfer', channel)
         minlen = self.registryValue('tinyurlSnarfer.minimumLength', channel)
-        if snarf and len(url) >= minlen:
+        r = self.registryValue('nonSnarfingRegexp', channel)
+        if snarf and len(url) >= minlen and not r.search(url):
             return
         (tinyurl, updateDb) = self._getTinyUrl(url, channel, cmd=True)
         if tinyurl:
@@ -309,8 +317,9 @@
         cursor = db.cursor()
         cursor.execute("""SELECT COUNT(*) FROM urls""")
         (count,) = cursor.fetchone()
+        count = int(count)
         irc.reply('I have %s %s in my database.' %
-                  (count, int(count) == 1 and 'URL' or 'URLs'))
+                  (count, count == 1 and 'URL' or 'URLs'))
 
     def last(self, irc, msg, args):
         """[<channel>] [--{from,with,at,proto,near}=<value>] --{nolimit,fancy}