Index: /applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
===================================================================
--- /applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java	(revision 29540)
+++ /applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java	(revision 29541)
@@ -32,5 +32,4 @@
         requestThread = new LogRequest();
         new Thread(requestThread).start();
-        checkLogin();
     }
     
@@ -65,12 +64,11 @@
      */
     public void checkLogin() {
-        final int uid = Main.pref.getInteger("geochar.lastuid", 0);
+        final int uid = Main.pref.getInteger("geochat.lastuid", 0);
         if( uid <= 0 ) return;
         String query = "whoami&uid=" + uid;
         JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
             public void processJson( JSONObject json ) {
-                if( json != null && json.has("name") ) {
+                if( json != null && json.has("name") )
                     login(uid, json.getString("name"));
-                }
             }
         });
@@ -243,5 +241,5 @@
 
         public void run() {
-            int interval = Main.pref.getInteger("geochat.interval", 3);
+            int interval = Main.pref.getInteger("geochat.interval", 2);
             while( !stopping ) {
                 process();
@@ -329,5 +327,5 @@
                     String author = msg.getString("author");
                     String message = msg.getString("message");
-                    ChatMessage cm = new ChatMessage(id, new LatLon(lat, lon), author, message, new Date(timeStamp));
+                    ChatMessage cm = new ChatMessage(id, new LatLon(lat, lon), author, message, new Date(timeStamp * 1000));
                     cm.setPrivate(priv);
                     result.add(cm);
Index: /applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
===================================================================
--- /applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java	(revision 29540)
+++ /applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java	(revision 29541)
@@ -2,6 +2,8 @@
 
 import java.awt.BorderLayout;
+import java.awt.Font;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -25,5 +27,4 @@
     private JTextField input;
     private JTabbedPane tabs;
-    private JPanel chatPanel;
     private JComponent noData;
     private JPanel loginPanel;
@@ -36,17 +37,39 @@
         chatPane = new JTextPane();
         chatPane.setEditable(false);
+        Font font = chatPane.getFont();
+        chatPane.setFont(font.deriveFont(font.getSize2D() - 2));
 
         noData = new JLabel(tr("Zoom in to see messages"), SwingConstants.CENTER);
 
         tabs = new JTabbedPane();
-        tabs.addTab(tr("Public"), noData);
+        tabs.addTab(tr("Public"), chatPane);
 
-        input = new JTextField();
+        input = new JTextField() {
+            @Override
+            protected void processKeyEvent( KeyEvent e ) {
+                if( e.getID() == KeyEvent.KEY_PRESSED ) {
+                    int code = e.getKeyCode();
+                    if( code == KeyEvent.VK_ENTER ) {
+                        String text = input.getText();
+                        if( text.length() > 0 ) {
+                            connection.postMessage(text);
+                            input.setText("");
+                        }
+                    } else if( code == KeyEvent.VK_TAB ) {
+                        // todo: autocomplete name
+                    } else if( code == KeyEvent.VK_ESCAPE ) {
+                        if( Main.map != null && Main.map.mapView != null )
+                            Main.map.mapView.requestFocus();
+                    }
+                    // Do not pass other events to JOSM
+                    if( code != KeyEvent.VK_LEFT && code != KeyEvent.VK_HOME && code != KeyEvent.VK_RIGHT
+                            && code != KeyEvent.VK_END && code != KeyEvent.VK_BACK_SPACE && code != KeyEvent.VK_DELETE )
+                        e.consume();
+                }
+                super.processKeyEvent(e);
+            }
 
-        gcPanel = new JPanel(new BorderLayout());
-        gcPanel.add(tabs, BorderLayout.CENTER);
-        gcPanel.add(input, BorderLayout.SOUTH);
+        };
 
-        loginPanel = new JPanel(new BorderLayout());
         final JTextField nameField = new JTextField();
         String userName = JosmUserIdentityManager.getInstance().getUserName();
@@ -55,5 +78,5 @@
         if( userName.contains("@") )
             userName = userName.substring(0, userName.indexOf('@'));
-        nameField.setText(name);
+        nameField.setText(userName);
 
         JButton loginButton = new JButton(tr("Login"));
@@ -64,6 +87,9 @@
         });
 
+        loginPanel = new JPanel(new BorderLayout());
         loginPanel.add(nameField, BorderLayout.CENTER);
         loginPanel.add(loginButton, BorderLayout.EAST);
+        loginPanel.add(Box.createVerticalGlue(), BorderLayout.NORTH);
+        loginPanel.add(Box.createVerticalGlue(), BorderLayout.SOUTH);
 
         gcPanel = new JPanel(new BorderLayout());
@@ -73,9 +99,14 @@
         // Start threads
         connection = ChatServerConnection.getInstance();
+        connection.addListener(this);
+        connection.checkLogin();
     }
 
     public void loggedIn( String userName ) {
-        gcPanel.remove(0);
-        gcPanel.add(tabs, 0);
+        if( gcPanel.getComponentCount() == 1 ) {
+            gcPanel.remove(0);
+            gcPanel.add(tabs, BorderLayout.CENTER);
+            gcPanel.add(input, BorderLayout.SOUTH);
+        }
     }
 
@@ -89,4 +120,5 @@
     public void statusChanged( boolean active ) {
         tabs.setComponentAt(0, active ? chatPane : noData);
+        repaint();
     }
 
@@ -99,5 +131,5 @@
             chatPane.setText("");
         }
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for( ChatMessage msg : messages ) {
             sb.append('\n');
Index: /applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
===================================================================
--- /applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java	(revision 29540)
+++ /applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java	(revision 29541)
@@ -29,4 +29,5 @@
             String serverURL = Main.pref.get("geochat.server", "http://zverik.dev.openstreetmap.org/osmochat.php?action=");
             URL url = new URL(serverURL + query);
+//            System.out.println("GeoChat URL = " + url.toString());
             HttpURLConnection connection = (HttpURLConnection)url.openConnection();
             connection.connect();
