20 lines
500 B
Python
20 lines
500 B
Python
from nntp.tiny.buffer import OutputBuffer, LineBuffer
|
|
|
|
class Connection():
|
|
def __init__(self, sock):
|
|
self.sock = sock
|
|
self.output = OutputBuffer(sock)
|
|
self.buf = LineBuffer()
|
|
|
|
def print(self, text: str, end: str="\r\n"):
|
|
return self.output.print(text, end)
|
|
|
|
def flush(self):
|
|
return self.output.flush()
|
|
|
|
def readline(self):
|
|
self.flush()
|
|
return self.buf.readline(self.sock)
|
|
|
|
def end(self):
|
|
return self.print('.')
|