53 state_negotiation =
"negotiation"
61 def __init__(self, mode, codecs_lst, fp=None, id=""):
67 self.
codecs = atlas.codecs.ids
86 def get_send_str(self):
91 def __call__(self, str=""):
92 if str: self.
str = self.
str + str
101 def process_line(self, line):
102 raise AttributeError(
"User NegotiationClient or NegotiationServer instead")
104 def collect_until_newline(self):
106 ok = string.find(self.
str,
"\n")<0
108 ok = read_str = self.
fp.recv(1)
109 self.
str = self.
str + read_str
110 ok = read_str
and string.find(self.
str,
"\n")<0
112 newline_pos = string.find(self.
str,
"\n")
114 res = self.
str[:newline_pos]
115 self.
str = self.
str[newline_pos+1:]
118 def iwill(self, codecs):
119 return string.join([
"IWILL %s\n" % c
for c
in codecs],
"") +
'\n'
121 def ican(self, codecs):
122 return string.join([
"ICAN %s\n" % c
for c
in codecs],
"") +
'\n'
124 def analyse_line_codecs(self, line):
125 modes = string.split(line)
126 if len(modes)>=2
and modes[0]==
"ICAN":
143 def __init__(self, codecs=(), fp=
None, id=
""):
144 Negotiation.__init__(self,
"server", codecs, fp, id)
146 def process_line(self, line):
148 if line[:5]!=
"ATLAS":
149 return self.
fail(
"Huh?\n\n")
156 if len(modes)>=2
and modes[0]==
"ICAN" and \
163 if not line
or line==
"\r":
173 def __init__(self, codecs=(), fp=
None, id=
""):
174 Negotiation.__init__(self,
"client", codecs, fp, id)
176 def process_line(self, line):
178 if line[:5]!=
"ATLAS":
179 return self.
fail(
"Huh?\n\n")
187 if len(modes)>=2
and modes[0]==
"IWILL" and \
def process_line(self, line)
def collect_until_newline(self)
def analyse_line_codecs(self, line)