Permalink
Browse files

Added server password stuff from Javier.

  • Loading branch information...
1 parent 5d48dd8 commit 22aed08fae3cdccd2e77b5515808f770811b88cc Sean B. Palmer committed Jan 13, 2010
Showing with 15 additions and 8 deletions.
  1. +2 −1 bot.py
  2. +4 −1 irc.py
  3. +1 −1 modules/head.py
  4. +1 −1 modules/info.py
  5. +1 −1 opt/freenode.py
  6. +6 −3 phenny
View
@@ -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 = {}
View
@@ -25,14 +25,15 @@ def __init__(self, bot, source, args):
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 = ''
self.nick = nick
self.user = nick
self.name = name
+ self.password = password
self.verbose = True
self.channels = channels or []
@@ -79,6 +80,8 @@ def initiate_connect(self, host, port):
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)
View
@@ -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:
View
@@ -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
View
@@ -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',
View
@@ -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)

0 comments on commit 22aed08

Please sign in to comment.