/cui/telnet.d

http://github.com/wilkie/djehuty · D · 45 lines · 26 code · 11 blank · 8 comment · 2 complexity · e8568ce2d6254d49b4f52093fea485d2 MD5 · raw file

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