diff --git a/evennia/server/portal/portal.py b/evennia/server/portal/portal.py index 5dc9d6653..1668b97e9 100644 --- a/evennia/server/portal/portal.py +++ b/evennia/server/portal/portal.py @@ -86,7 +86,7 @@ def _portal_maintenance(): reason = "Idle timeout exceeded, disconnecting." for session in [sess for sess in PORTAL_SESSIONS.values() if (now - sess.cmd_last) > _IDLE_TIMEOUT]: - session.data_out(reason) + session.data_out(text=reason) PORTAL_SESSIONS.disconnect(session) if _IDLE_TIMEOUT > 0: diff --git a/evennia/server/portal/portalsessionhandler.py b/evennia/server/portal/portalsessionhandler.py index 44f3272dd..a765b5fc4 100644 --- a/evennia/server/portal/portalsessionhandler.py +++ b/evennia/server/portal/portalsessionhandler.py @@ -88,9 +88,9 @@ class PortalSessionHandler(SessionHandler): session.server_connected = False _CONNECTION_QUEUE.appendleft(session) if len(_CONNECTION_QUEUE) > 1: - session.data_out("%s DoS protection is active. You are queued to connect in %g seconds ..." % ( + session.data_out(text=[["%s DoS protection is active. You are queued to connect in %g seconds ..." % ( settings.SERVERNAME, - len(_CONNECTION_QUEUE)*_MIN_TIME_BETWEEN_CONNECTS)) + len(_CONNECTION_QUEUE)*_MIN_TIME_BETWEEN_CONNECTS)],{}]) now = time() if (now - self.connection_last < _MIN_TIME_BETWEEN_CONNECTS) or not self.portal.amp_protocol: if not session or not self.connection_task: @@ -331,7 +331,7 @@ class PortalSessionHandler(SessionHandler): if self.command_overflow: reactor.callLater(1.0, self.data_in, None) if self.command_overflow: - self.data_out(session, text=_ERROR_COMMAND_OVERFLOW) + self.data_out(session, text=[[_ERROR_COMMAND_OVERFLOW],{}]) return # scrub data kwargs = self.clean_senddata(session, kwargs) @@ -359,7 +359,7 @@ class PortalSessionHandler(SessionHandler): kwargs (any): Each key is a command instruction to the protocol on the form key = [[args],{kwargs}]. This will call a method send_ on the protocol. If no such - method exixts, it send the data to a method send_default. + method exixts, it sends the data to a method send_default. """ #from evennia.server.profiling.timetrace import timetrace diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index bce16c363..825f210ed 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -241,7 +241,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): """ if reason: - self.data_out(reason) + self.data_out(text=[[reason], {}]) self.connectionLost(reason) def data_in(self, **kwargs): @@ -355,5 +355,4 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): Send other oob data """ if not cmdname == "options": - print "telnet.send_default:", cmdname, args, kwargs self.oob.data_out(cmdname, *args, **kwargs) diff --git a/evennia/server/portal/webclient.py b/evennia/server/portal/webclient.py index c0fa3e3dc..eeaa57b60 100644 --- a/evennia/server/portal/webclient.py +++ b/evennia/server/portal/webclient.py @@ -65,7 +65,7 @@ class WebSocketClient(Protocol, Session): """ if reason: - self.data_out(text=reason) + self.data_out(text=[[reason],{}]) self.connectionLost(reason) def connectionLost(self, reason): diff --git a/evennia/server/serversession.py b/evennia/server/serversession.py index 4835e331a..4e2f2aeab 100644 --- a/evennia/server/serversession.py +++ b/evennia/server/serversession.py @@ -332,7 +332,7 @@ class ServerSession(Session): def data_out(self, **kwargs): """ - Sending data from Evennia->Player + Sending data from Evennia->Client Kwargs: text (str or tuple) @@ -345,7 +345,9 @@ class ServerSession(Session): def msg(self, text=None, **kwargs): """ - Wrapper to mimic msg() functionality elsewhere. + Wrapper to mimic msg() functionality of Objects and Players + (server sessions don't use data_in since incoming data is + handled by inputfuncs). Args: text (str): String input. diff --git a/evennia/server/sessionhandler.py b/evennia/server/sessionhandler.py index 4bc96b47e..cd96b1916 100644 --- a/evennia/server/sessionhandler.py +++ b/evennia/server/sessionhandler.py @@ -587,7 +587,7 @@ class ServerSessionHandler(SessionHandler): """ for sess in self.values(): - self.data_out(sess, message) + self.data_out(sess, text=message) def data_out(self, session, **kwargs): """