mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 07:27:17 +02:00
Add missing suppress_ga file to git.
This commit is contained in:
parent
63eec3a659
commit
e85153d926
1 changed files with 65 additions and 0 deletions
65
evennia/server/portal/suppress_ga.py
Normal file
65
evennia/server/portal/suppress_ga.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
"""
|
||||
|
||||
SUPPRESS-GO-AHEAD
|
||||
|
||||
This supports suppressing or activating Evennia
|
||||
the GO-AHEAD telnet operation after every server reply.
|
||||
If the client sends no explicit DONT SUPRESS GO-AHEAD,
|
||||
Evennia will default to supressing it since many clients
|
||||
will fail to use it and has no knowledge of this standard.
|
||||
|
||||
It can be activated explicitly with the ADDGOAHEAD option.
|
||||
|
||||
http://www.faqs.org/rfcs/rfc858.html
|
||||
|
||||
"""
|
||||
from builtins import object
|
||||
SUPPRESS_GA = chr(3)
|
||||
|
||||
# default taken from telnet specification
|
||||
|
||||
# try to get the customized mssp info, if it exists.
|
||||
|
||||
class SuppressGA(object):
|
||||
"""
|
||||
Implements the SUPRESS-GO-AHEAD protocol. Add this to a variable on the telnet
|
||||
protocol to set it up.
|
||||
|
||||
"""
|
||||
def __init__(self, protocol):
|
||||
"""
|
||||
Initialize suppression of GO-AHEADs.
|
||||
|
||||
Args:
|
||||
protocol (Protocol): The active protocol instance.
|
||||
|
||||
"""
|
||||
self.protocol = protocol
|
||||
|
||||
self.protocol.protocol_flags["NOGOAHEAD"] = True
|
||||
# tell the client that we prefer to suppress GA ...
|
||||
self.protocol.will(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga)
|
||||
# ... but also accept if the client really wants not to.
|
||||
self.protocol.do(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga)
|
||||
|
||||
def dont_suppress_ga(self, option):
|
||||
"""
|
||||
Called when client requests to not suppress GA.
|
||||
|
||||
Args:
|
||||
option (Option): Not used.
|
||||
|
||||
"""
|
||||
self.protocol.protocol_flags["NOGOAHEAD"] = False
|
||||
self.protocol.handshake_done()
|
||||
|
||||
def do_suppress_ga(self, option):
|
||||
"""
|
||||
Client wants to suppress GA
|
||||
|
||||
Args:
|
||||
option (Option): Not used.
|
||||
|
||||
"""
|
||||
self.protocol.protocol_flags["NOGOAHEAD"] = True
|
||||
self.protocol.handshake_done()
|
||||
Loading…
Add table
Add a link
Reference in a new issue