summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsand <daniel@spatof.org>2013-05-15 15:09:47 (GMT)
committer sand <daniel@spatof.org>2013-05-15 15:09:47 (GMT)
commita07f5fddc298e73a909f801e642d4d6432bd112b (patch)
tree14f385de8ca1db271a2f40668f21ddf363a9c538
parente27216b9f6a8ed94781d733b424aa7b507c0d6f9 (diff)
Rifiniture rete e variabili
-rw-r--r--pinolo/__init__.py21
-rw-r--r--pinolo/irc.py10
2 files changed, 17 insertions, 14 deletions
diff --git a/pinolo/__init__.py b/pinolo/__init__.py
index 5e8cf3a..2a55450 100644
--- a/pinolo/__init__.py
+++ b/pinolo/__init__.py
@@ -1,15 +1,14 @@
+# -*- coding: utf-8 -*-
+"""
+ pinolo
+ ~~~~~~
+
+ Constant variables definitions.
+
+ :copyright: (c) 2013 Daniel Kertesz
+ :license: BSD, see LICENSE for more details.
+"""
VERSION = (0, 10, 1)
STR_VERSION = '.'.join([str(x) for x in VERSION])
-FULL_VERSION = "Pinolo-" + STR_VERSION
SOURCE_URL = "http://git.spatof.org/pinolo.git"
USER_AGENT = "Pinolo/%s +%s" % (STR_VERSION, SOURCE_URL)
-
-DEFAULT_DATABASE_FILENAME = 'db.sqlite'
-
-# in seconds
-EOF_RECONNECT_TIME = 60
-FAILED_CONNECTION_RECONNECT_TIME = 120
-CONNECTION_TIMEOUT = 60 * 5
-PING_DELAY = float(60 * 4)
-THROTTLE_TIME = 0.5 # float
-THROTTLE_INCREASE = float(0.2) # float
diff --git a/pinolo/irc.py b/pinolo/irc.py
index 21311ca..a689c5e 100644
--- a/pinolo/irc.py
+++ b/pinolo/irc.py
@@ -17,6 +17,7 @@ import time
from pinolo.tasks import TestTask
from pinolo.cowsay import cowsay
from pinolo.casuale import get_random_quit, get_random_reply
+from pinolo import USER_AGENT
log = logging.getLogger(__name__)
@@ -376,8 +377,6 @@ class IRCConnection(object):
def nickserv_login(self):
self.msg("NickServ", u"IDENTIFY %s" % self.config['nickserv'])
- # XXX ugly
- time.sleep(1)
# IRC EVENTS
def on_001(self, event):
@@ -407,7 +406,7 @@ class IRCConnection(object):
self.ctcp_ping_reply(event.user.nickname, event.argstr)
def on_CTCP_VERSION(self, event):
- self.ctcp_reply(event.user.nickname, u"VERSION EY YE")
+ self.ctcp_reply(event.user.nickname, u"%s" % USER_AGENT)
def on_KICK(self, event):
channel = event.args[0].encode("utf-8", "replace")
@@ -424,9 +423,14 @@ class IRCConnection(object):
if event.user.nickname == self.current_nickname:
return
+ # React to NickServ messages
+ # - after login to nickserv
+ # - in case of network collision or when the server changes our nickname
if event.user.nickname == "NickServ":
if u"You are now identified" in event.text:
self.after_nickserv()
+ elif u"This nick is owned by someone else. Please choose another" in event.text:
+ self.nickserv_login()
def on_353(self, event):
"""RPL_NAMREPLY - reply to a NAMES command"""