Permalink
Browse files

Merge upstream

  • Loading branch information...
1 parent 1f20af0 commit 539cd3b6cc8911b826752b26fdb9b1250b7b713f @ChristopherMacGown ChristopherMacGown committed Oct 24, 2012
Showing with 18 additions and 19 deletions.
  1. +1 −0 AUTHORS
  2. +12 −15 pyhole/irc.py
  3. +2 −3 pyhole/plugins/admin.py
  4. +2 −0 pyhole/utils.py
  5. +1 −1 pyhole/version.py
View
1 AUTHORS
@@ -1,5 +1,6 @@
Andrew Kraut <akraut@gmail.com>
Chris Behrens <cbehrens@codestud.com>
+Christopher MacGown <ignoti+github@gmail.com>
Johannes Erdfelt <johannes@erdfelt.com>
John Dickinson <me@not.mn>
Josh Kearney <josh@jk0.org>
View
27 pyhole/irc.py
@@ -52,23 +52,23 @@ def __init__(self, network):
self.rejoin_delay = CONFIG.get("rejoin_delay", type="int")
self.server = network_config.get("server")
- self.password = network_config.get("password", default="")
+ self.password = network_config.get("password", default=None)
self.port = network_config.get("port", type="int", default=6667)
self.ssl = network_config.get("ssl", type="bool", default=False)
self.ipv6 = network_config.get("ipv6", type="bool", default=False)
- self.bind_to = network_config.get("bind_to", default="")
+ self.bind_to = network_config.get("bind_to", default=None)
self.nick = network_config.get("nick")
self.username = network_config.get("username", default=None)
self.identify_password = network_config.get("identify_password",
- default="")
+ default=None)
self.channels = network_config.get("channels", type="list")
self.load_plugins()
self.log.info("Connecting to %s:%d as %s" % (self.server, self.port,
self.nick))
self.connect(self.server, self.port, self.nick, self.password,
- ssl=self.ssl, ipv6=self.ipv6, localaddress=self.bind_to,
+ ssl=self.ssl, ipv6=self.ipv6, localaddress=self.bind_to,
username=self.username)
def load_pollers(self, reload_pollers=False):
@@ -106,7 +106,7 @@ def run_hook_command(self, mod_name, func, arg, **kwargs):
self.log.debug("Calling: %s.%s(None)" % (mod_name,
func.__name__))
except Exception, exc:
- self.log.error(exc)
+ self.log.exception(exc)
def run_msg_regexp_hooks(self, message, private):
"""Run regexp hooks."""
@@ -168,16 +168,16 @@ def poll_messages(self, message, private=False):
self.run_keyword_hooks(message, private)
self.run_msg_regexp_hooks(message, private)
-
- def __mangle_msg(self, msg):
+ def _mangle_msg(self, msg):
+ """Prepare the message for sending."""
if not hasattr(msg, "encode"):
try:
msg = str(msg)
except Exception:
self.log.error("msg cannot be converted to string")
msg = msg.encode("utf-8").split("\n")
- # 10 is completely arbitrary for now
+ # NOTE(jk0): 10 is completely arbitrary for now.
if len(msg) > 10:
msg = msg[0:8]
msg.append("...")
@@ -186,9 +186,7 @@ def __mangle_msg(self, msg):
def notice(self, msg):
"""Send a notice."""
-
- msg = self.__mangle_msg(msg)
-
+ msg = self._mangle_msg(msg)
for line in msg:
self.connection.notice(self.target, line)
if irclib.is_channel(self.target):
@@ -198,8 +196,7 @@ def notice(self, msg):
def reply(self, msg):
"""Send a privmsg."""
-
- msg = self.__mangle_msg(msg)
+ msg = self._mangle_msg(msg)
for line in msg:
if self.addressed:
source = self.source.split("!")[0]
@@ -297,7 +294,7 @@ def on_disconnect(self, _connection, _event):
self.log.info("Connecting to %s:%d as %s" % (self.server, self.port,
self.nick))
self.connect(self.server, self.port, self.nick, self.password,
- ssl=self.ssl, username=self.username)
+ ssl=self.ssl, username=self.username)
def on_kick(self, connection, event):
"""Automatically rejoin channel if kicked."""
@@ -469,7 +466,7 @@ def main():
procs.remove(proc)
if not procs:
- LOG.info("No longer connected to any networks, exiting")
+ LOG.info("No longer connected to any networks, shutting down")
sys.exit(0)
except KeyboardInterrupt:
View
5 pyhole/plugins/admin.py
@@ -99,9 +99,8 @@ def part(self, params=None, **kwargs):
@plugin.hook_add_command("quit")
@utils.admin
def quit(self, params=None, **kwargs):
- """Quit a network entirely."""
-
- self.irc.log.info("Disconnecting.")
+ """Quit all networks and shut down."""
+ self.irc.log.info("Disconnecting")
sys.exit(0)
@plugin.hook_add_command("say")
View
2 pyhole/utils.py
@@ -173,6 +173,7 @@ def generate_config():
[FreeNode]
server: verne.freenode.net
+username:
password:
port: 7000
ssl: True
@@ -184,6 +185,7 @@ def generate_config():
[EFnet]
server: irc.efnet.net
+username:
password:
port: 6667
ssl: False
View
2 pyhole/version.py
@@ -20,7 +20,7 @@
import sys
-__VERSION__ = "0.6.4"
+__VERSION__ = "0.6.5"
def current_git_hash():

0 comments on commit 539cd3b

Please sign in to comment.