[Zerofile-svn] SF.net SVN: zerofile: [50] trunk/src
Status: Pre-Alpha
Brought to you by:
karl-bengtsson
|
From: <kar...@us...> - 2007-11-13 14:20:26
|
Revision: 50
http://zerofile.svn.sourceforge.net/zerofile/?rev=50&view=rev
Author: karl-bengtsson
Date: 2007-11-13 06:20:20 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
Closing the chat window now properly ends the chat session and closes the socket.
Modified Paths:
--------------
trunk/src/XMPPLinkLocalChatSession.java
trunk/src/ZeroFileChatWindow.java
Modified: trunk/src/XMPPLinkLocalChatSession.java
===================================================================
--- trunk/src/XMPPLinkLocalChatSession.java 2007-11-13 13:58:06 UTC (rev 49)
+++ trunk/src/XMPPLinkLocalChatSession.java 2007-11-13 14:20:20 UTC (rev 50)
@@ -67,6 +67,15 @@
}
public void disconnect()
{
- // TODO - disconnect from host
+ try
+ {
+ _toRemoteHost.print("</stream:stream>");
+ _toRemoteHost.flush();
+ _s.close();
+ }
+ catch (Exception e)
+ {
+ System.out.println(e);
+ }
}
}
Modified: trunk/src/ZeroFileChatWindow.java
===================================================================
--- trunk/src/ZeroFileChatWindow.java 2007-11-13 13:58:06 UTC (rev 49)
+++ trunk/src/ZeroFileChatWindow.java 2007-11-13 14:20:20 UTC (rev 50)
@@ -1,6 +1,5 @@
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
+import java.awt.event.*;
import javax.swing.*;
@@ -37,8 +36,40 @@
new ActionListener(){
public void actionPerformed(ActionEvent sendButtonPress){
_session.sendMessage(_entryTextField.getText());
+ _entryTextField.setText("");
}
}
);
+ _chatWindowFrame.addWindowListener(new WindowListener(){
+ public void windowClosing(WindowEvent e)
+ {
+
+ }
+ public void windowDeiconified(WindowEvent e)
+ {
+
+ }
+ public void windowActivated(WindowEvent e)
+ {
+
+ }
+ public void windowDeactivated(WindowEvent e)
+ {
+
+ }
+ public void windowClosed(WindowEvent e)
+ {
+ _session.disconnect();
+ }
+ public void windowIconified(WindowEvent e)
+ {
+
+ }
+ public void windowOpened(WindowEvent e)
+ {
+
+ }
+ });
+ _entryTextField.requestFocusInWindow();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|