Improved IRC response on connect

This commit is contained in:
Julien Picalausa 2015-05-25 09:40:28 +02:00
parent 30fb4500cf
commit c323cccdf6
1 changed files with 8 additions and 4 deletions

View File

@ -35,7 +35,7 @@ import logging.handlers
import urllib import urllib
STATUSSTATES = ['AVAILABLE','CHAT', 'AWAY', 'XA', 'DND', 'INVISIBLE'] STATUSSTATES = ['AVAILABLE','CHAT', 'AWAY', 'XA', 'DND', 'INVISIBLE']
TELEPAATTIVERSION = 1 TELEPAATTIVERSION = 2.0
class JabberThread(Thread): class JabberThread(Thread):
"""Class for Jabber connection thread""" """Class for Jabber connection thread"""
@ -113,6 +113,8 @@ class ClientThread(Thread):
self.logger = logging.getLogger("logger") self.logger = logging.getLogger("logger")
self.logger.addHandler(logging.handlers.SysLogHandler(address = '/var/run/log')) self.logger.addHandler(logging.handlers.SysLogHandler(address = '/var/run/log'))
self.startup_time = datetime.datetime.now().strftime("%c")
def printError(self, msg): def printError(self, msg):
"""Error message printing for std out """Error message printing for std out
@ -930,15 +932,17 @@ class ClientThread(Thread):
"NOTICE AUTH :*** Found your hostname, welcome back", "NOTICE AUTH :*** Found your hostname, welcome back",
"NOTICE AUTH :*** Checking ident", "NOTICE AUTH :*** Checking ident",
"NOTICE AUTH :*** No identd (auth) response", "NOTICE AUTH :*** No identd (auth) response",
":%s 001 %s :Welcome to Telepaatti, IRC to XMPP gateway" % ":%s 001 %s :Welcome to Telepaatti, IRC to XMPP gateway %s!%s" %
(self.server, nick), (self.server, nick, nick, self.makeHostFromJID(self.JID)),
":%s 002 %s :Your host is %s [%s port %s] running version telepaatti-%s" % ( ":%s 002 %s :Your host is %s [%s port %s] running version telepaatti-%s" % (
self.server, self.server,
nick, nick,
self.server, self.server,
self.server, self.server,
self.port, self.port,
TELEPAATTIVERSION) TELEPAATTIVERSION),
":%s 003 %s :This server was created %s" % (self.server, nick, self.startup_time),
":%s 004 %s :%s Telepaatti%s spmAFkPBaTuUovbn q" % (self.server, nick, self.server, TELEPAATTIVERSION)
] ]
while lines: while lines:
self.sendToIRC(lines.pop(0)) self.sendToIRC(lines.pop(0))