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
|
Description: Use python-irc instead of python-irclib
python-irc is not listed in install_requires because right now
pkg_resources.get_distribution('irc').version will give something
like '0.0.08.3.1'
Author: Daniele Tricoli <eriol@mornie.org>
Last-Update: 2013-11-23
--- a/cobe/irc.py
+++ b/cobe/irc.py
@@ -1,16 +1,18 @@
# Copyright (C) 2010 Peter Teichman
-import irclib
+from __future__ import absolute_import
+
+import irc.client
import logging
import re
log = logging.getLogger("cobe.irc")
-class Bot(irclib.SimpleIRCClient):
+class Bot(irc.client.SimpleIRCClient):
def __init__(self, brain, nick, channel, log_channel, ignored_nicks,
only_nicks):
- irclib.SimpleIRCClient.__init__(self)
+ irc.client.SimpleIRCClient.__init__(self)
self.brain = brain
self.nick = nick
@@ -27,9 +29,9 @@
logging.root.addHandler(handler)
def _dispatcher(self, c, e):
- log.debug("on_%s %s", e.eventtype(), (e.source(), e.target(),
- e.arguments()))
- irclib.SimpleIRCClient._dispatcher(self, c, e)
+ log.debug("on_%s %s", e.type, (e.source, e.target,
+ e.arguments))
+ irc.client.SimpleIRCClient._dispatcher(self, c, e)
def _delayed_check(self, delay=120):
self.connection.execute_delayed(delay, self._check_connection)
@@ -46,7 +48,7 @@
conn.connect(conn.server, conn.port, conn.nickname, conn.password,
conn.username, conn.ircname, conn.localaddress,
conn.localport)
- except irclib.ServerConnectionError:
+ except irc.client.ServerConnectionError:
log.info("failed reconnection, rescheduling", exc_info=True)
self._delayed_check()
@@ -61,7 +63,7 @@
self.connection.join(self.log_channel)
def on_pubmsg(self, conn, event):
- user = irclib.nm_to_n(event.source())
+ user = irc.client.NickMask(event.source()).nick
if event.target() == self.log_channel:
# ignore input in the log channel
@@ -72,7 +74,7 @@
return
# only respond on channels
- if not irclib.is_channel(event.target()):
+ if not irc.client.is_channel(event.target()):
return
msg = event.arguments()[0]
--- a/setup.py
+++ b/setup.py
@@ -17,16 +17,6 @@
install_requires = [
"PyStemmer>=1.2.0",
- "python-irclib==0.4.8"
- ],
-
- # The PyPI entry for python-irclib points at a SourceForge files
- # page. These no longer work with pip's url discovery, as they
- # append the string "/download" to each filename. I have uploaded
- # python-irclib 0.4.8's zip file from SourceForge (unmodified) to
- # the page below so that "pip install cobe" will work.
- dependency_links = [
- "http://github.com/pteichman/python-irclib/downloads"
],
classifiers = [
|