Index: de/mud/terminal/vt320.java
===================================================================
--- de/mud/terminal/vt320.java	(Revision 501)
+++ de/mud/terminal/vt320.java	(Arbeitskopie)
@@ -81,6 +81,31 @@
   protected void sendTelnetCommand(byte cmd) {
   }
 
+  /** 
+   * Sent the changed window size from the terminal to all listeners.
+   */
+  protected void setWindowSize(int c, int r) {
+    /* To be overridden by Terminal.java */
+  }
+
+  public void setScreenSize(int c, int r, boolean broadcast) {
+    int oldrows = getRows(), oldcols = getColumns();
+
+    if (debug>2) System.err.println("setscreensize ("+c+","+r+","+broadcast+")");
+
+    super.setScreenSize(c,r,false);
+
+    /* Tricky, since the VDUBuffer works strangely. */
+    if (r > oldrows) {
+      setCursorPosition(C, R + (r-oldrows)); 
+      redraw();
+    }
+    if (broadcast) {
+      setWindowSize(c, r); /* broadcast up */
+    }
+  }
+
+
   /**
    * Create a new vt320 terminal and intialize it with useful settings.
    */
@@ -1863,7 +1888,7 @@
             for (int i = 0; i <= DCEvar; i++) {
               switch (DCEvars[i]) {
                 case 3: /* 80 columns*/
-                  setScreenSize(80, getRows());
+                  setScreenSize(80, getRows(), true);
                   break;
                 case 4: /* scrolling mode, smooth */
                   break;
@@ -1905,7 +1930,7 @@
                   vt52mode = false;
                   break;
                 case 3: /* 132 columns*/
-                  setScreenSize(132, getRows());
+                  setScreenSize(132, getRows(), true);
                   break;
                 case 6: /* DECOM: move inside margins. */
                   moveoutsidemargins = false;
@@ -1972,7 +1997,7 @@
                   vt52mode = true;
                   break;
                 case 3: /* 80 columns*/
-                  setScreenSize(80, getRows());
+                  setScreenSize(80, getRows(), true);
                   break;
                 case 6: /* DECOM: move outside margins. */
                   moveoutsidemargins = true;
Index: de/mud/terminal/SwingTerminal.java
===================================================================
--- de/mud/terminal/SwingTerminal.java	(Revision 501)
+++ de/mud/terminal/SwingTerminal.java	(Arbeitskopie)
@@ -655,7 +655,7 @@
 
     switch (resizeStrategy) {
       case RESIZE_SCREEN:
-        buffer.setScreenSize(w / charWidth, buffer.height = h / charHeight);
+        buffer.setScreenSize(w / charWidth, buffer.height = h / charHeight, true);
         break;
       case RESIZE_FONT:
         int height = h / buffer.height;
Index: de/mud/terminal/VDUBuffer.java
===================================================================
--- de/mud/terminal/VDUBuffer.java	(Revision 501)
+++ de/mud/terminal/VDUBuffer.java	(Arbeitskopie)
@@ -95,7 +95,7 @@
    */
   public VDUBuffer(int width, int height) {
     // set the display screen size
-    setScreenSize(width, height);
+    setScreenSize(width, height, false);
   }
 
   /**
@@ -690,7 +690,7 @@
    * @param w of the screen
    * @param h of the screen
    */
-  public void setScreenSize(int w, int h) {
+  public void setScreenSize(int w, int h, boolean broadcast) {
     char cbuf[][];
     int abuf[][];
     int bsize = bufSize;
Index: de/mud/ssh/SshIO.java
===================================================================
--- de/mud/ssh/SshIO.java	(Revision 501)
+++ de/mud/ssh/SshIO.java	(Arbeitskopie)
@@ -104,6 +104,7 @@
   private final byte SSH_CMSG_USER = 4;
   private final byte SSH_CMSG_AUTH_PASSWORD = 9;
   private final byte SSH_CMSG_REQUEST_PTY = 10;
+  private final byte SSH_CMSG_WINDOW_SIZE = 11;
   private final byte SSH_CMSG_EXEC_SHELL = 12;
   private final byte SSH_SMSG_SUCCESS = 14;
   private final byte SSH_SMSG_FAILURE = 15;
@@ -197,6 +198,14 @@
     crypto = null;
   }
 
+  public void setWindowSize(int columns,int rows)
+    throws IOException {
+    if (phase == PHASE_INIT) {
+      System.err.println("sshio:setWindowSize(), sizing in init phase not supported.\n");
+    }
+    if (debug>1) System.err.println("SSHIO:setWindowSize("+columns+","+rows+")");
+    Send_SSH_CMSG_WINDOW_SIZE(columns,rows);
+  }
 
   synchronized public void sendData(String str) throws IOException {
     if (debug > 1) System.out.println("SshIO.send(" + str + ")");
@@ -603,6 +612,7 @@
         break;
 
       case SSH_SMSG_FAILURE:
+        if (debug > 1) System.err.println("SSH_SMSG_FAILURE");
         if (lastPacketSentType == SSH_CMSG_AUTH_PASSWORD) {// password incorrect ???
           System.out.println("failed to log in");
           Send_SSH_MSG_DISCONNECT("Failed to log in.");
@@ -861,6 +871,24 @@
   }
 
   /**
+   * Send_SSH_CMSG_WINDOW_SIZE
+   *   string       TERM environment variable value (e.g. vt100)
+   *   32-bit int   terminal height, rows (e.g., 24)
+   *   32-bit int   terminal width, columns (e.g., 80)
+   *   32-bit int   terminal width, pixels (0 if no graphics) (e.g., 480)
+   */
+  private String Send_SSH_CMSG_WINDOW_SIZE(int c, int r) throws IOException {
+    SshPacket1 p = new SshPacket1(SSH_CMSG_WINDOW_SIZE);
+
+    p.putInt32(r);		// Int32	rows
+    p.putInt32(c);		// Int32	columns
+    p.putInt32(0);		// Int32	x pixels
+    p.putInt32(0);		// Int32	y pixels
+    sendPacket1(p);
+    return "";
+  }
+
+  /**
    * Send_SSH_CMSG_REQUEST_PTY
    *   string       TERM environment variable value (e.g. vt100)
    *   32-bit int   terminal height, rows (e.g., 24)
Index: de/mud/jta/plugin/SSH.java
===================================================================
--- de/mud/jta/plugin/SSH.java	(Revision 501)
+++ de/mud/jta/plugin/SSH.java	(Arbeitskopie)
@@ -32,6 +32,7 @@
 import de.mud.jta.VisualPlugin;
 
 import de.mud.jta.event.ConfigurationListener;
+import de.mud.jta.event.SetWindowSizeListener;
 import de.mud.jta.event.OnlineStatusListener;
 import de.mud.jta.event.TerminalTypeRequest;
 import de.mud.jta.event.WindowSizeRequest;
@@ -103,6 +104,17 @@
       }
     });
 
+    bus.registerPluginListener(new SetWindowSizeListener() {
+      public void setWindowSize(int columns, int rows) {
+        try {
+          handler.setWindowSize(columns,rows);
+        } catch (java.io.IOException e) {
+          System.err.println("IO Exception in set window size");
+        }
+      }
+    });
+
+
     // reset the protocol handler just in case :-)
     bus.registerPluginListener(new OnlineStatusListener() {
       public void online() {
Index: de/mud/jta/plugin/Telnet.java
===================================================================
--- de/mud/jta/plugin/Telnet.java	(Revision 501)
+++ de/mud/jta/plugin/Telnet.java	(Arbeitskopie)
@@ -33,6 +33,7 @@
 import de.mud.jta.event.OnlineStatusListener;
 import de.mud.jta.event.ConfigurationListener;
 import de.mud.jta.event.TelnetCommandListener;
+import de.mud.jta.event.SetWindowSizeListener;
 import de.mud.jta.event.TerminalTypeRequest;
 import de.mud.jta.event.WindowSizeRequest;
 import de.mud.jta.event.LocalEchoRequest;
@@ -108,6 +109,16 @@
       }
     });
 
+    bus.registerPluginListener(new SetWindowSizeListener() {
+      public void setWindowSize(int columns, int rows) {
+        try {
+	  handler.setWindowSize(columns,rows);
+        } catch (java.io.IOException e) {
+          System.err.println("IO Exception in set window size");
+        }
+      }
+    });
+
     bus.registerPluginListener(new ConfigurationListener() {
       public void setConfiguration(PluginConfig config) {
         configure(config);
Index: de/mud/jta/plugin/Terminal.java
===================================================================
--- de/mud/jta/plugin/Terminal.java	(Revision 501)
+++ de/mud/jta/plugin/Terminal.java	(Arbeitskopie)
@@ -37,6 +37,7 @@
 import de.mud.jta.event.ReturnFocusListener;
 import de.mud.jta.event.SoundRequest;
 import de.mud.jta.event.TelnetCommandRequest;
+import de.mud.jta.event.SetWindowSizeRequest;
 import de.mud.jta.event.TerminalTypeListener;
 import de.mud.jta.event.WindowSizeListener;
 import de.mud.terminal.vt320;
@@ -152,6 +153,10 @@
       public void sendTelnetCommand(byte cmd) {
         bus.broadcast(new TelnetCommandRequest(cmd));
       }
+
+      public void setWindowSize(int c, int r) {
+        bus.broadcast(new SetWindowSizeRequest(c,r));
+      }
     };
 
     // create terminal
@@ -453,7 +458,7 @@
         int idx = tmp.indexOf(',');
         int width = Integer.parseInt(tmp.substring(1, idx).trim());
         int height = Integer.parseInt(tmp.substring(idx + 1, tmp.length() - 1).trim());
-        emulation.setScreenSize(width, height);
+        emulation.setScreenSize(width, height, false);
       } catch (Exception e) {
         error("screen size is wrong: " + tmp);
         error("error: " + e);
Index: de/mud/jta/event/SetWindowSizeListener.java
===================================================================
--- de/mud/jta/event/SetWindowSizeListener.java	(Revision 0)
+++ de/mud/jta/event/SetWindowSizeListener.java	(Revision 504)
@@ -0,0 +1,42 @@
+/*
+ * This file is part of "JTA - Telnet/SSH for the JAVA(tm) platform".
+ *
+ * (c) Matthias L. Jugel, Marcus Meißner 1996-2005. All Rights Reserved.
+ *
+ * Please visit http://javatelnet.org/ for updates and contact.
+ *
+ * --LICENSE NOTICE--
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * --LICENSE NOTICE--
+ *
+ */
+package de.mud.jta.event;
+
+import de.mud.jta.PluginListener;
+
+import java.awt.Dimension;
+
+/**
+ * This is the interface for a window size listener. 
+ * <P>
+ * <B>Maintainer:</B> Matthias L. Jugel
+ *
+ * @version $Id: WindowSizeListener.java 499 2005-09-29 08:24:54Z leo $
+ * @author Matthias L. Jugel, Marcus Mei�ner
+ */
+public interface SetWindowSizeListener extends PluginListener {
+  /** Set the current window size of the terminal in rows and columns. */
+  public void setWindowSize(int columns, int rows);
+}
Index: de/mud/jta/event/SetWindowSizeRequest.java
===================================================================
--- de/mud/jta/event/SetWindowSizeRequest.java	(Revision 0)
+++ de/mud/jta/event/SetWindowSizeRequest.java	(Revision 504)
@@ -0,0 +1,56 @@
+/*
+ * This file is part of "JTA - Telnet/SSH for the JAVA(tm) platform".
+ *
+ * (c) Matthias L. Jugel, Marcus Meißner 1996-2005. All Rights Reserved.
+ *
+ * Please visit http://javatelnet.org/ for updates and contact.
+ *
+ * --LICENSE NOTICE--
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * --LICENSE NOTICE--
+ *
+ */
+package de.mud.jta.event;
+
+import de.mud.jta.PluginMessage;
+import de.mud.jta.PluginListener;
+import de.mud.jta.event.SetWindowSizeListener;
+
+/**
+ * Request the current window size of the terminal.
+ * <P>
+ * <B>Maintainer:</B> Matthias L. Jugel
+ *
+ * @version $Id: WindowSizeRequest.java 499 2005-09-29 08:24:54Z leo $
+ * @author Matthias L. Jugel, Marcus Mei�ner
+ */
+public class SetWindowSizeRequest implements PluginMessage {
+
+  private int columns, rows;
+  public SetWindowSizeRequest(int c, int r) {
+	rows = r;
+	columns = c;
+  }
+  /**
+   * Set the new size of the window
+   * @param pl the list of plugin message listeners
+   */
+  public Object firePluginMessage(PluginListener pl) {
+    if(pl instanceof SetWindowSizeListener) {
+      ((SetWindowSizeListener)pl).setWindowSize(columns, rows);
+    }
+    return null;
+  }
+}
Index: de/mud/jta/default.conf
===================================================================
--- de/mud/jta/default.conf	(Revision 501)
+++ de/mud/jta/default.conf	(Arbeitskopie)
@@ -87,7 +87,7 @@
 Terminal.id			=	vt320
 Terminal.buffer			=	100
 Terminal.size			=	[80,24]
-Terminal.resize			=	font
+Terminal.resize			=	screen
 Terminal.font			=	Monospaced
 Terminal.fontStyle		=	plain
 Terminal.fontSize		=	11
Index: de/mud/telnet/TelnetProtocolHandler.java
===================================================================
--- de/mud/telnet/TelnetProtocolHandler.java	(Revision 501)
+++ de/mud/telnet/TelnetProtocolHandler.java	(Arbeitskopie)
@@ -204,7 +204,26 @@
     write(b);
   }
 
+  /**
+   * Send the new Window Size (via NAWS)
+   */
+  public void setWindowSize(int columns,int rows)
+    throws IOException {
+    if(debug > 2) System.err.println("sending NAWS");
 
+    if (receivedDX[TELOPT_NAWS] != DO) {
+    	System.err.println("not allowed to send NAWS? (DONT NAWS)");
+	return;
+    }
+    write(IAC);write(SB);write(TELOPT_NAWS);
+    write((byte) (columns >> 8));
+    write((byte) (columns & 0xff));
+    write((byte) (rows >> 8));
+    write((byte) (rows & 0xff));
+    write(IAC);write(SE);
+  }
+
+
   /**
    * Handle an incoming IAC SB &lt;type&gt; &lt;bytes&gt; IAC SE
    * @param type type of SB
Index: bin/telnet
===================================================================
--- bin/telnet	(Revision 501)
+++ bin/telnet	(Arbeitskopie)
@@ -1,2 +1,2 @@
 #! /bin/sh
-java -jar `dirname $0`/../jar/jta20.jar $*
+java -jar `dirname $0`/../jar/jta26.jar $*
