Resolved merge conflicts against master.
This commit is contained in:
commit
c7e1a6a086
56 changed files with 270 additions and 263 deletions
|
|
@ -228,7 +228,7 @@ class IMC2Bot(telnet.StatefulTelnetProtocol, Session):
|
|||
# Only support Plain text passwords.
|
||||
# SERVER Sends: PW <servername> <serverpw> version=<version#> <networkname>
|
||||
|
||||
logger.log_infomsg("IMC2: AUTH< %s" % line)
|
||||
logger.log_info("IMC2: AUTH< %s" % line)
|
||||
|
||||
line_split = line.split(' ')
|
||||
pw_present = line_split[0] == 'PW'
|
||||
|
|
@ -236,21 +236,21 @@ class IMC2Bot(telnet.StatefulTelnetProtocol, Session):
|
|||
|
||||
if "reject" in line_split:
|
||||
auth_message = _("IMC2 server rejected connection.")
|
||||
logger.log_infomsg(auth_message)
|
||||
logger.log_info(auth_message)
|
||||
return
|
||||
|
||||
if pw_present:
|
||||
self.server_name = line_split[1]
|
||||
self.network_name = line_split[4]
|
||||
elif autosetup_present:
|
||||
logger.log_infomsg(_("IMC2: Autosetup response found."))
|
||||
logger.log_info(_("IMC2: Autosetup response found."))
|
||||
self.server_name = line_split[1]
|
||||
self.network_name = line_split[3]
|
||||
self.is_authenticated = True
|
||||
self.sequence = int(time())
|
||||
|
||||
# Log to stdout and notify over MUDInfo.
|
||||
logger.log_infomsg('IMC2: Authenticated to %s' % self.factory.network)
|
||||
logger.log_info('IMC2: Authenticated to %s' % self.factory.network)
|
||||
|
||||
# Ask to see what other MUDs are connected.
|
||||
self._send_packet(pck.IMC2PacketKeepAliveRequest())
|
||||
|
|
@ -274,7 +274,7 @@ class IMC2Bot(telnet.StatefulTelnetProtocol, Session):
|
|||
self.uid = int(self.factory.uid)
|
||||
self.logged_in = True
|
||||
self.factory.sessionhandler.connect(self)
|
||||
logger.log_infomsg("IMC2 bot connected to %s." % self.network)
|
||||
logger.log_info("IMC2 bot connected to %s." % self.network)
|
||||
# Send authentication packet. The reply will be caught by lineReceived
|
||||
self._send_packet(pck.IMC2PacketAuthPlaintext())
|
||||
|
||||
|
|
@ -296,8 +296,6 @@ class IMC2Bot(telnet.StatefulTelnetProtocol, Session):
|
|||
self._imc_login(line)
|
||||
return
|
||||
|
||||
#logger.log_infomsg("IMC2: RECV> %s" % line)
|
||||
|
||||
# Parse the packet and encapsulate it for easy access
|
||||
packet = pck.IMC2Packet(self.mudname, packet_str=line)
|
||||
|
||||
|
|
@ -463,7 +461,7 @@ class IMC2BotFactory(protocol.ReconnectingClientFactory):
|
|||
def start(self):
|
||||
"Connect session to sessionhandler"
|
||||
def errback(fail):
|
||||
logger.log_errmsg(fail.value)
|
||||
logger.log_err(fail.value)
|
||||
|
||||
if self.port:
|
||||
service = internet.TCPClient(self.network, int(self.port), self)
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ class IRCBot(irc.IRCClient, Session):
|
|||
self.uid = int(self.factory.uid)
|
||||
self.logged_in = True
|
||||
self.factory.sessionhandler.connect(self)
|
||||
logger.log_infomsg("IRC bot '%s' connected to %s at %s:%s." % (self.nickname, self.channel,
|
||||
self.network, self.port))
|
||||
logger.log_info("IRC bot '%s' connected to %s at %s:%s." % (self.nickname, self.channel,
|
||||
self.network, self.port))
|
||||
|
||||
def disconnect(self, reason=None):
|
||||
"""
|
||||
|
|
@ -277,7 +277,7 @@ class IRCBotFactory(protocol.ReconnectingClientFactory):
|
|||
connector (Connector): Represents the connection.
|
||||
|
||||
"""
|
||||
logger.log_infomsg("(re)connecting to %s" % self.channel)
|
||||
logger.log_info("(re)connecting to %s" % self.channel)
|
||||
|
||||
def clientConnectionFailed(self, connector, reason):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ class PortalSessionHandler(SessionHandler):
|
|||
|
||||
self.sessions[session.sessid] = session
|
||||
session.server_connected = True
|
||||
#print "connecting", session.sessid, " number:", len(self.sessions)
|
||||
self.portal.amp_protocol.send_AdminPortal2Server(session.sessid,
|
||||
operation=PCONN,
|
||||
sessiondata=sessdata)
|
||||
|
|
@ -431,9 +430,7 @@ class PortalSessionHandler(SessionHandler):
|
|||
if session:
|
||||
# convert oob to the generic format
|
||||
if "oob" in kwargs:
|
||||
#print "oobstruct_parser in:", kwargs["oob"]
|
||||
kwargs["oob"] = self.oobstruct_parser(kwargs["oob"])
|
||||
#print "oobstruct_parser out:", kwargs["oob"]
|
||||
session.data_out(text=text, **kwargs)
|
||||
|
||||
PORTAL_SESSIONS = PortalSessionHandler()
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class RSSReader(Session):
|
|||
|
||||
def _errback(self, fail):
|
||||
"Report error"
|
||||
logger.log_errmsg("RSS feed error: %s" % fail.value)
|
||||
logger.log_err("RSS feed error: %s" % fail.value)
|
||||
|
||||
def update(self, init=False):
|
||||
"""
|
||||
|
|
@ -139,7 +139,7 @@ class RSSBotFactory(object):
|
|||
Called by portalsessionhandler. Starts te bot.
|
||||
"""
|
||||
def errback(fail):
|
||||
logger.log_errmsg(fail.value)
|
||||
logger.log_err(fail.value)
|
||||
|
||||
# set up session and connect it to sessionhandler
|
||||
self.bot.init_session("rssbot", self.url, self.sessionhandler)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
|||
# default:
|
||||
#openssl req -new -x509 -key ssl.key -out ssl.cert -days 7300
|
||||
exestring = "openssl req -new -x509 -key %s -out %s -days %s" % (keyfile, certfile, CERT_EXPIRE)
|
||||
#print "exestring:", exestring
|
||||
try:
|
||||
#, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
subprocess.call(exestring)
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
"""
|
||||
if data and data[0] == IAC or self.iaw_mode:
|
||||
try:
|
||||
#print "IAC mode"
|
||||
super(TelnetProtocol, self).dataReceived(data)
|
||||
if len(data) == 1:
|
||||
self.iaw_mode = True
|
||||
|
|
@ -196,12 +195,10 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
|
||||
# if we get to this point the command should end with a linebreak.
|
||||
# We make sure to add it, to fix some clients messing this up.
|
||||
#print "line data in:", repr(data)
|
||||
StatefulTelnetProtocol.dataReceived(self, data)
|
||||
|
||||
def _write(self, data):
|
||||
"hook overloading the one used in plain telnet"
|
||||
# print "_write (%s): %s" % (self.state, " ".join(str(ord(c)) for c in data))
|
||||
data = data.replace('\n', '\r\n').replace('\r\r\n', '\r\n')
|
||||
#data = data.replace('\n', '\r\n')
|
||||
super(TelnetProtocol, self)._write(mccp_compress(self, data))
|
||||
|
|
@ -214,7 +211,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
line (str): Line to send.
|
||||
|
||||
"""
|
||||
#print "sendLine (%s):\n%s" % (self.state, line)
|
||||
#escape IAC in line mode, and correctly add \r\n
|
||||
line += self.delimiter
|
||||
line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n')
|
||||
|
|
@ -305,7 +301,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
if "oob" in kwargs and "OOB" in self.protocol_flags:
|
||||
# oob is a list of [(cmdname, arg, kwarg), ...]
|
||||
for cmdname, args, okwargs in kwargs["oob"]:
|
||||
#print "telnet oob data_out:", cmdname, args, kwargs
|
||||
self.oob.data_out(cmdname, *args, **okwargs)
|
||||
|
||||
# parse **kwargs, falling back to ttype if nothing is given explicitly
|
||||
|
|
@ -318,15 +313,12 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
echo = kwargs.get("echo", None)
|
||||
mxp = kwargs.get("mxp", self.protocol_flags.get("MXP", False))
|
||||
|
||||
#print "telnet kwargs=%s, message=%s" % (kwargs, text)
|
||||
#print "xterm256=%s, useansi=%s, raw=%s, nomarkup=%s, init_done=%s" % (xterm256, useansi, raw, nomarkup, ttype.get("init_done"))
|
||||
if raw:
|
||||
# no processing whatsoever
|
||||
self.sendLine(text)
|
||||
elif text:
|
||||
# we need to make sure to kill the color at the end in order
|
||||
# to match the webclient output.
|
||||
#print "telnet data out:", self.protocol_flags, id(self.protocol_flags), id(self), "nomarkup: %s, xterm256: %s" % (nomarkup, xterm256)
|
||||
linetosend = ansi.parse_ansi(_RE_N.sub("", text) + "{n", strip_ansi=nomarkup, xterm256=xterm256, mxp=mxp)
|
||||
if mxp:
|
||||
linetosend = mxp_parse(linetosend)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ class TelnetOOB(object):
|
|||
else:
|
||||
msdp_string = "%s%s%s" % (MSDP_VAR. cmdname, "".join(
|
||||
["%s%s%s%s" % (MSDP_VAR, key, MSDP_VAL, val) for key, val in kwargs.items()]))
|
||||
#print "encode msdp result:", cmdname, args, kwargs, "->", msdp_string
|
||||
return force_str(msdp_string)
|
||||
|
||||
def encode_gmcp(self, cmdname, *args, **kwargs):
|
||||
|
|
@ -194,7 +193,6 @@ class TelnetOOB(object):
|
|||
gmcp_string = "%s %s" % (cmdname, json.dumps(args))
|
||||
elif kwargs:
|
||||
gmcp_string = "%s %s" % (cmdname, json.dumps(kwargs))
|
||||
#print "gmcp_encode", cmdname, args, kwargs, "->", gmcp_string
|
||||
return force_str(gmcp_string).strip()
|
||||
|
||||
def decode_msdp(self, data):
|
||||
|
|
@ -233,8 +231,6 @@ class TelnetOOB(object):
|
|||
parts = msdp_regex_val.split(varval)
|
||||
variables[parts[0]] = tuple(parts[1:]) if len(parts) > 1 else ("", )
|
||||
|
||||
#print "OOB: MSDP decode:", data, "->", variables, arrays, tables
|
||||
|
||||
# send to the sessionhandler
|
||||
if data:
|
||||
for varname, var in variables.items():
|
||||
|
|
@ -263,7 +259,6 @@ class TelnetOOB(object):
|
|||
if hasattr(data, "__iter__"):
|
||||
data = "".join(data)
|
||||
|
||||
#print "decode_gmcp:", data
|
||||
if data:
|
||||
splits = data.split(None, 1)
|
||||
cmdname = splits[0]
|
||||
|
|
@ -282,7 +277,6 @@ class TelnetOOB(object):
|
|||
args = tuple(struct)
|
||||
else:
|
||||
args = (struct,)
|
||||
#print "gmcp decode:", data, "->", cmdname, args, kwargs
|
||||
self.protocol.data_in(oob=(cmdname, args, kwargs))
|
||||
|
||||
# access methods
|
||||
|
|
@ -296,7 +290,6 @@ class TelnetOOB(object):
|
|||
args, kwargs (any): Arguments to OOB command.
|
||||
|
||||
"""
|
||||
#print "data_out:", encoded_oob
|
||||
if self.MSDP:
|
||||
encoded_oob = self.encode_msdp(cmdname, *args, **kwargs)
|
||||
self.protocol._write(IAC + SB + MSDP + encoded_oob + IAC + SE)
|
||||
|
|
|
|||
|
|
@ -90,8 +90,6 @@ class Ttype(object):
|
|||
except TypeError:
|
||||
pass
|
||||
|
||||
#print "incoming TTYPE option:", option
|
||||
|
||||
if self.ttype_step == 0:
|
||||
# just start the request chain
|
||||
self.protocol.requestNegotiation(TTYPE, SEND)
|
||||
|
|
@ -153,7 +151,6 @@ class Ttype(object):
|
|||
self.protocol.protocol_flags['TTYPE'][option.upper()] = True
|
||||
|
||||
self.protocol.protocol_flags['TTYPE']['init_done'] = True
|
||||
# print "TTYPE final:", self.protocol.protocol_flags['TTYPE']
|
||||
# we must sync ttype once it'd done
|
||||
self.protocol.handshake_done()
|
||||
self.ttype_step += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue