PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/cui/telnet.d

http://github.com/wilkie/djehuty
D | 45 lines | 26 code | 11 blank | 8 comment | 2 complexity | e8568ce2d6254d49b4f52093fea485d2 MD5 | raw file
 1module cui.telnet;
 2
 3import cui.vt100;
 4import cui.buffer;
 5
 6import core.string;
 7
 8import networking.telnet;
 9
10// Section: Console
11
12// Description: This console control is a console buffer that will facilitate a connection to a telnet server within a section of your console view.
13class CuiTelnet : CuiVT100 {
14	this( uint x, uint y, uint width, uint height) {
15		super(x,y,width,height);
16
17		_telnet = new TelnetClient;
18		_telnet.setDelegate(&recvChar);
19		_telnet.connect("ice9-tw.com", 2002);
20	}
21
22	override void onKeyChar(dchar chr) {
23		if (chr == 10)
24		{
25			chr = 13;
26		}
27		_telnet.putChar(chr);
28	}
29
30protected:
31
32	void recvChar(dchar chr) {
33		return;
34		/*if (chr == 13 || chr == 10) {
35			super.onKeyChar(chr);
36		}
37		else {
38			writeChar(chr);
39		}*/
40	}
41
42private:
43
44	TelnetClient _telnet;
45}