summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean B. Palmer <http://inamidst.com/sbp/>2010-01-13 13:11:32 +0000
committerSean B. Palmer <http://inamidst.com/sbp/>2010-01-13 13:11:32 +0000
commit22aed08fae3cdccd2e77b5515808f770811b88cc (patch)
tree56783c28d087fecf7e8387965f00d78a18428f54
parent5d48dd8ca7a317daf772d0627f0843d315c49876 (diff)
downloadbot-22aed08fae3cdccd2e77b5515808f770811b88cc.tar.gz
bot-22aed08fae3cdccd2e77b5515808f770811b88cc.tar.bz2
bot-22aed08fae3cdccd2e77b5515808f770811b88cc.zip
Added server password stuff from Javier.
-rwxr-xr-xbot.py3
-rwxr-xr-xirc.py5
-rwxr-xr-xmodules/head.py2
-rwxr-xr-xmodules/info.py2
-rwxr-xr-xopt/freenode.py2
-rwxr-xr-xphenny9
6 files changed, 15 insertions, 8 deletions
diff --git a/bot.py b/bot.py
index 3564712..1bd559f 100755
--- a/bot.py
+++ b/bot.py
@@ -22,7 +22,8 @@ def decode(bytes):
class Phenny(irc.Bot):
def __init__(self, config):
- irc.Bot.__init__(self, config.nick, config.name, config.channels)
+ args = (config.nick, config.name, config.channels, config.password)
+ irc.Bot.__init__(self, *args)
self.config = config
self.doc = {}
self.stats = {}
diff --git a/irc.py b/irc.py
index 281f5db..a16c61b 100755
--- a/irc.py
+++ b/irc.py
@@ -25,7 +25,7 @@ class Origin(object):
self.sender = mappings.get(target, target)
class Bot(asynchat.async_chat):
- def __init__(self, nick, name, channels):
+ def __init__(self, nick, name, channels, password=None):
asynchat.async_chat.__init__(self)
self.set_terminator('\n')
self.buffer = ''
@@ -33,6 +33,7 @@ class Bot(asynchat.async_chat):
self.nick = nick
self.user = nick
self.name = name
+ self.password = password
self.verbose = True
self.channels = channels or []
@@ -79,6 +80,8 @@ class Bot(asynchat.async_chat):
def handle_connect(self):
if self.verbose:
print >> sys.stderr, 'connected!'
+ if self.password:
+ self.write(('PASS', self.password))
self.write(('NICK', self.nick))
self.write(('USER', self.user, '+iw', self.nick), self.name)
diff --git a/modules/head.py b/modules/head.py
index 274e1b0..231ffdb 100755
--- a/modules/head.py
+++ b/modules/head.py
@@ -113,7 +113,7 @@ def f_title(self, origin, match, args):
return
u = urllib2.urlopen(req)
- bytes = u.read(32768)
+ bytes = u.read(262144)
u.close()
except IOError:
diff --git a/modules/info.py b/modules/info.py
index c3d13ef..dbf2d44 100755
--- a/modules/info.py
+++ b/modules/info.py
@@ -47,7 +47,7 @@ def stats(phenny, input):
channels = {}
ignore = set(['f_note', 'startup', 'message', 'noteuri'])
- for (name, user), count in phenny.stats.iteritems():
+ for (name, user), count in phenny.stats.items():
if name in ignore: continue
if not user: continue
diff --git a/opt/freenode.py b/opt/freenode.py
index 8c1fbd4..0c08cf2 100755
--- a/opt/freenode.py
+++ b/opt/freenode.py
@@ -14,7 +14,7 @@ def replaced(phenny, input):
'pc': '.pc has been replaced by .u',
'unicode': '.unicode has been replaced by .u',
'compare': '.compare has been replaced by .gcs (googlecounts)',
- 'map': 'the .map command has been removed; ask sbp for details',
+ # 'map': 'the .map command has been removed; ask sbp for details',
'acronym': 'the .acronym command has been removed; ask sbp for details',
# 'img': 'the .img command has been removed; ask sbp for details',
'v': '.v has been replaced by .val',
diff --git a/phenny b/phenny
index dc36d12..5fb7d7e 100755
--- a/phenny
+++ b/phenny
@@ -30,8 +30,7 @@ def create_default_config(fn):
channels = ['#example', '#test']
owner = 'yournickname'
- # This isn't implemented yet:
- # serverpass = 'yourserverpassword'
+ # password = 'yourserverpassword'
# These are people who will be able to use admin.py's functions...
admins = [owner, 'someoneyoutrust']
@@ -43,7 +42,8 @@ def create_default_config(fn):
#
# enable = []
- # Directories to load opt modules from
+ # Directories to load user modules from
+ # e.g. /path/to/my/modules
extra = []
# Services to load: maps channel names to white or black lists
@@ -135,6 +135,9 @@ def main(argv=None):
if not hasattr(module, 'port'):
module.port = 6667
+ if not hasattr(module, 'password'):
+ module.password = None
+
if module.host == 'irc.example.net':
error = ('Error: you must edit the config file first!\n' +
"You're currently using %s" % module.filename)