merge
authornikita@nikita-laptop
Sat, 23 Jan 2010 13:42:20 +0100
changeset 832 e7fb2538ac5c
parent 831 af3a788344f9 (current diff)
parent 830 c8b4ace735ea (diff)
child 833 f5a5d9237d69
merge
AndroidManifest.xml
libs/jingle-namespace.patch
libs/jstun-android.patch
libs/new-android-r1.diff
libs/patch-smack-android-sasl.diff
libs/smack-android-r1.diff
libs/smack-android.diff
libs/smack.jar
libs/smackx-debug.jar
libs/smackx-jingle.jar
libs/smackx.jar
res/layout/jingle_call_activity.xml
--- a/.classpath	Thu Jan 21 01:35:17 2010 +0100
+++ b/.classpath	Sat Jan 23 13:42:20 2010 +0100
@@ -1,25 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-	<classpathentry exported="true" kind="lib" path="libs/smackx-debug.jar"/>
-	<classpathentry exported="true" kind="lib" path="libs/smackx-jingle.jar" sourcepath="/home/nikita/devel/smack">
+	<classpathentry kind="src" path=""/>
+	<classpathentry kind="lib" path="libs/asmack-jse.jar" sourcepath="/home/nikita/devel/smack">
 		<attributes>
-			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack_src_3_1_0/javadoc/"/>
+			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack/jingle/extension/"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry exported="true" kind="lib" path="libs/smack.jar" sourcepath="/home/marseille/smack_src_3_1_0/source">
+	<classpathentry kind="lib" path="libs/jlibrtp.jar"/>
+	<classpathentry kind="lib" path="libs/security.jar"/>
+	<classpathentry kind="lib" path="/home/nikita/android-sdk-linux_x86-1.6_r1/platforms/android-2.0.1/android.jar">
 		<attributes>
-			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack_src_3_1_0/javadoc/org/"/>
+			<attribute name="javadoc_location" value="file:/home/nikita/android/docs/reference/"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry exported="true" kind="lib" path="libs/smackx.jar" sourcepath="/home/nikita/devel/smack">
-		<attributes>
-			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack_src_3_1_0/javadoc/"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry exported="true" kind="lib" path="libs/jlibrtp.jar">
-	<classpathentry exported="true" kind="lib" path="libs/security.jar"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
--- a/AndroidManifest.xml	Thu Jan 21 01:35:17 2010 +0100
+++ b/AndroidManifest.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -66,12 +66,19 @@
 					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
 		</activity>
-		<!-- Could be interesting if we would launch beem at startup
-		<receiver android:name=".tool.BeemBroadcastReceiver" android:enabled="true">
-			<intent-filter>
-				<action android:name="android.intent.action.BOOT_COMPLETED" />
+		<activity android:name=".ui.Call" android:label="Call String en dur">
+			<intent-filter android:label="Beem Connection">
+				<action
+					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
-		</receiver>  -->
+		</activity>
+		<!--
+			Could be interesting if we would launch beem at startup <receiver
+			android:name=".tool.BeemBroadcastReceiver" android:enabled="true">
+			<intent-filter> <action
+			android:name="android.intent.action.BOOT_COMPLETED" />
+			</intent-filter> </receiver>
+		-->
 		<service android:name="BeemService" android:enabled="true"
 			android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
 			<intent-filter>
@@ -90,6 +97,6 @@
 	<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
 	<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
 	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
-	<uses-sdk android:minSdkVersion="3"/>
+	<uses-sdk android:minSdkVersion="3" />
 
 </manifest> 
Binary file libs/asmack-jse.jar has changed
--- a/libs/jingle-namespace.patch	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-diff -Nru source-org/org/jivesoftware/smackx/jingle/JingleManager.java source/org/jivesoftware/smackx/jingle/JingleManager.java
---- source-org/org/jivesoftware/smackx/jingle/JingleManager.java	2009-09-25 18:06:18.671020248 +0200
-+++ source/org/jivesoftware/smackx/jingle/JingleManager.java	2009-09-25 18:28:51.645104395 +0200
-@@ -255,7 +255,7 @@
-      */
-     public static void setJingleServiceEnabled() {
-         ProviderManager providerManager = ProviderManager.getInstance();
--        providerManager.addIQProvider("jingle", "urn:xmpp:tmp:jingle", new JingleProvider());
-+        providerManager.addIQProvider("jingle", "urn:xmpp:jingle:1", new JingleProvider());
- 
-         // Enable the Jingle support on every established connection
-         // The ServiceDiscoveryManager class should have been already
-@@ -623,4 +623,4 @@
-             }
-         }
-     }
--}
-\ Pas de fin de ligne à la fin du fichier.
-+}
-diff -Nru source-org/org/jivesoftware/smackx/packet/JingleContentDescription.java source/org/jivesoftware/smackx/packet/JingleContentDescription.java
---- source-org/org/jivesoftware/smackx/packet/JingleContentDescription.java	2009-09-25 18:06:18.676020534 +0200
-+++ source/org/jivesoftware/smackx/packet/JingleContentDescription.java	2009-09-25 18:29:00.788020599 +0200
-@@ -172,7 +172,7 @@
-      */
-     public static class Audio extends JingleContentDescription {
- 
--        public static final String NAMESPACE = "urn:xmpp:tmp:jingle:apps:rtp";
-+        public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:1";
- 
-         public Audio() {
-             super();
-diff -Nru source-org/org/jivesoftware/smackx/packet/JingleContentInfo.java source/org/jivesoftware/smackx/packet/JingleContentInfo.java
---- source-org/org/jivesoftware/smackx/packet/JingleContentInfo.java	2009-09-25 18:06:18.677020522 +0200
-+++ source/org/jivesoftware/smackx/packet/JingleContentInfo.java	2009-09-25 18:29:10.384025608 +0200
-@@ -96,7 +96,7 @@
-      */
-     public static class Audio extends JingleContentInfo {
- 
--        public static final String NAMESPACE = "urn:xmpp:tmp:jingle:apps:rtp";
-+        public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:1";
- 
-         public Audio(final ContentInfo mi) {
-             super(mi);
-diff -Nru source-org/org/jivesoftware/smackx/packet/JingleDescription.java source/org/jivesoftware/smackx/packet/JingleDescription.java
---- source-org/org/jivesoftware/smackx/packet/JingleDescription.java	2009-09-25 18:06:18.677020522 +0200
-+++ source/org/jivesoftware/smackx/packet/JingleDescription.java	2009-09-25 18:42:05.559023786 +0200
-@@ -179,7 +179,7 @@
-      */
-     public static class Audio extends JingleDescription {
- 
--        public static final String NAMESPACE = "urn:xmpp:tmp:jingle:apps:rtp";
-+        public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:1";
- 
-         public Audio() {
-             super();
-diff -Nru source-org/org/jivesoftware/smackx/packet/JingleError.java source/org/jivesoftware/smackx/packet/JingleError.java
---- source-org/org/jivesoftware/smackx/packet/JingleError.java	2009-09-25 18:06:18.677020522 +0200
-+++ source/org/jivesoftware/smackx/packet/JingleError.java	2009-09-25 18:29:32.331099677 +0200
-@@ -27,7 +27,7 @@
- 
- public class JingleError implements PacketExtension {
- 
--    public static String NAMESPACE = "urn:xmpp:tmp:jingle:errors";
-+    public static String NAMESPACE = "urn:xmpp:jingle:errors:1";
- 
-     public static final JingleError OUT_OF_ORDER = new JingleError("out-of-order");
- 
-diff -Nru source-org/org/jivesoftware/smackx/packet/Jingle.java source/org/jivesoftware/smackx/packet/Jingle.java
---- source-org/org/jivesoftware/smackx/packet/Jingle.java	2009-09-25 18:06:18.676020534 +0200
-+++ source/org/jivesoftware/smackx/packet/Jingle.java	2009-09-25 18:29:39.937485756 +0200
-@@ -44,7 +44,7 @@
- 
-     // static
- 
--    public static final String NAMESPACE = "urn:xmpp:tmp:jingle";
-+    public static final String NAMESPACE = "urn:xmpp:jingle:1";
- 
-     public static final String NODENAME = "jingle";
- 
-diff -Nru source-org/org/jivesoftware/smackx/packet/JingleTransport.java source/org/jivesoftware/smackx/packet/JingleTransport.java
---- source-org/org/jivesoftware/smackx/packet/JingleTransport.java	2009-09-25 18:06:18.676020534 +0200
-+++ source/org/jivesoftware/smackx/packet/JingleTransport.java	2009-09-25 18:44:09.198082560 +0200
-@@ -270,7 +270,7 @@
-      * RTP-ICE profile
-      */
-     public static class Ice extends JingleTransport {
--        public static final String NAMESPACE = "urn:xmpp:tmp:jingle:transports:ice-udp";
-+        public static final String NAMESPACE = "urn:xmpp:jingle:transports:ice-udp:1";
- 
-         public Ice() {
-             super();
-@@ -352,7 +352,7 @@
-      * Raw UDP profile.
-      */
-     public static class RawUdp extends JingleTransport {
--        public static final String NAMESPACE = "http://www.xmpp.org/extensions/xep-0177.html#ns";
-+        public static final String NAMESPACE = "urn:xmpp:jingle:transports:ice-udp:1";
- 
-         public RawUdp() {
-             super();
--- a/libs/jstun-android.patch	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,677 +0,0 @@
-diff -Nru src-stun/de/javawi/jstun/attribute/ChangedAddress.java src/de/javawi/jstun/attribute/ChangedAddress.java
---- src-stun/de/javawi/jstun/attribute/ChangedAddress.java	2009-03-08 13:37:27.000000000 +0100
-+++ src/de/javawi/jstun/attribute/ChangedAddress.java	2009-10-03 14:47:30.504972058 +0200
-@@ -11,11 +11,9 @@
- 
- package de.javawi.jstun.attribute;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
- 
- public class ChangedAddress extends MappedResponseChangedSourceAddressReflectedFrom {
--	private static final Logger LOGGER = LoggerFactory.getLogger(ChangedAddress.class);
- 	
- 	public ChangedAddress() {
- 		super(MessageAttribute.MessageAttributeType.ChangedAddress);
-@@ -24,7 +22,7 @@
- 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
- 		ChangedAddress ca = new ChangedAddress();
- 		MappedResponseChangedSourceAddressReflectedFrom.parse(ca, data);
--		LOGGER.debug("Message Attribute: Changed Address parsed: " + ca.toString() + ".");
-+		Log.d("Jstun-ChangedAddress", "Message Attribute: Changed Address parsed: " + ca.toString() + ".");
- 		return ca;
- 	}
- }
-diff -Nru src-stun/de/javawi/jstun/attribute/MappedAddress.java src/de/javawi/jstun/attribute/MappedAddress.java
---- src-stun/de/javawi/jstun/attribute/MappedAddress.java	2009-03-08 13:36:42.000000000 +0100
-+++ src/de/javawi/jstun/attribute/MappedAddress.java	2009-10-03 14:47:23.989081351 +0200
-@@ -11,11 +11,9 @@
- 
- package de.javawi.jstun.attribute;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
- 
- public class MappedAddress extends MappedResponseChangedSourceAddressReflectedFrom {
--	private static final Logger LOGGER = LoggerFactory.getLogger(MappedAddress.class);
- 	public MappedAddress() {
- 		super(MessageAttribute.MessageAttributeType.MappedAddress);
- 	}
-@@ -23,7 +21,7 @@
- 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
- 		MappedAddress ma = new MappedAddress();
- 		MappedResponseChangedSourceAddressReflectedFrom.parse(ma, data);
--		LOGGER.debug("Message Attribute: Mapped Address parsed: " + ma.toString() + ".");
-+		Log.d("Jstun-MappedAddress", "Message Attribute: Mapped Address parsed: " + ma.toString() + ".");
- 		return ma;
- 	}
- }
-diff -Nru src-stun/de/javawi/jstun/attribute/MessageAttribute.java src/de/javawi/jstun/attribute/MessageAttribute.java
---- src-stun/de/javawi/jstun/attribute/MessageAttribute.java	2009-03-08 13:35:52.000000000 +0100
-+++ src/de/javawi/jstun/attribute/MessageAttribute.java	2009-10-03 14:48:48.776972620 +0200
-@@ -11,15 +11,12 @@
- 
- package de.javawi.jstun.attribute;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
--
-+import android.util.Log;
- import de.javawi.jstun.util.Utility;
- import de.javawi.jstun.util.UtilityException;
- 
- 
- public abstract class MessageAttribute implements MessageAttributeInterface {
--	private static final Logger LOGGER = LoggerFactory.getLogger(MessageAttribute.class);
- 	MessageAttributeType type;
- 	
- 	public MessageAttribute() {
-@@ -104,7 +101,7 @@
- 				if (type <= 0x7fff) {
- 					throw new UnknownMessageAttributeException("Unkown mandatory message attribute", intToType(type));
- 				} else {
--					LOGGER.debug("MessageAttribute with type " + type + " unkown.");
-+					Log.d("Jstun-MessageAttribute", "MessageAttribute with type " + type + " unkown.");
- 					ma = Dummy.parse(valueArray);
- 					break;
- 				}
-diff -Nru src-stun/de/javawi/jstun/attribute/ReflectedFrom.java src/de/javawi/jstun/attribute/ReflectedFrom.java
---- src-stun/de/javawi/jstun/attribute/ReflectedFrom.java	2009-03-08 13:34:16.000000000 +0100
-+++ src/de/javawi/jstun/attribute/ReflectedFrom.java	2009-10-03 14:48:06.624977962 +0200
-@@ -11,11 +11,9 @@
- 
- package de.javawi.jstun.attribute;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
- 
- public class ReflectedFrom extends MappedResponseChangedSourceAddressReflectedFrom {
--	private static final Logger LOGGER = LoggerFactory.getLogger(ReflectedFrom.class);
- 	
- 	public ReflectedFrom() {
- 		super(MessageAttribute.MessageAttributeType.ReflectedFrom);
-@@ -24,7 +22,7 @@
- 	public static ReflectedFrom parse(byte[] data) throws MessageAttributeParsingException {
- 		ReflectedFrom result = new ReflectedFrom();
- 		MappedResponseChangedSourceAddressReflectedFrom.parse(result, data);
--		LOGGER.debug("Message Attribute: ReflectedFrom parsed: " + result.toString() + ".");
-+		Log.d("Jstun-ReflectedFrom", "Message Attribute: ReflectedFrom parsed: " + result.toString() + ".");
- 		return result;
- 	}
- 
-diff -Nru src-stun/de/javawi/jstun/attribute/ResponseAddress.java src/de/javawi/jstun/attribute/ResponseAddress.java
---- src-stun/de/javawi/jstun/attribute/ResponseAddress.java	2009-03-08 13:35:02.000000000 +0100
-+++ src/de/javawi/jstun/attribute/ResponseAddress.java	2009-10-03 14:49:42.388979100 +0200
-@@ -11,12 +11,9 @@
- 
- package de.javawi.jstun.attribute;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
--
-+import android.util.Log;
- 
- public class ResponseAddress extends MappedResponseChangedSourceAddressReflectedFrom {
--	private static final Logger LOGGER = LoggerFactory.getLogger(ResponseAddress.class);
- 	public ResponseAddress() {
- 		super(MessageAttribute.MessageAttributeType.ResponseAddress);
- 	}
-@@ -24,7 +21,7 @@
- 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
- 		ResponseAddress ra = new ResponseAddress();
- 		MappedResponseChangedSourceAddressReflectedFrom.parse(ra, data);
--		LOGGER.debug("Message Attribute: Response Address parsed: " + ra.toString() + ".");
-+		Log.d("Jstun-ResponseAddress", "Message Attribute: Response Address parsed: " + ra.toString() + ".");
- 		return ra;
- 	}
- }
-diff -Nru src-stun/de/javawi/jstun/attribute/SourceAddress.java src/de/javawi/jstun/attribute/SourceAddress.java
---- src-stun/de/javawi/jstun/attribute/SourceAddress.java	2009-03-08 13:33:15.000000000 +0100
-+++ src/de/javawi/jstun/attribute/SourceAddress.java	2009-10-03 14:50:35.312972305 +0200
-@@ -11,12 +11,9 @@
- 
- package de.javawi.jstun.attribute;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
--
-+import android.util.Log;
- 
- public class SourceAddress extends MappedResponseChangedSourceAddressReflectedFrom {
--	private static final Logger LOGGER = LoggerFactory.getLogger(SourceAddress.class);
- 	public SourceAddress() {
- 		super(MessageAttribute.MessageAttributeType.SourceAddress);
- 	}
-@@ -24,7 +21,7 @@
- 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
- 		SourceAddress sa = new SourceAddress();
- 		MappedResponseChangedSourceAddressReflectedFrom.parse(sa, data);
--		LOGGER.debug("Message Attribute: Source Address parsed: " + sa.toString() + ".");
-+		Log.d("Jstun-SourceAddress", "Message Attribute: Source Address parsed: " + sa.toString() + ".");
- 		return sa;
- 	}
- }
-\ No newline at end of file
-diff -Nru src-stun/de/javawi/jstun/header/MessageHeader.java src/de/javawi/jstun/header/MessageHeader.java
---- src-stun/de/javawi/jstun/header/MessageHeader.java	2009-03-08 13:54:30.000000000 +0100
-+++ src/de/javawi/jstun/header/MessageHeader.java	2009-10-03 14:52:58.156973579 +0200
-@@ -14,8 +14,7 @@
- import java.util.Iterator;
- import java.util.TreeMap;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
- 
- import de.javawi.jstun.attribute.MessageAttribute;
- import de.javawi.jstun.attribute.MessageAttributeParsingException;
-@@ -38,7 +37,6 @@
-      *                                                                 |
-      * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- 	 */
--	private static final Logger LOGGER = LoggerFactory.getLogger(MessageHeader.class);
- 	MessageHeaderType type;
- 	byte[] id = new byte[16];
- 	
-@@ -169,12 +167,12 @@
- 			System.arraycopy(data, 0, typeArray, 0, 2);
- 			int type = Utility.twoBytesToInteger(typeArray);
- 			switch (type) {
--				case BINDINGREQUEST: mh.setType(MessageHeaderType.BindingRequest); LOGGER.debug("Binding Request received."); break;
--				case BINDINGRESPONSE: mh.setType(MessageHeaderType.BindingResponse); LOGGER.debug("Binding Response received."); break;
--				case BINDINGERRORRESPONSE: mh.setType(MessageHeaderType.BindingErrorResponse); LOGGER.debug("Binding Error Response received."); break;
--				case SHAREDSECRETREQUEST: mh.setType(MessageHeaderType.SharedSecretRequest); LOGGER.debug("Shared Secret Request received."); break;
--				case SHAREDSECRETRESPONSE: mh.setType(MessageHeaderType.SharedSecretResponse); LOGGER.debug("Shared Secret Response received."); break;
--				case SHAREDSECRETERRORRESPONSE: mh.setType(MessageHeaderType.SharedSecretErrorResponse); LOGGER.debug("Shared Secret Error Response received.");break;
-+				case BINDINGREQUEST: mh.setType(MessageHeaderType.BindingRequest); Log.d("Jstun-MessageHeader", "Binding Request received."); break;
-+				case BINDINGRESPONSE: mh.setType(MessageHeaderType.BindingResponse); Log.d("Jstun-MessageHeader", "Binding Response received."); break;
-+				case BINDINGERRORRESPONSE: mh.setType(MessageHeaderType.BindingErrorResponse); Log.d("Jstun-MessageHeader", "Binding Error Response received."); break;
-+				case SHAREDSECRETREQUEST: mh.setType(MessageHeaderType.SharedSecretRequest); Log.d("Jstun-MessageHeader", "Shared Secret Request received."); break;
-+				case SHAREDSECRETRESPONSE: mh.setType(MessageHeaderType.SharedSecretResponse); Log.d("Jstun-MessageHeader", "Shared Secret Response received."); break;
-+				case SHAREDSECRETERRORRESPONSE: mh.setType(MessageHeaderType.SharedSecretErrorResponse); Log.d("Jstun-MessageHeader", "Shared Secret Error Response received.");break;
- 				default: throw new MessageHeaderParsingException("Message type " + type + "is not supported"); 
- 			}
- 			return mh;
-diff -Nru src-stun/de/javawi/jstun/test/BindingLifetimeTest.java src/de/javawi/jstun/test/BindingLifetimeTest.java
---- src-stun/de/javawi/jstun/test/BindingLifetimeTest.java	2009-03-08 13:43:27.000000000 +0100
-+++ src/de/javawi/jstun/test/BindingLifetimeTest.java	2009-10-03 14:55:31.104990854 +0200
-@@ -21,8 +21,8 @@
- import java.util.Timer;
- import java.util.TimerTask;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
-+
- 
- import de.javawi.jstun.attribute.ChangeRequest;
- import de.javawi.jstun.attribute.ErrorCode;
-@@ -36,7 +36,6 @@
- import de.javawi.jstun.util.UtilityException;
- 
- public class BindingLifetimeTest {
--	private static final Logger LOGGER = LoggerFactory.getLogger(BindingLifetimeTest.class);
- 	String stunServer;
- 	int port;
- 	int timeout = 300; //ms
-@@ -70,7 +69,7 @@
- 		}
- 		BindingLifetimeTask task = new BindingLifetimeTask();
- 		timer.schedule(task, binarySearchLifetime);
--		LOGGER.debug("Timer scheduled initially: " + binarySearchLifetime + ".");
-+		Log.d("Jstun-BindingLifetimeTest", "Timer scheduled initially: " + binarySearchLifetime + ".");
- 	}
- 	
- 	private boolean bindingCommunicationInitialSocket() throws UtilityException, IOException, MessageHeaderParsingException, MessageAttributeParsingException {
-@@ -82,7 +81,7 @@
- 		
- 		DatagramPacket send = new DatagramPacket(data, data.length, InetAddress.getByName(stunServer), port);
- 		initialSocket.send(send);
--		LOGGER.debug("Binding Request sent.");
-+		Log.d("Jstun-BindingLifetimeTest", "Binding Request sent.");
- 	
- 		MessageHeader receiveMH = new MessageHeader();
- 		while (!(receiveMH.equalTransactionID(sendMH))) {
-@@ -94,11 +93,11 @@
- 		ma = (MappedAddress) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.MappedAddress);
- 		ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
- 		if (ec != null) {
--			LOGGER.debug("Message header contains an Errorcode message attribute.");
-+			Log.d("Jstun-BindingLifetimeTest", "Message header contains an Errorcode message attribute.");
- 			return true;
- 		}
- 		if (ma == null) {
--			LOGGER.debug("Response does not contain a Mapped Address message attribute.");
-+			Log.d("Jstun-BindingLifetimeTest", "Response does not contain a Mapped Address message attribute.");
- 			return true;
- 		}
- 		return false;
-@@ -127,7 +126,7 @@
- 			try {
- 				lifetimeQuery();
- 			} catch (Exception e) {
--				LOGGER.debug("Unhandled Exception. BindLifetimeTasks stopped.");
-+				Log.d("Jstun-BindingLifetimeTest", "Unhandled Exception. BindLifetimeTasks stopped.");
- 				e.printStackTrace();
- 			}
- 		}
-@@ -150,7 +149,7 @@
- 			
- 				DatagramPacket send = new DatagramPacket(data, data.length, InetAddress.getByName(stunServer), port);
- 				socket.send(send);
--				LOGGER.debug("Binding Request sent.");
-+				Log.d("Jstun-BindingLifetimeTest", "Binding Request sent.");
- 		
- 				MessageHeader receiveMH = new MessageHeader();
- 				while (!(receiveMH.equalTransactionID(sendMH))) {
-@@ -161,30 +160,30 @@
- 				}
- 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
- 				if (ec != null) {
--					LOGGER.debug("Message header contains errorcode message attribute.");
-+					Log.d("Jstun-BindingLifetimeTest", "Message header contains errorcode message attribute.");
- 					return;
- 				}
--				LOGGER.debug("Binding Response received.");
-+				Log.d("Jstun-BindingLifetimeTest", "Binding Response received.");
- 				if (upperBinarySearchLifetime == (lowerBinarySearchLifetime + 1)) {
--					LOGGER.debug("BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
-+					Log.d("Jstun-BindingLifetimeTest", "BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
- 					completed = true;
- 					return;
- 				}
- 				lifetime = binarySearchLifetime;
--				LOGGER.debug("Lifetime update: " + lifetime + ".");
-+				Log.d("Jstun-BindingLifetimeTest", "Lifetime update: " + lifetime + ".");
- 				lowerBinarySearchLifetime = binarySearchLifetime;
- 				binarySearchLifetime = (upperBinarySearchLifetime + lowerBinarySearchLifetime) / 2;
- 				if (binarySearchLifetime > 0) {
- 					BindingLifetimeTask task = new BindingLifetimeTask();
- 					timer.schedule(task, binarySearchLifetime);
--					LOGGER.debug("Timer scheduled: " + binarySearchLifetime + ".");
-+					Log.d("Jstun-BindingLifetimeTest", "Timer scheduled: " + binarySearchLifetime + ".");
- 				} else {
- 					completed = true;
- 				}
- 			} catch (SocketTimeoutException ste) {
--				LOGGER.debug("Read operation at query socket timeout.");
-+				Log.d("Jstun-BindingLifetimeTest", "Read operation at query socket timeout.");
- 				if (upperBinarySearchLifetime == (lowerBinarySearchLifetime + 1)) {
--					LOGGER.debug("BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
-+					Log.d("Jstun-BindingLifetimeTest", "BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
- 					completed = true;
- 					return;
- 				}
-@@ -196,7 +195,7 @@
- 					}
- 					BindingLifetimeTask task = new BindingLifetimeTask();
- 					timer.schedule(task, binarySearchLifetime);
--					LOGGER.debug("Timer scheduled: " + binarySearchLifetime + ".");
-+					Log.d("Jstun-BindingLifetimeTest", "Timer scheduled: " + binarySearchLifetime + ".");
- 				} else {
- 					completed = true;
- 				}
-diff -Nru src-stun/de/javawi/jstun/test/demo/ice/ICENegociator.java src/de/javawi/jstun/test/demo/ice/ICENegociator.java
---- src-stun/de/javawi/jstun/test/demo/ice/ICENegociator.java	2009-03-08 13:40:52.000000000 +0100
-+++ src/de/javawi/jstun/test/demo/ice/ICENegociator.java	2009-10-03 14:57:51.400971966 +0200
-@@ -23,9 +23,7 @@
- import java.util.List;
- import java.util.Vector;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
--
-+import android.util.Log;
- import de.javawi.jstun.attribute.MessageAttributeException;
- import de.javawi.jstun.header.MessageHeaderParsingException;
- import de.javawi.jstun.test.DiscoveryInfo;
-@@ -35,7 +33,6 @@
- import de.javawi.jstun.util.UtilityException;
- 
- public class ICENegociator {
--	private static final Logger LOGGER = LoggerFactory.getLogger(ICENegociator.class);
- 	// type preference must be an integer from 0 (=lowest) to 126 (=highest) (inclusive)
- 	private final static int LOCAL_PREFERENCE = 0;
- 	private final static int SERVER_REFLEXIVE_PREFERENCE = 42;
-@@ -91,29 +88,29 @@
- 								candidates.add(cand);
- 							}
- 						} catch (MessageHeaderParsingException mhpe) {
--							LOGGER.debug("MessageHeaderParsingException while gathering candidate addresses.");
-+							Log.d("Jstun-ICENegociator", "MessageHeaderParsingException while gathering candidate addresses.");
- 							mhpe.printStackTrace();
- 						} catch (MessageAttributeException mae) {
--							LOGGER.debug("MessageAttributeException while gathering candidate addresses.");
-+							Log.d("Jstun-ICENegociator", "MessageAttributeException while gathering candidate addresses.");
- 							mae.printStackTrace();	
- 						} catch (UtilityException ue) {
--							LOGGER.debug("UtilityException while gathering candidate addresses.");
-+							Log.d("Jstun-ICENegociator", "UtilityException while gathering candidate addresses.");
- 							ue.printStackTrace();
- 						} catch (UnknownHostException uhe) {
--							LOGGER.debug("MessageHeaderParsingException while gathering candidate addresses.");
-+							Log.d("Jstun-ICENegociator", "MessageHeaderParsingException while gathering candidate addresses.");
- 							uhe.printStackTrace();
- 						} catch (SocketException se) {
--							LOGGER.debug("SocketException while gathering candidate addresses.");
-+							Log.d("Jstun-ICENegociator", "SocketException while gathering candidate addresses.");
- 							se.printStackTrace();
- 						} catch (IOException ioe) {
--							LOGGER.debug("IOException while gathering candidate addresses.");
-+							Log.d("Jstun-ICENegociator", "IOException while gathering candidate addresses.");
- 							ioe.printStackTrace();
- 						}
- 					}
- 				}
- 			}
- 		} catch (SocketException se) {
--			LOGGER.debug("SocketException while enumatering over the network cards.");
-+			Log.d("Jstun-ICENegociator", "SocketException while enumatering over the network cards.");
- 			se.printStackTrace();
- 		}
- 	}
-diff -Nru src-stun/de/javawi/jstun/test/demo/StunServer.java src/de/javawi/jstun/test/demo/StunServer.java
---- src-stun/de/javawi/jstun/test/demo/StunServer.java	2009-03-08 13:52:00.000000000 +0100
-+++ src/de/javawi/jstun/test/demo/StunServer.java	2009-10-03 14:57:05.248972557 +0200
-@@ -23,8 +23,7 @@
- import java.util.logging.Level;
- import java.util.logging.SimpleFormatter;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
- 
- import de.javawi.jstun.attribute.ChangeRequest;
- import de.javawi.jstun.attribute.ChangedAddress;
-@@ -47,7 +46,6 @@
-  * The server requires a machine that is dual-homed to be functional. 
-  */
- public class StunServer {
--	private static final Logger LOGGER = LoggerFactory.getLogger(StunServer.class);
- 	Vector<DatagramSocket> sockets;
- 	
- 	public StunServer(int primaryPort, InetAddress primary, int secondaryPort, InetAddress secondary) throws SocketException {
-@@ -99,12 +97,12 @@
- 				try {
- 					DatagramPacket receive = new DatagramPacket(new byte[200], 200);
- 					receiverSocket.receive(receive);
--					LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " datagram received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
-+					Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " datagram received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
- 					MessageHeader receiveMH = MessageHeader.parseHeader(receive.getData()); 
- 					try {
- 						receiveMH.parseAttributes(receive.getData());
- 						if (receiveMH.getType() == MessageHeaderType.BindingRequest) {
--							LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " Binding Request received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
-+							Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " Binding Request received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
- 							ChangeRequest cr = (ChangeRequest) receiveMH.getMessageAttribute(MessageAttributeType.ChangeRequest);
- 							if (cr == null) throw new MessageAttributeException("Message attribute change request is not set.");
- 							ResponseAddress ra = (ResponseAddress) receiveMH.getMessageAttribute(MessageAttributeType.ResponseAddress);
-@@ -123,7 +121,7 @@
- 							ca.setPort(changedPortIP.getLocalPort());
- 							sendMH.addMessageAttribute(ca);
- 							if (cr.isChangePort() && (!cr.isChangeIP())) {
--								LOGGER.debug("Change port received in Change Request attribute");
-+								Log.d("Jstun-StunServer", "Change port received in Change Request attribute");
- 								// Source address attribute
- 								SourceAddress sa = new SourceAddress();
- 								sa.setAddress(new Address(changedPort.getLocalAddress().getAddress()));
-@@ -139,9 +137,9 @@
- 									send.setAddress(receive.getAddress());
- 								}
- 								changedPort.send(send);
--								LOGGER.debug(changedPort.getLocalAddress().getHostAddress() + ":" + changedPort.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
-+								Log.d("Jstun-StunServer", changedPort.getLocalAddress().getHostAddress() + ":" + changedPort.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
- 							} else if ((!cr.isChangePort()) && cr.isChangeIP()) {
--								LOGGER.debug("Change ip received in Change Request attribute");
-+								Log.d("Jstun-StunServer", "Change ip received in Change Request attribute");
- 								// Source address attribute
- 								SourceAddress sa = new SourceAddress();
- 								sa.setAddress(new Address(changedIP.getLocalAddress().getAddress()));
-@@ -157,9 +155,9 @@
- 									send.setAddress(receive.getAddress());
- 								}
- 								changedIP.send(send);
--								LOGGER.debug(changedIP.getLocalAddress().getHostAddress() + ":" + changedIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
-+								Log.d("Jstun-StunServer", changedIP.getLocalAddress().getHostAddress() + ":" + changedIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
- 							} else if ((!cr.isChangePort()) && (!cr.isChangeIP())) {
--								LOGGER.debug("Nothing received in Change Request attribute");
-+								Log.d("Jstun-StunServer", "Nothing received in Change Request attribute");
- 								// Source address attribute
- 								SourceAddress sa = new SourceAddress();
- 								sa.setAddress(new Address(receiverSocket.getLocalAddress().getAddress()));
-@@ -175,9 +173,9 @@
- 									send.setAddress(receive.getAddress());
- 								}
- 								receiverSocket.send(send);
--								LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
-+								Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
- 							} else if (cr.isChangePort() && cr.isChangeIP()) {
--								LOGGER.debug("Change port and ip received in Change Request attribute");
-+								Log.d("Jstun-StunServer", "Change port and ip received in Change Request attribute");
- 								// Source address attribute
- 								SourceAddress sa = new SourceAddress();
- 								sa.setAddress(new Address(changedPortIP.getLocalAddress().getAddress()));
-@@ -193,7 +191,7 @@
- 									send.setAddress(receive.getAddress());
- 								}
- 								changedPortIP.send(send);
--								LOGGER.debug(changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
-+								Log.d("Jstun-StunServer", changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
- 							}
- 						}
- 					} catch (UnknownMessageAttributeException umae) {
-@@ -212,7 +210,7 @@
- 						send.setPort(receive.getPort());
- 						send.setAddress(receive.getAddress());
- 						receiverSocket.send(send);
--						LOGGER.debug(changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Error Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
-+						Log.d("Jstun-StunServer", changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Error Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
- 					}	
- 				} catch (IOException ioe) {
- 					ioe.printStackTrace();
-diff -Nru src-stun/de/javawi/jstun/test/DiscoveryTest.java src/de/javawi/jstun/test/DiscoveryTest.java
---- src-stun/de/javawi/jstun/test/DiscoveryTest.java	2009-03-08 13:45:49.000000000 +0100
-+++ src/de/javawi/jstun/test/DiscoveryTest.java	2009-10-03 14:56:26.816979238 +0200
-@@ -20,8 +20,7 @@
- import java.net.SocketTimeoutException;
- import java.net.UnknownHostException;
- 
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
-+import android.util.Log;
- 
- import de.javawi.jstun.attribute.ChangeRequest;
- import de.javawi.jstun.attribute.ChangedAddress;
-@@ -35,7 +34,6 @@
- import de.javawi.jstun.util.UtilityException;
- 
- public class DiscoveryTest {
--	private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryTest.class);
- 	InetAddress iaddress;
- 	String stunServer;
- 	int port;
-@@ -93,7 +91,7 @@
- 				byte[] data = sendMH.getBytes();
- 				DatagramPacket send = new DatagramPacket(data, data.length);
- 				socketTest1.send(send);
--				LOGGER.debug("Test 1: Binding Request sent.");
-+				Log.d("Jstun-DiscoveryTest", "Test 1: Binding Request sent.");
- 			
- 				MessageHeader receiveMH = new MessageHeader();
- 				while (!(receiveMH.equalTransactionID(sendMH))) {
-@@ -108,35 +106,35 @@
- 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
- 				if (ec != null) {
- 					di.setError(ec.getResponseCode(), ec.getReason());
--					LOGGER.debug("Message header contains an Errorcode message attribute.");
-+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
- 					return false;
- 				}
- 				if ((ma == null) || (ca == null)) {
- 					di.setError(700, "The server is sending an incomplete response (Mapped Address and Changed Address message attributes are missing). The client should not retry.");
--					LOGGER.debug("Response does not contain a Mapped Address or Changed Address message attribute.");
-+					Log.d("Jstun-DiscoveryTest", "Response does not contain a Mapped Address or Changed Address message attribute.");
- 					return false;
- 				} else {
- 					di.setPublicIP(ma.getAddress().getInetAddress());
- 					if ((ma.getPort() == socketTest1.getLocalPort()) && (ma.getAddress().getInetAddress().equals(socketTest1.getLocalAddress()))) {
--						LOGGER.debug("Node is not natted.");
-+						Log.d("Jstun-DiscoveryTest", "Node is not natted.");
- 						nodeNatted = false;
- 					} else {
--						LOGGER.debug("Node is natted.");
-+						Log.d("Jstun-DiscoveryTest", "Node is natted.");
- 					}
- 					return true;
- 				}
- 			} catch (SocketTimeoutException ste) {
- 				if (timeSinceFirstTransmission < 7900) {
--					LOGGER.debug("Test 1: Socket timeout while receiving the response.");
-+					Log.d("Jstun-DiscoveryTest", "Test 1: Socket timeout while receiving the response.");
- 					timeSinceFirstTransmission += timeout;
- 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
- 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
- 					timeout = timeoutAddValue;
- 				} else {
- 					// node is not capable of udp communication
--					LOGGER.debug("Test 1: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
-+					Log.d("Jstun-DiscoveryTest", "Test 1: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
- 					di.setBlockedUDP();
--					LOGGER.debug("Node is not capable of UDP communication.");
-+					Log.d("Jstun-DiscoveryTest", "Node is not capable of UDP communication.");
- 					return false;
- 				}
- 			} 
-@@ -164,7 +162,7 @@
- 				byte[] data = sendMH.getBytes(); 
- 				DatagramPacket send = new DatagramPacket(data, data.length);
- 				sendSocket.send(send);
--				LOGGER.debug("Test 2: Binding Request sent.");
-+				Log.d("Jstun-DiscoveryTest", "Test 2: Binding Request sent.");
- 				
- 				int localPort = sendSocket.getLocalPort();
- 				InetAddress localAddress = sendSocket.getLocalAddress();
-@@ -185,29 +183,29 @@
- 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
- 				if (ec != null) {
- 					di.setError(ec.getResponseCode(), ec.getReason());
--					LOGGER.debug("Message header contains an Errorcode message attribute.");
-+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
- 					return false;
- 				}
- 				if (!nodeNatted) {
- 					di.setOpenAccess();
--					LOGGER.debug("Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation).");
-+					Log.d("Jstun-DiscoveryTest", "Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation).");
- 				} else {
- 					di.setFullCone();
--					LOGGER.debug("Node is behind a full-cone NAT.");
-+					Log.d("Jstun-DiscoveryTest", "Node is behind a full-cone NAT.");
- 				}
- 				return false;
- 			} catch (SocketTimeoutException ste) {
- 				if (timeSinceFirstTransmission < 7900) {
--					LOGGER.debug("Test 2: Socket timeout while receiving the response.");
-+					Log.d("Jstun-DiscoveryTest", "Test 2: Socket timeout while receiving the response.");
- 					timeSinceFirstTransmission += timeout;
- 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
- 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
- 					timeout = timeoutAddValue;
- 				} else {
--					LOGGER.debug("Test 2: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
-+					Log.d("Jstun-DiscoveryTest", "Test 2: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
- 					if (!nodeNatted) {
- 						di.setSymmetricUDPFirewall();
--						LOGGER.debug("Node is behind a symmetric UDP firewall.");
-+						Log.d("Jstun-DiscoveryTest", "Node is behind a symmetric UDP firewall.");
- 						return false;
- 					} else {
- 						// not is natted
-@@ -238,7 +236,7 @@
- 				byte[] data = sendMH.getBytes();
- 				DatagramPacket send = new DatagramPacket(data, data.length);
- 				socketTest1.send(send);
--				LOGGER.debug("Test 1 redo with changed address: Binding Request sent.");
-+				Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Binding Request sent.");
- 				
- 				MessageHeader receiveMH = new MessageHeader();
- 				while (!(receiveMH.equalTransactionID(sendMH))) {
-@@ -251,30 +249,30 @@
- 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
- 				if (ec != null) {
- 					di.setError(ec.getResponseCode(), ec.getReason());
--					LOGGER.debug("Message header contains an Errorcode message attribute.");
-+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
- 					return false;
- 				}
- 				if (ma2 == null) {
- 					di.setError(700, "The server is sending an incomplete response (Mapped Address message attribute is missing). The client should not retry.");
--					LOGGER.debug("Response does not contain a Mapped Address message attribute.");
-+					Log.d("Jstun-DiscoveryTest", "Response does not contain a Mapped Address message attribute.");
- 					return false;
- 				} else {
- 					if ((ma.getPort() != ma2.getPort()) || (!(ma.getAddress().getInetAddress().equals(ma2.getAddress().getInetAddress())))) {
- 						di.setSymmetric();
--						LOGGER.debug("Node is behind a symmetric NAT.");
-+						Log.d("Jstun-DiscoveryTest", "Node is behind a symmetric NAT.");
- 						return false;
- 					}
- 				}
- 				return true;
- 			} catch (SocketTimeoutException ste2) {
- 				if (timeSinceFirstTransmission < 7900) {
--					LOGGER.debug("Test 1 redo with changed address: Socket timeout while receiving the response.");
-+					Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Socket timeout while receiving the response.");
- 					timeSinceFirstTransmission += timeout;
- 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
- 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
- 					timeout = timeoutAddValue;
- 				} else {
--					LOGGER.debug("Test 1 redo with changed address: Socket timeout while receiving the response.  Maximum retry limit exceed. Give up.");
-+					Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Socket timeout while receiving the response.  Maximum retry limit exceed. Give up.");
- 					return false;
- 				}
- 			}
-@@ -301,7 +299,7 @@
- 				byte[] data = sendMH.getBytes();
- 				DatagramPacket send = new DatagramPacket(data, data.length);
- 				sendSocket.send(send);
--				LOGGER.debug("Test 3: Binding Request sent.");
-+				Log.d("Jstun-DiscoveryTest", "Test 3: Binding Request sent.");
- 				
- 				int localPort = sendSocket.getLocalPort();
- 				InetAddress localAddress = sendSocket.getLocalAddress();
-@@ -322,25 +320,25 @@
- 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
- 				if (ec != null) {
- 					di.setError(ec.getResponseCode(), ec.getReason());
--					LOGGER.debug("Message header contains an Errorcode message attribute.");
-+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
- 					return;
- 				}
- 				if (nodeNatted) {
- 					di.setRestrictedCone();
--					LOGGER.debug("Node is behind a restricted NAT.");
-+					Log.d("Jstun-DiscoveryTest", "Node is behind a restricted NAT.");
- 					return;
- 				}
- 			} catch (SocketTimeoutException ste) {
- 				if (timeSinceFirstTransmission < 7900) {
--					LOGGER.debug("Test 3: Socket timeout while receiving the response.");
-+					Log.d("Jstun-DiscoveryTest", "Test 3: Socket timeout while receiving the response.");
- 					timeSinceFirstTransmission += timeout;
- 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
- 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
- 					timeout = timeoutAddValue;
- 				} else {
--					LOGGER.debug("Test 3: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
-+					Log.d("Jstun-DiscoveryTest", "Test 3: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
- 					di.setPortRestrictedCone();
--					LOGGER.debug("Node is behind a port restricted NAT.");
-+					Log.d("Jstun-DiscoveryTest", "Node is behind a port restricted NAT.");
- 					return;
- 				}
- 			}
--- a/libs/new-android-r1.diff	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,436 +0,0 @@
-Index: source/org/jivesoftware/smack/XMPPConnection.java
-===================================================================
---- source/org/jivesoftware/smack/XMPPConnection.java	(révision 10982)
-+++ source/org/jivesoftware/smack/XMPPConnection.java	(copie de travail)
-@@ -1082,7 +1082,7 @@
-                     catch (Exception ex) {
-                         try {
-                             debuggerClass =
--                                    Class.forName("org.jivesoftware.smack.debugger.LiteDebugger");
-+                                    Class.forName("org.jivesoftware.smack.debugger.ConsoleDebugger");
-                         }
-                         catch (Exception ex2) {
-                             ex2.printStackTrace();
-Index: source/org/jivesoftware/smack/sasl/SASLMechanism.java
-===================================================================
---- source/org/jivesoftware/smack/sasl/SASLMechanism.java	(révision 10982)
-+++ source/org/jivesoftware/smack/sasl/SASLMechanism.java	(copie de travail)
-@@ -20,24 +20,18 @@
- 
- package org.jivesoftware.smack.sasl;
- 
--import org.jivesoftware.smack.XMPPException;
--import org.jivesoftware.smack.SASLAuthentication;
--import org.jivesoftware.smack.util.Base64;
--
- import java.io.IOException;
--import java.util.Map;
- import java.util.HashMap;
-+import java.util.Map;
-+
-+import javax.security.auth.callback.Callback;
- import javax.security.auth.callback.CallbackHandler;
- import javax.security.auth.callback.UnsupportedCallbackException;
--import javax.security.auth.callback.Callback;
--import javax.security.auth.callback.NameCallback;
--import javax.security.auth.callback.PasswordCallback;
--import javax.security.sasl.RealmCallback;
--import javax.security.sasl.RealmChoiceCallback;
--import javax.security.sasl.Sasl;
--import javax.security.sasl.SaslClient;
--import javax.security.sasl.SaslException;
- 
-+import org.jivesoftware.smack.SASLAuthentication;
-+import org.jivesoftware.smack.XMPPException;
-+import org.jivesoftware.smack.util.Base64;
-+
- /**
-  * Base class for SASL mechanisms. Subclasses must implement these methods:
-  * <ul>
-@@ -56,7 +50,7 @@
- public abstract class SASLMechanism implements CallbackHandler {
- 
-     private SASLAuthentication saslAuthentication;
--    protected SaslClient sc;
-+    //protected SaslClient sc;
-     protected String authenticationId;
-     protected String password;
-     protected String hostname;
-@@ -88,7 +82,7 @@
- 
-         String[] mechanisms = { getName() };
-         Map<String,String> props = new HashMap<String,String>();
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-         authenticate();
-     }
- 
-@@ -105,7 +99,7 @@
-     public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
-         String[] mechanisms = { getName() };
-         Map<String,String> props = new HashMap<String,String>();
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-         authenticate();
-     }
- 
-@@ -113,17 +107,17 @@
-         StringBuilder stanza = new StringBuilder();
-         stanza.append("<auth mechanism=\"").append(getName());
-         stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
--        try {
--            if(sc.hasInitialResponse()) {
--                byte[] response = sc.evaluateChallenge(new byte[0]);
--                String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
--                if(authenticationText != null && !authenticationText.equals("")) {                 
--                    stanza.append(authenticationText);
--                }
--            }
--        } catch (SaslException e) {
--            throw new XMPPException("SASL authentication failed", e);
--        }
-+//        try {
-+//            if(sc.hasInitialResponse()) {
-+//                byte[] response = sc.evaluateChallenge(new byte[0]);
-+//                String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
-+//                if(authenticationText != null && !authenticationText.equals("")) {                 
-+//                    stanza.append(authenticationText);
-+//                }
-+//            }
-+//        } catch (SaslException e) {
-+//            throw new XMPPException("SASL authentication failed", e);
-+//        }
-         stanza.append("</auth>");
- 
-         // Send the authentication to the server
-@@ -142,12 +136,12 @@
-         // Build the challenge response stanza encoding the response text
-         StringBuilder stanza = new StringBuilder();
- 
--        byte response[];
--        if(challenge != null) {
--            response = sc.evaluateChallenge(Base64.decode(challenge));
--        } else {
--            response = sc.evaluateChallenge(null);
--        }
-+        byte response[] = null;
-+//        if(challenge != null) {
-+//            response = sc.evaluateChallenge(Base64.decode(challenge));
-+//        } else {
-+//            response = sc.evaluateChallenge(null);
-+//        }
- 
-         String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
-         if(authenticationText.equals("")) {
-@@ -179,21 +173,21 @@
-      */
-     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-         for (int i = 0; i < callbacks.length; i++) {
--            if (callbacks[i] instanceof NameCallback) {
--                NameCallback ncb = (NameCallback)callbacks[i];
--                ncb.setName(authenticationId);
--            } else if(callbacks[i] instanceof PasswordCallback) {
--                PasswordCallback pcb = (PasswordCallback)callbacks[i];
--                pcb.setPassword(password.toCharArray());
--            } else if(callbacks[i] instanceof RealmCallback) {
--                RealmCallback rcb = (RealmCallback)callbacks[i];
--                rcb.setText(hostname);
--            } else if(callbacks[i] instanceof RealmChoiceCallback){
--                //unused
--                //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
--            } else {
-+//            if (callbacks[i] instanceof NameCallback) {
-+//                NameCallback ncb = (NameCallback)callbacks[i];
-+//                ncb.setName(authenticationId);
-+//            } else if(callbacks[i] instanceof PasswordCallback) {
-+//                PasswordCallback pcb = (PasswordCallback)callbacks[i];
-+//                pcb.setPassword(password.toCharArray());
-+//            } else if(callbacks[i] instanceof RealmCallback) {
-+//                RealmCallback rcb = (RealmCallback)callbacks[i];
-+//                rcb.setText(hostname);
-+//            } else if(callbacks[i] instanceof RealmChoiceCallback){
-+//                //unused
-+//                //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
-+//            } else {
-                throw new UnsupportedCallbackException(callbacks[i]);
--            }
-+            //}
-          }
-     }
- }
-Index: source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java
-===================================================================
---- source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	(révision 10982)
-+++ source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	(copie de travail)
-@@ -25,8 +25,6 @@
- import java.io.IOException;
- import java.util.Map;
- import java.util.HashMap;
--import javax.security.sasl.Sasl;
--import javax.security.sasl.SaslClient;
- import javax.security.auth.callback.CallbackHandler;
- 
- /**
-@@ -62,8 +60,8 @@
-     public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
-         String[] mechanisms = { getName() };
-         Map props = new HashMap();
--        props.put(Sasl.SERVER_AUTH,"TRUE");
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-+        //props.put(Sasl.SERVER_AUTH,"TRUE");
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-         authenticate();
-     }
- 
-@@ -81,8 +79,8 @@
-     public void authenticate(String username, String host, String password) throws IOException, XMPPException {
-         String[] mechanisms = { getName() };
-         Map props = new HashMap();
--        props.put(Sasl.SERVER_AUTH,"TRUE");
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-+        //props.put(Sasl.SERVER_AUTH,"TRUE");
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-         authenticate();
-     }
- 
-Index: source/org/jivesoftware/smack/ConnectionConfiguration.java
-===================================================================
---- source/org/jivesoftware/smack/ConnectionConfiguration.java	(révision 10982)
-+++ source/org/jivesoftware/smack/ConnectionConfiguration.java	(copie de travail)
-@@ -57,13 +57,13 @@
- 
-     private boolean compressionEnabled = false;
- 
--    private boolean saslAuthenticationEnabled = true;
-+    private boolean saslAuthenticationEnabled = false;
-     /**
-      * Used to get information from the user
-      */
-     private CallbackHandler callbackHandler;
- 
--    private boolean debuggerEnabled = XMPPConnection.DEBUG_ENABLED;
-+    private boolean debuggerEnabled = true;//XMPPConnection.DEBUG_ENABLED;
- 
-     // Flag that indicates if a reconnection should be attempted when abruptly disconnected
-     private boolean reconnectionAllowed = true;
-@@ -517,7 +517,7 @@
-      *        logging into the server.
-      */
-     public void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled) {
--        this.saslAuthenticationEnabled = saslAuthenticationEnabled;
-+        //this.saslAuthenticationEnabled = saslAuthenticationEnabled;
-     }
- 
-     /**
-Index: source/org/jivesoftware/smack/util/DNSUtil.java
-===================================================================
---- source/org/jivesoftware/smack/util/DNSUtil.java	(révision 10982)
-+++ source/org/jivesoftware/smack/util/DNSUtil.java	(copie de travail)
-@@ -24,9 +24,6 @@
- 
- import javax.naming.NamingEnumeration;
- import javax.naming.directory.Attribute;
--import javax.naming.directory.Attributes;
--import javax.naming.directory.DirContext;
--import javax.naming.directory.InitialDirContext;
- 
- /**
-  * Utilty class to perform DNS lookups for XMPP services.
-@@ -41,13 +38,13 @@
-      */
-     private static Map cache = new Cache(100, 1000*60*10);
- 
--    private static DirContext context;
-+//    private static DirContext context;
- 
-     static {
-         try {
-             Hashtable env = new Hashtable();
-             env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
--            context = new InitialDirContext(env);
-+ //           context = new InitialDirContext(env);
-         }
-         catch (Exception e) {
-             // Ignore.
-@@ -79,64 +76,7 @@
-      *      server can be reached at for the specified domain.
-      */
-     public static HostAddress resolveXMPPDomain(String domain) {
--        if (context == null) {
-             return new HostAddress(domain, 5222);
--        }
--        String key = "c" + domain;
--        // Return item from cache if it exists.
--        if (cache.containsKey(key)) {
--            HostAddress address = (HostAddress)cache.get(key);
--            if (address != null) {
--                return address;
--            }
--        }
--        String bestHost = domain;
--        int bestPort = 5222;
--        int bestPriority = 0;
--        int bestWeight = 0;
--        try {
--            Attributes dnsLookup = context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
--            Attribute srvAttribute = dnsLookup.get("SRV");
--            NamingEnumeration srvRecords = srvAttribute.getAll();
--            while(srvRecords.hasMore()) {
--				String srvRecord = (String) srvRecords.next();
--	            String [] srvRecordEntries = srvRecord.split(" ");
--	            int priority = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 4]);
--	            int port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--	            int weight = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 3]);
--	            String host = srvRecordEntries[srvRecordEntries.length-1];
--	            
--	            // Randomize the weight.
--	            weight *= Math.random() * weight;
--	            
--	            if ((bestPriority == 0) || (priority < bestPriority)) {
--	            	// Choose a server with the lowest priority.
--	            	bestPriority = priority;
--	            	bestWeight = weight;
--	            	bestHost = host;
--	            	bestPort = port;
--	            } else if (priority == bestPriority) {
--	            	// When we have like priorities then randomly choose a server based on its weight
--	            	// The weights were randomized above.
--	            	if (weight > bestWeight) {
--	            		bestWeight = weight;
--	            		bestHost = host;
--	            		bestPort = port;
--	            	}
--	            }
--			}
--        }
--        catch (Exception e) {
--            // Ignore.
--        }
--        // Host entries in DNS should end with a ".".
--        if (bestHost.endsWith(".")) {
--        	bestHost = bestHost.substring(0, bestHost.length()-1);
--        }
--        HostAddress address = new HostAddress(bestHost, bestPort);
--        // Add item to cache.
--        cache.put(key, address);
--        return address;
-     }
- 
-     /**
-@@ -157,49 +97,7 @@
-      *      server can be reached at for the specified domain.
-      */
-     public static HostAddress resolveXMPPServerDomain(String domain) {
--        if (context == null) {
-             return new HostAddress(domain, 5269);
--        }
--        String key = "s" + domain;
--        // Return item from cache if it exists.
--        if (cache.containsKey(key)) {
--            HostAddress address = (HostAddress)cache.get(key);
--            if (address != null) {
--                return address;
--            }
--        }
--        String host = domain;
--        int port = 5269;
--        try {
--            Attributes dnsLookup =
--                    context.getAttributes("_xmpp-server._tcp." + domain, new String[]{"SRV"});
--            String srvRecord = (String)dnsLookup.get("SRV").get();
--            String [] srvRecordEntries = srvRecord.split(" ");
--            port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--            host = srvRecordEntries[srvRecordEntries.length-1];
--        }
--        catch (Exception e) {
--            // Attempt lookup with older "jabber" name.
--            try {
--                Attributes dnsLookup =
--                        context.getAttributes("_jabber._tcp." + domain, new String[]{"SRV"});
--                String srvRecord = (String)dnsLookup.get("SRV").get();
--                String [] srvRecordEntries = srvRecord.split(" ");
--                port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--                host = srvRecordEntries[srvRecordEntries.length-1];
--            }
--            catch (Exception e2) {
--                // Ignore.
--            }
--        }
--        // Host entries in DNS should end with a ".".
--        if (host.endsWith(".")) {
--            host = host.substring(0, host.length()-1);
--        }
--        HostAddress address = new HostAddress(host, port);
--        // Add item to cache.
--        cache.put(key, address);
--        return address;
-     }
- 
-     /**
-@@ -253,4 +151,4 @@
-             return port == address.port;
-         }
-     }
--}
-\ No newline at end of file
-+}
-Index: source/org/jivesoftware/smack/util/PacketParserUtils.java
-===================================================================
---- source/org/jivesoftware/smack/util/PacketParserUtils.java	(révision 10982)
-+++ source/org/jivesoftware/smack/util/PacketParserUtils.java	(copie de travail)
-@@ -25,7 +25,7 @@
- import org.jivesoftware.smack.provider.ProviderManager;
- import org.xmlpull.v1.XmlPullParser;
- 
--import java.beans.PropertyDescriptor;
-+//import java.beans.PropertyDescriptor;
- import java.io.ByteArrayInputStream;
- import java.io.ObjectInputStream;
- import java.util.ArrayList;
-@@ -428,26 +428,26 @@
-     {
-         boolean done = false;
-         Object object = objectClass.newInstance();
--        while (!done) {
--            int eventType = parser.next();
--            if (eventType == XmlPullParser.START_TAG) {
--                String name = parser.getName();
--                String stringValue = parser.nextText();
--                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
--                // Load the class type of the property.
--                Class propertyType = descriptor.getPropertyType();
--                // Get the value of the property by converting it from a
--                // String to the correct object type.
--                Object value = decode(propertyType, stringValue);
--                // Set the value of the bean.
--                descriptor.getWriteMethod().invoke(object, value);
--            }
--            else if (eventType == XmlPullParser.END_TAG) {
--                if (parser.getName().equals(elementName)) {
--                    done = true;
--                }
--            }
--        }
-+//        while (!done) {
-+//            int eventType = parser.next();
-+//            if (eventType == XmlPullParser.START_TAG) {
-+//                String name = parser.getName();
-+//                String stringValue = parser.nextText();
-+//                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
-+//                // Load the class type of the property.
-+//                Class propertyType = descriptor.getPropertyType();
-+//                // Get the value of the property by converting it from a
-+//                // String to the correct object type.
-+//                Object value = decode(propertyType, stringValue);
-+//                // Set the value of the bean.
-+//                descriptor.getWriteMethod().invoke(object, value);
-+//            }
-+//            else if (eventType == XmlPullParser.END_TAG) {
-+//                if (parser.getName().equals(elementName)) {
-+//                    done = true;
-+//                }
-+//            }
-+//        }
-         return object;
-     }
- 
--- a/libs/patch-smack-android-sasl.diff	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2074 +0,0 @@
-diff -Nbdru org/jivesoftware/smack/ConnectionConfiguration.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/ConnectionConfiguration.java
---- org/jivesoftware/smack/ConnectionConfiguration.java	2009-06-26 21:11:24.609252239 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/ConnectionConfiguration.java	2009-06-25 22:41:46.281648000 +0200
-@@ -63,7 +63,7 @@
-      */
-     private CallbackHandler callbackHandler;
- 
--    private boolean debuggerEnabled = XMPPConnection.DEBUG_ENABLED;
-+    private boolean debuggerEnabled = false;
- 
-     // Flag that indicates if a reconnection should be attempted when abruptly disconnected
-     private boolean reconnectionAllowed = true;
-diff -Nbdru org/jivesoftware/smack/debugger/LiteDebugger.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/debugger/LiteDebugger.java
---- org/jivesoftware/smack/debugger/LiteDebugger.java	2009-06-26 21:11:22.316252115 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/debugger/LiteDebugger.java	1970-01-01 01:00:00.000000000 +0100
-@@ -1,336 +0,0 @@
--/**
-- * $RCSfile$
-- * $Revision: 7071 $
-- * $Date: 2007-02-12 01:59:05 +0100 (Mon, 12 Feb 2007) $
-- *
-- * Copyright 2003-2007 Jive Software.
-- *
-- * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
-- * you may not use this file except in compliance with the License.
-- * You may obtain a copy of the License at
-- *
-- *     http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.jivesoftware.smack.debugger;
--
--import java.awt.*;
--import java.awt.datatransfer.*;
--import java.awt.event.*;
--import java.io.*;
--
--import javax.swing.*;
--
--import org.jivesoftware.smack.*;
--import org.jivesoftware.smack.packet.*;
--import org.jivesoftware.smack.util.*;
--
--/**
-- * The LiteDebugger is a very simple debugger that allows to debug sent, received and 
-- * interpreted messages.
-- * 
-- * @author Gaston Dombiak
-- */
--public class LiteDebugger implements SmackDebugger {
--
--    private static final String NEWLINE = "\n";
--
--    private JFrame frame = null;
--    private XMPPConnection connection = null;
--
--    private PacketListener listener = null;
--
--    private Writer writer;
--    private Reader reader;
--    private ReaderListener readerListener;
--    private WriterListener writerListener;
--
--    public LiteDebugger(XMPPConnection connection, Writer writer, Reader reader) {
--        this.connection = connection;
--        this.writer = writer;
--        this.reader = reader;
--        createDebug();
--    }
--
--    /**
--     * Creates the debug process, which is a GUI window that displays XML traffic.
--     */
--    private void createDebug() {
--        frame = new JFrame("Smack Debug Window -- " + connection.getServiceName() + ":" +
--                connection.getPort());
--
--        // Add listener for window closing event 
--        frame.addWindowListener(new WindowAdapter() {
--            public void windowClosing(WindowEvent evt) {
--                rootWindowClosing(evt);
--            }
--        });
--
--        // We'll arrange the UI into four tabs. The first tab contains all data, the second
--        // client generated XML, the third server generated XML, and the fourth is packet
--        // data from the server as seen by Smack.
--        JTabbedPane tabbedPane = new JTabbedPane();
--
--        JPanel allPane = new JPanel();
--        allPane.setLayout(new GridLayout(3, 1));
--        tabbedPane.add("All", allPane);
--
--        // Create UI elements for client generated XML traffic.
--        final JTextArea sentText1 = new JTextArea();
--        final JTextArea sentText2 = new JTextArea();
--        sentText1.setEditable(false);
--        sentText2.setEditable(false);
--        sentText1.setForeground(new Color(112, 3, 3));
--        sentText2.setForeground(new Color(112, 3, 3));
--        allPane.add(new JScrollPane(sentText1));
--        tabbedPane.add("Sent", new JScrollPane(sentText2));
--
--        // Add pop-up menu.
--        JPopupMenu menu = new JPopupMenu();
--        JMenuItem menuItem1 = new JMenuItem("Copy");
--        menuItem1.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Get the clipboard
--                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
--                // Set the sent text as the new content of the clipboard
--                clipboard.setContents(new StringSelection(sentText1.getText()), null);
--            }
--        });
--
--        JMenuItem menuItem2 = new JMenuItem("Clear");
--        menuItem2.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                sentText1.setText("");
--                sentText2.setText("");
--            }
--        });
--
--        // Add listener to the text area so the popup menu can come up.
--        MouseListener popupListener = new PopupListener(menu);
--        sentText1.addMouseListener(popupListener);
--        sentText2.addMouseListener(popupListener);
--        menu.add(menuItem1);
--        menu.add(menuItem2);
--
--        // Create UI elements for server generated XML traffic.
--        final JTextArea receivedText1 = new JTextArea();
--        final JTextArea receivedText2 = new JTextArea();
--        receivedText1.setEditable(false);
--        receivedText2.setEditable(false);
--        receivedText1.setForeground(new Color(6, 76, 133));
--        receivedText2.setForeground(new Color(6, 76, 133));
--        allPane.add(new JScrollPane(receivedText1));
--        tabbedPane.add("Received", new JScrollPane(receivedText2));
--
--        // Add pop-up menu.
--        menu = new JPopupMenu();
--        menuItem1 = new JMenuItem("Copy");
--        menuItem1.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Get the clipboard
--                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
--                // Set the sent text as the new content of the clipboard
--                clipboard.setContents(new StringSelection(receivedText1.getText()), null);
--            }
--        });
--
--        menuItem2 = new JMenuItem("Clear");
--        menuItem2.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                receivedText1.setText("");
--                receivedText2.setText("");
--            }
--        });
--
--        // Add listener to the text area so the popup menu can come up.
--        popupListener = new PopupListener(menu);
--        receivedText1.addMouseListener(popupListener);
--        receivedText2.addMouseListener(popupListener);
--        menu.add(menuItem1);
--        menu.add(menuItem2);
--
--        // Create UI elements for interpreted XML traffic.
--        final JTextArea interpretedText1 = new JTextArea();
--        final JTextArea interpretedText2 = new JTextArea();
--        interpretedText1.setEditable(false);
--        interpretedText2.setEditable(false);
--        interpretedText1.setForeground(new Color(1, 94, 35));
--        interpretedText2.setForeground(new Color(1, 94, 35));
--        allPane.add(new JScrollPane(interpretedText1));
--        tabbedPane.add("Interpreted", new JScrollPane(interpretedText2));
--
--        // Add pop-up menu.
--        menu = new JPopupMenu();
--        menuItem1 = new JMenuItem("Copy");
--        menuItem1.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Get the clipboard
--                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
--                // Set the sent text as the new content of the clipboard
--                clipboard.setContents(new StringSelection(interpretedText1.getText()), null);
--            }
--        });
--
--        menuItem2 = new JMenuItem("Clear");
--        menuItem2.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                interpretedText1.setText("");
--                interpretedText2.setText("");
--            }
--        });
--
--        // Add listener to the text area so the popup menu can come up.
--        popupListener = new PopupListener(menu);
--        interpretedText1.addMouseListener(popupListener);
--        interpretedText2.addMouseListener(popupListener);
--        menu.add(menuItem1);
--        menu.add(menuItem2);
--
--        frame.getContentPane().add(tabbedPane);
--
--        frame.setSize(550, 400);
--        frame.setVisible(true);
--
--        // Create a special Reader that wraps the main Reader and logs data to the GUI.
--        ObservableReader debugReader = new ObservableReader(reader);
--        readerListener = new ReaderListener() {
--                    public void read(String str) {
--                        int index = str.lastIndexOf(">");
--                        if (index != -1) {
--                            receivedText1.append(str.substring(0, index + 1));
--                            receivedText2.append(str.substring(0, index + 1));
--                            receivedText1.append(NEWLINE);
--                            receivedText2.append(NEWLINE);
--                            if (str.length() > index) {
--                                receivedText1.append(str.substring(index + 1));
--                                receivedText2.append(str.substring(index + 1));
--                            }
--                        }
--                        else {
--                            receivedText1.append(str);
--                            receivedText2.append(str);
--                        }
--                    }
--                };
--        debugReader.addReaderListener(readerListener);
--
--        // Create a special Writer that wraps the main Writer and logs data to the GUI.
--        ObservableWriter debugWriter = new ObservableWriter(writer);
--        writerListener = new WriterListener() {
--                    public void write(String str) {
--                        sentText1.append(str);
--                        sentText2.append(str);
--                        if (str.endsWith(">")) {
--                            sentText1.append(NEWLINE);
--                            sentText2.append(NEWLINE);
--                        }
--                    }
--                };
--        debugWriter.addWriterListener(writerListener);
--
--        // Assign the reader/writer objects to use the debug versions. The packet reader
--        // and writer will use the debug versions when they are created.
--        reader = debugReader;
--        writer = debugWriter;
--
--        // Create a thread that will listen for all incoming packets and write them to
--        // the GUI. This is what we call "interpreted" packet data, since it's the packet
--        // data as Smack sees it and not as it's coming in as raw XML.
--        listener = new PacketListener() {
--            public void processPacket(Packet packet) {
--                interpretedText1.append(packet.toXML());
--                interpretedText2.append(packet.toXML());
--                interpretedText1.append(NEWLINE);
--                interpretedText2.append(NEWLINE);
--            }
--        };
--    }
--
--    /**
--     * Notification that the root window is closing. Stop listening for received and 
--     * transmitted packets.
--     * 
--     * @param evt the event that indicates that the root window is closing 
--     */
--    public void rootWindowClosing(WindowEvent evt) {
--        connection.removePacketListener(listener);
--        ((ObservableReader)reader).removeReaderListener(readerListener);
--        ((ObservableWriter)writer).removeWriterListener(writerListener);
--    }
--
--    /**
--     * Listens for debug window popup dialog events.
--     */
--    private class PopupListener extends MouseAdapter {
--        JPopupMenu popup;
--
--        PopupListener(JPopupMenu popupMenu) {
--            popup = popupMenu;
--        }
--
--        public void mousePressed(MouseEvent e) {
--            maybeShowPopup(e);
--        }
--
--        public void mouseReleased(MouseEvent e) {
--            maybeShowPopup(e);
--        }
--
--        private void maybeShowPopup(MouseEvent e) {
--            if (e.isPopupTrigger()) {
--                popup.show(e.getComponent(), e.getX(), e.getY());
--            }
--        }
--    }
--
--    public Reader newConnectionReader(Reader newReader) {
--        ((ObservableReader)reader).removeReaderListener(readerListener);
--        ObservableReader debugReader = new ObservableReader(newReader);
--        debugReader.addReaderListener(readerListener);
--        reader = debugReader;
--        return reader;
--    }
--
--    public Writer newConnectionWriter(Writer newWriter) {
--        ((ObservableWriter)writer).removeWriterListener(writerListener);
--        ObservableWriter debugWriter = new ObservableWriter(newWriter);
--        debugWriter.addWriterListener(writerListener);
--        writer = debugWriter;
--        return writer;
--    }
--
--    public void userHasLogged(String user) {
--        boolean isAnonymous = "".equals(StringUtils.parseName(user));
--        String title =
--            "Smack Debug Window -- "
--                + (isAnonymous ? "" : StringUtils.parseBareAddress(user))
--                + "@"
--                + connection.getServiceName()
--                + ":"
--                + connection.getPort();
--        title += "/" + StringUtils.parseResource(user);
--        frame.setTitle(title);
--    }
--
--    public Reader getReader() {
--        return reader;
--    }
--
--    public Writer getWriter() {
--        return writer;
--    }
--
--    public PacketListener getReaderListener() {
--        return listener;
--    }
--
--    public PacketListener getWriterListener() {
--        return null;
--    }
--}
-diff -Nbdru org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java
---- org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	2009-06-26 21:11:23.436473310 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	2009-06-26 20:56:01.656252399 +0200
-@@ -25,8 +25,9 @@
- import java.io.IOException;
- import java.util.Map;
- import java.util.HashMap;
--import javax.security.sasl.Sasl;
--import javax.security.sasl.SaslClient;
-+
-+import security.javax.security.sasl.Sasl;
-+
- import javax.security.auth.callback.CallbackHandler;
- 
- /**
-@@ -63,7 +64,7 @@
-         String[] mechanisms = { getName() };
-         Map props = new HashMap();
-         props.put(Sasl.SERVER_AUTH,"TRUE");
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-+        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, (javax.security.auth.callback.CallbackHandler)cbh);
-         authenticate();
-     }
- 
-diff -Nbdru org/jivesoftware/smack/sasl/SASLMechanism.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/sasl/SASLMechanism.java
---- org/jivesoftware/smack/sasl/SASLMechanism.java	2009-06-26 21:11:23.436473310 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/sasl/SASLMechanism.java	2009-06-26 21:23:03.244251498 +0200
-@@ -20,23 +20,25 @@
- 
- package org.jivesoftware.smack.sasl;
- 
--import org.jivesoftware.smack.XMPPException;
--import org.jivesoftware.smack.SASLAuthentication;
--import org.jivesoftware.smack.util.Base64;
--
- import java.io.IOException;
--import java.util.Map;
- import java.util.HashMap;
--import javax.security.auth.callback.CallbackHandler;
--import javax.security.auth.callback.UnsupportedCallbackException;
-+import java.util.Map;
-+
- import javax.security.auth.callback.Callback;
--import javax.security.auth.callback.NameCallback;
-+import javax.security.auth.callback.CallbackHandler;
- import javax.security.auth.callback.PasswordCallback;
--import javax.security.sasl.RealmCallback;
--import javax.security.sasl.RealmChoiceCallback;
--import javax.security.sasl.Sasl;
--import javax.security.sasl.SaslClient;
--import javax.security.sasl.SaslException;
-+import javax.security.auth.callback.UnsupportedCallbackException;
-+
-+import org.jivesoftware.smack.SASLAuthentication;
-+import org.jivesoftware.smack.XMPPException;
-+import org.jivesoftware.smack.util.Base64;
-+
-+import security.javax.security.auth.callback.NameCallback;
-+import security.javax.security.sasl.RealmCallback;
-+import security.javax.security.sasl.RealmChoiceCallback;
-+import security.javax.security.sasl.Sasl;
-+import security.javax.security.sasl.SaslClient;
-+import security.javax.security.sasl.SaslException;
- 
- /**
-  * Base class for SASL mechanisms. Subclasses must implement these methods:
-@@ -148,12 +150,13 @@
-         } else {
-             response = sc.evaluateChallenge(null);
-         }
--
--        String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
-+        String authenticationText = "";
-+        if (response != null) {
-+        authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
-         if(authenticationText.equals("")) {
-             authenticationText = "=";
-         }
--
-+        }
-         stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
-         stanza.append(authenticationText);
-         stanza.append("</response>");
-diff -Nbdru org/jivesoftware/smack/SASLAuthentication.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/SASLAuthentication.java
---- org/jivesoftware/smack/SASLAuthentication.java	2009-06-26 21:11:24.597252589 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/SASLAuthentication.java	2009-06-26 21:31:16.445251493 +0200
-@@ -84,17 +84,15 @@
- 
-         // Register SASL mechanisms supported by Smack
-         registerSASLMechanism("EXTERNAL", SASLExternalMechanism.class);
--        registerSASLMechanism("GSSAPI", SASLGSSAPIMechanism.class);
-         registerSASLMechanism("DIGEST-MD5", SASLDigestMD5Mechanism.class);
-         registerSASLMechanism("CRAM-MD5", SASLCramMD5Mechanism.class);
-         registerSASLMechanism("PLAIN", SASLPlainMechanism.class);
-         registerSASLMechanism("ANONYMOUS", SASLAnonymous.class);
- 
--        supportSASLMechanism("GSSAPI",0);
--        supportSASLMechanism("DIGEST-MD5",1);
--        supportSASLMechanism("CRAM-MD5",2);
--        supportSASLMechanism("PLAIN",3);
--        supportSASLMechanism("ANONYMOUS",4);
-+        supportSASLMechanism("DIGEST-MD5",0);
-+        supportSASLMechanism("CRAM-MD5",1);
-+        supportSASLMechanism("PLAIN",2);
-+        supportSASLMechanism("ANONYMOUS",3);
- 
-     }
- 
-diff -Nbdru org/jivesoftware/smack/util/DNSUtil.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/util/DNSUtil.java
---- org/jivesoftware/smack/util/DNSUtil.java	2009-06-26 21:11:24.585252398 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/util/DNSUtil.java	2009-06-26 00:41:16.932251881 +0200
-@@ -22,12 +22,6 @@
- import java.util.Hashtable;
- import java.util.Map;
- 
--import javax.naming.NamingEnumeration;
--import javax.naming.directory.Attribute;
--import javax.naming.directory.Attributes;
--import javax.naming.directory.DirContext;
--import javax.naming.directory.InitialDirContext;
--
- /**
-  * Utilty class to perform DNS lookups for XMPP services.
-  *
-@@ -41,13 +35,13 @@
-      */
-     private static Map cache = new Cache(100, 1000*60*10);
- 
--    private static DirContext context;
-+//    private static DirContext context;
- 
-     static {
-         try {
-             Hashtable env = new Hashtable();
-             env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
--            context = new InitialDirContext(env);
-+ //           context = new InitialDirContext(env);
-         }
-         catch (Exception e) {
-             // Ignore.
-@@ -79,65 +73,8 @@
-      *      server can be reached at for the specified domain.
-      */
-     public static HostAddress resolveXMPPDomain(String domain) {
--        if (context == null) {
-             return new HostAddress(domain, 5222);
-         }
--        String key = "c" + domain;
--        // Return item from cache if it exists.
--        if (cache.containsKey(key)) {
--            HostAddress address = (HostAddress)cache.get(key);
--            if (address != null) {
--                return address;
--            }
--        }
--        String bestHost = domain;
--        int bestPort = 5222;
--        int bestPriority = 0;
--        int bestWeight = 0;
--        try {
--            Attributes dnsLookup = context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
--            Attribute srvAttribute = dnsLookup.get("SRV");
--            NamingEnumeration srvRecords = srvAttribute.getAll();
--            while(srvRecords.hasMore()) {
--				String srvRecord = (String) srvRecords.next();
--	            String [] srvRecordEntries = srvRecord.split(" ");
--	            int priority = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 4]);
--	            int port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--	            int weight = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 3]);
--	            String host = srvRecordEntries[srvRecordEntries.length-1];
--	            
--	            // Randomize the weight.
--	            weight *= Math.random() * weight;
--	            
--	            if ((bestPriority == 0) || (priority < bestPriority)) {
--	            	// Choose a server with the lowest priority.
--	            	bestPriority = priority;
--	            	bestWeight = weight;
--	            	bestHost = host;
--	            	bestPort = port;
--	            } else if (priority == bestPriority) {
--	            	// When we have like priorities then randomly choose a server based on its weight
--	            	// The weights were randomized above.
--	            	if (weight > bestWeight) {
--	            		bestWeight = weight;
--	            		bestHost = host;
--	            		bestPort = port;
--	            	}
--	            }
--			}
--        }
--        catch (Exception e) {
--            // Ignore.
--        }
--        // Host entries in DNS should end with a ".".
--        if (bestHost.endsWith(".")) {
--        	bestHost = bestHost.substring(0, bestHost.length()-1);
--        }
--        HostAddress address = new HostAddress(bestHost, bestPort);
--        // Add item to cache.
--        cache.put(key, address);
--        return address;
--    }
- 
-     /**
-      * Returns the host name and port that the specified XMPP server can be
-@@ -157,50 +94,8 @@
-      *      server can be reached at for the specified domain.
-      */
-     public static HostAddress resolveXMPPServerDomain(String domain) {
--        if (context == null) {
-             return new HostAddress(domain, 5269);
-         }
--        String key = "s" + domain;
--        // Return item from cache if it exists.
--        if (cache.containsKey(key)) {
--            HostAddress address = (HostAddress)cache.get(key);
--            if (address != null) {
--                return address;
--            }
--        }
--        String host = domain;
--        int port = 5269;
--        try {
--            Attributes dnsLookup =
--                    context.getAttributes("_xmpp-server._tcp." + domain, new String[]{"SRV"});
--            String srvRecord = (String)dnsLookup.get("SRV").get();
--            String [] srvRecordEntries = srvRecord.split(" ");
--            port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--            host = srvRecordEntries[srvRecordEntries.length-1];
--        }
--        catch (Exception e) {
--            // Attempt lookup with older "jabber" name.
--            try {
--                Attributes dnsLookup =
--                        context.getAttributes("_jabber._tcp." + domain, new String[]{"SRV"});
--                String srvRecord = (String)dnsLookup.get("SRV").get();
--                String [] srvRecordEntries = srvRecord.split(" ");
--                port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--                host = srvRecordEntries[srvRecordEntries.length-1];
--            }
--            catch (Exception e2) {
--                // Ignore.
--            }
--        }
--        // Host entries in DNS should end with a ".".
--        if (host.endsWith(".")) {
--            host = host.substring(0, host.length()-1);
--        }
--        HostAddress address = new HostAddress(host, port);
--        // Add item to cache.
--        cache.put(key, address);
--        return address;
--    }
- 
-     /**
-      * Encapsulates a hostname and port.
-diff -Nbdru org/jivesoftware/smack/util/PacketParserUtils.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/util/PacketParserUtils.java
---- org/jivesoftware/smack/util/PacketParserUtils.java	2009-06-26 21:11:24.585252398 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/util/PacketParserUtils.java	2009-06-25 22:34:41.252416000 +0200
-@@ -25,7 +25,7 @@
- import org.jivesoftware.smack.provider.ProviderManager;
- import org.xmlpull.v1.XmlPullParser;
- 
--import java.beans.PropertyDescriptor;
-+//import java.beans.PropertyDescriptor;
- import java.io.ByteArrayInputStream;
- import java.io.ObjectInputStream;
- import java.util.ArrayList;
-@@ -428,26 +428,26 @@
-     {
-         boolean done = false;
-         Object object = objectClass.newInstance();
--        while (!done) {
--            int eventType = parser.next();
--            if (eventType == XmlPullParser.START_TAG) {
--                String name = parser.getName();
--                String stringValue = parser.nextText();
--                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
--                // Load the class type of the property.
--                Class propertyType = descriptor.getPropertyType();
--                // Get the value of the property by converting it from a
--                // String to the correct object type.
--                Object value = decode(propertyType, stringValue);
--                // Set the value of the bean.
--                descriptor.getWriteMethod().invoke(object, value);
--            }
--            else if (eventType == XmlPullParser.END_TAG) {
--                if (parser.getName().equals(elementName)) {
--                    done = true;
--                }
--            }
--        }
-+//        while (!done) {
-+//            int eventType = parser.next();
-+//            if (eventType == XmlPullParser.START_TAG) {
-+//                String name = parser.getName();
-+//                String stringValue = parser.nextText();
-+//                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
-+//                // Load the class type of the property.
-+//                Class propertyType = descriptor.getPropertyType();
-+//                // Get the value of the property by converting it from a
-+//                // String to the correct object type.
-+//                Object value = decode(propertyType, stringValue);
-+//                // Set the value of the bean.
-+//                descriptor.getWriteMethod().invoke(object, value);
-+//            }
-+//            else if (eventType == XmlPullParser.END_TAG) {
-+//                if (parser.getName().equals(elementName)) {
-+//                    done = true;
-+//                }
-+//            }
-+//        }
-         return object;
-     }
- 
-diff -Nbdru org/jivesoftware/smack/XMPPConnection.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/XMPPConnection.java
---- org/jivesoftware/smack/XMPPConnection.java	2009-06-26 21:11:24.601252412 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smack/XMPPConnection.java	2009-06-25 22:34:41.252416000 +0200
-@@ -1082,7 +1082,7 @@
-                     catch (Exception ex) {
-                         try {
-                             debuggerClass =
--                                    Class.forName("org.jivesoftware.smack.debugger.LiteDebugger");
-+                                    Class.forName("org.jivesoftware.smack.debugger.ConsoleDebugger");
-                         }
-                         catch (Exception ex2) {
-                             ex2.printStackTrace();
-diff -Nbdru org/jivesoftware/smackx/debugger/EnhancedDebugger.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smackx/debugger/EnhancedDebugger.java
---- org/jivesoftware/smackx/debugger/EnhancedDebugger.java	2009-06-26 21:11:18.348252001 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smackx/debugger/EnhancedDebugger.java	1970-01-01 01:00:00.000000000 +0100
-@@ -1,1005 +0,0 @@
--/**
-- * $RCSfile$
-- * $Revision: 11024 $
-- * $Date: 2009-06-04 13:58:25 +0200 (Thu, 04 Jun 2009) $
-- *
-- * Copyright 2003-2007 Jive Software.
-- *
-- * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
-- * you may not use this file except in compliance with the License.
-- * You may obtain a copy of the License at
-- *
-- *     http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.jivesoftware.smackx.debugger;
--
--import org.jivesoftware.smack.ConnectionListener;
--import org.jivesoftware.smack.PacketListener;
--import org.jivesoftware.smack.XMPPConnection;
--import org.jivesoftware.smack.debugger.SmackDebugger;
--import org.jivesoftware.smack.packet.IQ;
--import org.jivesoftware.smack.packet.Message;
--import org.jivesoftware.smack.packet.Packet;
--import org.jivesoftware.smack.packet.Presence;
--import org.jivesoftware.smack.util.*;
--
--import javax.swing.*;
--import javax.swing.event.ListSelectionEvent;
--import javax.swing.event.ListSelectionListener;
--import javax.swing.table.DefaultTableModel;
--import javax.swing.text.BadLocationException;
--import javax.xml.transform.*;
--import javax.xml.transform.stream.StreamResult;
--import javax.xml.transform.stream.StreamSource;
--import java.awt.*;
--import java.awt.datatransfer.Clipboard;
--import java.awt.datatransfer.StringSelection;
--import java.awt.event.ActionEvent;
--import java.awt.event.ActionListener;
--import java.awt.event.MouseAdapter;
--import java.awt.event.MouseEvent;
--import java.io.Reader;
--import java.io.StringReader;
--import java.io.StringWriter;
--import java.io.Writer;
--import java.net.URL;
--import java.text.SimpleDateFormat;
--import java.util.Date;
--
--/**
-- * The EnhancedDebugger is a debugger that allows to debug sent, received and interpreted messages
-- * but also provides the ability to send ad-hoc messages composed by the user.<p>
-- * <p/>
-- * A new EnhancedDebugger will be created for each connection to debug. All the EnhancedDebuggers
-- * will be shown in the same debug window provided by the class EnhancedDebuggerWindow.
-- *
-- * @author Gaston Dombiak
-- */
--public class EnhancedDebugger implements SmackDebugger {
--
--    private static final String NEWLINE = "\n";
--
--    private static ImageIcon packetReceivedIcon;
--    private static ImageIcon packetSentIcon;
--    private static ImageIcon presencePacketIcon;
--    private static ImageIcon iqPacketIcon;
--    private static ImageIcon messagePacketIcon;
--    private static ImageIcon unknownPacketTypeIcon;
--
--    {
--        URL url;
--        // Load the image icons 
--        url =
--                Thread.currentThread().getContextClassLoader().getResource("images/nav_left_blue.png");
--        if (url != null) {
--            packetReceivedIcon = new ImageIcon(url);
--        }
--        url =
--                Thread.currentThread().getContextClassLoader().getResource("images/nav_right_red.png");
--        if (url != null) {
--            packetSentIcon = new ImageIcon(url);
--        }
--        url =
--                Thread.currentThread().getContextClassLoader().getResource("images/photo_portrait.png");
--        if (url != null) {
--            presencePacketIcon = new ImageIcon(url);
--        }
--        url =
--                Thread.currentThread().getContextClassLoader().getResource(
--                        "images/question_and_answer.png");
--        if (url != null) {
--            iqPacketIcon = new ImageIcon(url);
--        }
--        url = Thread.currentThread().getContextClassLoader().getResource("images/message.png");
--        if (url != null) {
--            messagePacketIcon = new ImageIcon(url);
--        }
--        url = Thread.currentThread().getContextClassLoader().getResource("images/unknown.png");
--        if (url != null) {
--            unknownPacketTypeIcon = new ImageIcon(url);
--        }
--    }
--
--    private DefaultTableModel messagesTable = null;
--    private JTextArea messageTextArea = null;
--    private JFormattedTextField userField = null;
--    private JFormattedTextField statusField = null;
--
--    private XMPPConnection connection = null;
--
--    private PacketListener packetReaderListener = null;
--    private PacketListener packetWriterListener = null;
--    private ConnectionListener connListener = null;
--
--    private Writer writer;
--    private Reader reader;
--    private ReaderListener readerListener;
--    private WriterListener writerListener;
--
--    private Date creationTime = new Date();
--
--    // Statistics variables
--    private DefaultTableModel statisticsTable = null;
--    private int sentPackets = 0;
--    private int receivedPackets = 0;
--    private int sentIQPackets = 0;
--    private int receivedIQPackets = 0;
--    private int sentMessagePackets = 0;
--    private int receivedMessagePackets = 0;
--    private int sentPresencePackets = 0;
--    private int receivedPresencePackets = 0;
--    private int sentOtherPackets = 0;
--    private int receivedOtherPackets = 0;
--
--    JTabbedPane tabbedPane;
--
--    public EnhancedDebugger(XMPPConnection connection, Writer writer, Reader reader) {
--        this.connection = connection;
--        this.writer = writer;
--        this.reader = reader;
--        createDebug();
--        EnhancedDebuggerWindow.addDebugger(this);
--    }
--
--    /**
--     * Creates the debug process, which is a GUI window that displays XML traffic.
--     */
--    private void createDebug() {
--        // We'll arrange the UI into six tabs. The first tab contains all data, the second
--        // client generated XML, the third server generated XML, the fourth allows to send 
--        // ad-hoc messages and the fifth contains connection information.
--        tabbedPane = new JTabbedPane();
--
--        // Add the All Packets, Sent, Received and Interpreted panels
--        addBasicPanels();
--
--        // Add the panel to send ad-hoc messages
--        addAdhocPacketPanel();
--
--        // Add the connection information panel
--        addInformationPanel();
--
--        // Create a thread that will listen for all incoming packets and write them to
--        // the GUI. This is what we call "interpreted" packet data, since it's the packet
--        // data as Smack sees it and not as it's coming in as raw XML.
--        packetReaderListener = new PacketListener() {
--            SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");
--
--            public void processPacket(final Packet packet) {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        addReadPacketToTable(dateFormatter, packet);
--                    }
--                });
--
--            }
--        };
--
--        // Create a thread that will listen for all outgoing packets and write them to
--        // the GUI.
--        packetWriterListener = new PacketListener() {
--            SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");
--
--            public void processPacket(final Packet packet) {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        addSentPacketToTable(dateFormatter, packet);
--                    }
--                });
--
--            }
--        };
--
--        // Create a thread that will listen for any connection closed event
--        connListener = new ConnectionListener() {
--            public void connectionClosed() {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        statusField.setValue("Closed");
--                        EnhancedDebuggerWindow.connectionClosed(EnhancedDebugger.this);
--                    }
--                });
--
--            }
--
--            public void connectionClosedOnError(final Exception e) {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        statusField.setValue("Closed due to an exception");
--                        EnhancedDebuggerWindow.connectionClosedOnError(EnhancedDebugger.this, e);
--                    }
--                });
--
--            }
--            public void reconnectingIn(final int seconds){
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        statusField.setValue("Attempt to reconnect in " + seconds + " seconds");
--                    }
--                });
--            }
--
--            public void reconnectionSuccessful() {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        statusField.setValue("Reconnection stablished");
--                        EnhancedDebuggerWindow.connectionEstablished(EnhancedDebugger.this);
--                    }
--                });
--            }
--
--            public void reconnectionFailed(Exception e) {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        statusField.setValue("Reconnection failed");
--                    }
--                });
--            }
--        };
--    }
--
--    private void addBasicPanels() {
--        JSplitPane allPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
--        allPane.setOneTouchExpandable(true);
--
--        messagesTable =
--                new DefaultTableModel(
--                        new Object[]{"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
--                        0) {
--        			private static final long serialVersionUID = 8136121224474217264L;
--					public boolean isCellEditable(int rowIndex, int mColIndex) {
--                        return false;
--                    }
--
--                    public Class getColumnClass(int columnIndex) {
--                        if (columnIndex == 2 || columnIndex == 3) {
--                            return Icon.class;
--                        }
--                        return super.getColumnClass(columnIndex);
--                    }
--
--                };
--        JTable table = new JTable(messagesTable);
--        // Allow only single a selection
--        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
--        // Hide the first column
--        table.getColumnModel().getColumn(0).setMaxWidth(0);
--        table.getColumnModel().getColumn(0).setMinWidth(0);
--        table.getTableHeader().getColumnModel().getColumn(0).setMaxWidth(0);
--        table.getTableHeader().getColumnModel().getColumn(0).setMinWidth(0);
--        // Set the column "timestamp" size
--        table.getColumnModel().getColumn(1).setMaxWidth(300);
--        table.getColumnModel().getColumn(1).setPreferredWidth(70);
--        // Set the column "direction" icon size
--        table.getColumnModel().getColumn(2).setMaxWidth(50);
--        table.getColumnModel().getColumn(2).setPreferredWidth(30);
--        // Set the column "packet type" icon size
--        table.getColumnModel().getColumn(3).setMaxWidth(50);
--        table.getColumnModel().getColumn(3).setPreferredWidth(30);
--        // Set the column "Id" size
--        table.getColumnModel().getColumn(5).setMaxWidth(100);
--        table.getColumnModel().getColumn(5).setPreferredWidth(55);
--        // Set the column "type" size
--        table.getColumnModel().getColumn(6).setMaxWidth(200);
--        table.getColumnModel().getColumn(6).setPreferredWidth(50);
--        // Set the column "to" size
--        table.getColumnModel().getColumn(7).setMaxWidth(300);
--        table.getColumnModel().getColumn(7).setPreferredWidth(90);
--        // Set the column "from" size
--        table.getColumnModel().getColumn(8).setMaxWidth(300);
--        table.getColumnModel().getColumn(8).setPreferredWidth(90);
--        // Create a table listener that listen for row selection events
--        SelectionListener selectionListener = new SelectionListener(table);
--        table.getSelectionModel().addListSelectionListener(selectionListener);
--        table.getColumnModel().getSelectionModel().addListSelectionListener(selectionListener);
--        allPane.setTopComponent(new JScrollPane(table));
--        messageTextArea = new JTextArea();
--        messageTextArea.setEditable(false);
--        // Add pop-up menu.
--        JPopupMenu menu = new JPopupMenu();
--        JMenuItem menuItem1 = new JMenuItem("Copy");
--        menuItem1.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Get the clipboard
--                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
--                // Set the sent text as the new content of the clipboard
--                clipboard.setContents(new StringSelection(messageTextArea.getText()), null);
--            }
--        });
--        menu.add(menuItem1);
--        // Add listener to the text area so the popup menu can come up.
--        messageTextArea.addMouseListener(new PopupListener(menu));
--        allPane.setBottomComponent(new JScrollPane(messageTextArea));
--        allPane.setDividerLocation(150);
--
--        tabbedPane.add("All Packets", allPane);
--        tabbedPane.setToolTipTextAt(0, "Sent and received packets processed by Smack");
--
--        // Create UI elements for client generated XML traffic.
--        final JTextArea sentText = new JTextArea();
--        sentText.setWrapStyleWord(true);
--        sentText.setLineWrap(true);
--        sentText.setEditable(false);
--        sentText.setForeground(new Color(112, 3, 3));
--        tabbedPane.add("Raw Sent Packets", new JScrollPane(sentText));
--        tabbedPane.setToolTipTextAt(1, "Raw text of the sent packets");
--
--        // Add pop-up menu.
--        menu = new JPopupMenu();
--        menuItem1 = new JMenuItem("Copy");
--        menuItem1.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Get the clipboard
--                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
--                // Set the sent text as the new content of the clipboard
--                clipboard.setContents(new StringSelection(sentText.getText()), null);
--            }
--        });
--
--        JMenuItem menuItem2 = new JMenuItem("Clear");
--        menuItem2.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                sentText.setText("");
--            }
--        });
--
--        // Add listener to the text area so the popup menu can come up.
--        sentText.addMouseListener(new PopupListener(menu));
--        menu.add(menuItem1);
--        menu.add(menuItem2);
--
--        // Create UI elements for server generated XML traffic.
--        final JTextArea receivedText = new JTextArea();
--        receivedText.setWrapStyleWord(true);
--        receivedText.setLineWrap(true);
--        receivedText.setEditable(false);
--        receivedText.setForeground(new Color(6, 76, 133));
--        tabbedPane.add("Raw Received Packets", new JScrollPane(receivedText));
--        tabbedPane.setToolTipTextAt(
--                2,
--                "Raw text of the received packets before Smack process them");
--
--        // Add pop-up menu.
--        menu = new JPopupMenu();
--        menuItem1 = new JMenuItem("Copy");
--        menuItem1.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Get the clipboard
--                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
--                // Set the sent text as the new content of the clipboard
--                clipboard.setContents(new StringSelection(receivedText.getText()), null);
--            }
--        });
--
--        menuItem2 = new JMenuItem("Clear");
--        menuItem2.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                receivedText.setText("");
--            }
--        });
--
--        // Add listener to the text area so the popup menu can come up.
--        receivedText.addMouseListener(new PopupListener(menu));
--        menu.add(menuItem1);
--        menu.add(menuItem2);
--
--        // Create a special Reader that wraps the main Reader and logs data to the GUI.
--        ObservableReader debugReader = new ObservableReader(reader);
--        readerListener = new ReaderListener() {
--            public void read(final String str) {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        if (EnhancedDebuggerWindow.PERSISTED_DEBUGGER &&
--                                !EnhancedDebuggerWindow.getInstance().isVisible()) {
--                            // Do not add content if the parent is not visible
--                            return;
--                        }
--
--                        int index = str.lastIndexOf(">");
--                        if (index != -1) {
--                            if (receivedText.getLineCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS)
--                            {
--                                try {
--                                    receivedText.replaceRange("", 0, receivedText.getLineEndOffset(0));
--                                }
--                                catch (BadLocationException e) {
--                                    e.printStackTrace();
--                                }
--                            }
--                            receivedText.append(str.substring(0, index + 1));
--                            receivedText.append(NEWLINE);
--                            if (str.length() > index) {
--                                receivedText.append(str.substring(index + 1));
--                            }
--                        }
--                        else {
--                            receivedText.append(str);
--                        }
--                    }
--                });
--            }
--        };
--        debugReader.addReaderListener(readerListener);
--
--        // Create a special Writer that wraps the main Writer and logs data to the GUI.
--        ObservableWriter debugWriter = new ObservableWriter(writer);
--        writerListener = new WriterListener() {
--            public void write(final String str) {
--                SwingUtilities.invokeLater(new Runnable() {
--                    public void run() {
--                        if (EnhancedDebuggerWindow.PERSISTED_DEBUGGER &&
--                                !EnhancedDebuggerWindow.getInstance().isVisible()) {
--                            // Do not add content if the parent is not visible
--                            return;
--                        }
--
--                        if (sentText.getLineCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
--                            try {
--                                sentText.replaceRange("", 0, sentText.getLineEndOffset(0));
--                            }
--                            catch (BadLocationException e) {
--                                e.printStackTrace();
--                            }
--                        }
--
--                        sentText.append(str);
--                        if (str.endsWith(">")) {
--                            sentText.append(NEWLINE);
--                        }
--                    }
--                });
--
--
--            }
--        };
--        debugWriter.addWriterListener(writerListener);
--
--        // Assign the reader/writer objects to use the debug versions. The packet reader
--        // and writer will use the debug versions when they are created.
--        reader = debugReader;
--        writer = debugWriter;
--
--    }
--
--    private void addAdhocPacketPanel() {
--        // Create UI elements for sending ad-hoc messages.
--        final JTextArea adhocMessages = new JTextArea();
--        adhocMessages.setEditable(true);
--        adhocMessages.setForeground(new Color(1, 94, 35));
--        tabbedPane.add("Ad-hoc message", new JScrollPane(adhocMessages));
--        tabbedPane.setToolTipTextAt(3, "Panel that allows you to send adhoc packets");
--
--        // Add pop-up menu.
--        JPopupMenu menu = new JPopupMenu();
--        JMenuItem menuItem = new JMenuItem("Message");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                adhocMessages.setText(
--                        "<message to=\"\" id=\""
--                                + StringUtils.randomString(5)
--                                + "-X\"><body></body></message>");
--            }
--        });
--        menu.add(menuItem);
--
--        menuItem = new JMenuItem("IQ Get");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                adhocMessages.setText(
--                        "<iq type=\"get\" to=\"\" id=\""
--                                + StringUtils.randomString(5)
--                                + "-X\"><query xmlns=\"\"></query></iq>");
--            }
--        });
--        menu.add(menuItem);
--
--        menuItem = new JMenuItem("IQ Set");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                adhocMessages.setText(
--                        "<iq type=\"set\" to=\"\" id=\""
--                                + StringUtils.randomString(5)
--                                + "-X\"><query xmlns=\"\"></query></iq>");
--            }
--        });
--        menu.add(menuItem);
--
--        menuItem = new JMenuItem("Presence");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                adhocMessages.setText(
--                        "<presence to=\"\" id=\"" + StringUtils.randomString(5) + "-X\"/>");
--            }
--        });
--        menu.add(menuItem);
--        menu.addSeparator();
--
--        menuItem = new JMenuItem("Send");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                if (!"".equals(adhocMessages.getText())) {
--                    AdHocPacket packetToSend = new AdHocPacket(adhocMessages.getText());
--                    connection.sendPacket(packetToSend);
--                }
--            }
--        });
--        menu.add(menuItem);
--
--        menuItem = new JMenuItem("Clear");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                adhocMessages.setText(null);
--            }
--        });
--        menu.add(menuItem);
--
--        // Add listener to the text area so the popup menu can come up.
--        adhocMessages.addMouseListener(new PopupListener(menu));
--    }
--
--    private void addInformationPanel() {
--        // Create UI elements for connection information.
--        JPanel informationPanel = new JPanel();
--        informationPanel.setLayout(new BorderLayout());
--
--        // Add the Host information
--        JPanel connPanel = new JPanel();
--        connPanel.setLayout(new GridBagLayout());
--        connPanel.setBorder(BorderFactory.createTitledBorder("Connection information"));
--
--        JLabel label = new JLabel("Host: ");
--        label.setMinimumSize(new java.awt.Dimension(150, 14));
--        label.setMaximumSize(new java.awt.Dimension(150, 14));
--        connPanel.add(
--                label,
--                new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
--        JFormattedTextField field = new JFormattedTextField(connection.getServiceName());
--        field.setMinimumSize(new java.awt.Dimension(150, 20));
--        field.setMaximumSize(new java.awt.Dimension(150, 20));
--        field.setEditable(false);
--        field.setBorder(null);
--        connPanel.add(
--                field,
--                new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
--
--        // Add the Port information
--        label = new JLabel("Port: ");
--        label.setMinimumSize(new java.awt.Dimension(150, 14));
--        label.setMaximumSize(new java.awt.Dimension(150, 14));
--        connPanel.add(
--                label,
--                new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
--        field = new JFormattedTextField(connection.getPort());
--        field.setMinimumSize(new java.awt.Dimension(150, 20));
--        field.setMaximumSize(new java.awt.Dimension(150, 20));
--        field.setEditable(false);
--        field.setBorder(null);
--        connPanel.add(
--                field,
--                new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
--
--        // Add the connection's User information
--        label = new JLabel("User: ");
--        label.setMinimumSize(new java.awt.Dimension(150, 14));
--        label.setMaximumSize(new java.awt.Dimension(150, 14));
--        connPanel.add(
--                label,
--                new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
--        userField = new JFormattedTextField();
--        userField.setMinimumSize(new java.awt.Dimension(150, 20));
--        userField.setMaximumSize(new java.awt.Dimension(150, 20));
--        userField.setEditable(false);
--        userField.setBorder(null);
--        connPanel.add(
--                userField,
--                new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
--
--        // Add the connection's creationTime information
--        label = new JLabel("Creation time: ");
--        label.setMinimumSize(new java.awt.Dimension(150, 14));
--        label.setMaximumSize(new java.awt.Dimension(150, 14));
--        connPanel.add(
--                label,
--                new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
--        field = new JFormattedTextField(new SimpleDateFormat("yyyy.MM.dd hh:mm:ss aaa"));
--        field.setMinimumSize(new java.awt.Dimension(150, 20));
--        field.setMaximumSize(new java.awt.Dimension(150, 20));
--        field.setValue(creationTime);
--        field.setEditable(false);
--        field.setBorder(null);
--        connPanel.add(
--                field,
--                new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
--
--        // Add the connection's creationTime information
--        label = new JLabel("Status: ");
--        label.setMinimumSize(new java.awt.Dimension(150, 14));
--        label.setMaximumSize(new java.awt.Dimension(150, 14));
--        connPanel.add(
--                label,
--                new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
--        statusField = new JFormattedTextField();
--        statusField.setMinimumSize(new java.awt.Dimension(150, 20));
--        statusField.setMaximumSize(new java.awt.Dimension(150, 20));
--        statusField.setValue("Active");
--        statusField.setEditable(false);
--        statusField.setBorder(null);
--        connPanel.add(
--                statusField,
--                new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
--        // Add the connection panel to the information panel
--        informationPanel.add(connPanel, BorderLayout.NORTH);
--
--        // Add the Number of sent packets information
--        JPanel packetsPanel = new JPanel();
--        packetsPanel.setLayout(new GridLayout(1, 1));
--        packetsPanel.setBorder(BorderFactory.createTitledBorder("Transmitted Packets"));
--
--        statisticsTable =
--                new DefaultTableModel(new Object[][]{{"IQ", 0, 0}, {"Message", 0, 0},
--                        {"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
--                        new Object[]{"Type", "Received", "Sent"}) {
--        			private static final long serialVersionUID = -6793886085109589269L;
--					public boolean isCellEditable(int rowIndex, int mColIndex) {
--                        return false;
--                    }
--                };
--        JTable table = new JTable(statisticsTable);
--        // Allow only single a selection
--        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
--        packetsPanel.add(new JScrollPane(table));
--
--        // Add the packets panel to the information panel
--        informationPanel.add(packetsPanel, BorderLayout.CENTER);
--
--        tabbedPane.add("Information", new JScrollPane(informationPanel));
--        tabbedPane.setToolTipTextAt(4, "Information and statistics about the debugged connection");
--    }
--
--    public Reader newConnectionReader(Reader newReader) {
--        ((ObservableReader) reader).removeReaderListener(readerListener);
--        ObservableReader debugReader = new ObservableReader(newReader);
--        debugReader.addReaderListener(readerListener);
--        reader = debugReader;
--        return reader;
--    }
--
--    public Writer newConnectionWriter(Writer newWriter) {
--        ((ObservableWriter) writer).removeWriterListener(writerListener);
--        ObservableWriter debugWriter = new ObservableWriter(newWriter);
--        debugWriter.addWriterListener(writerListener);
--        writer = debugWriter;
--        return writer;
--    }
--
--    public void userHasLogged(final String user) {
--        final EnhancedDebugger debugger = this;
--        SwingUtilities.invokeLater(new Runnable() {
--            public void run() {
--                userField.setText(user);
--                EnhancedDebuggerWindow.userHasLogged(debugger, user);
--                // Add the connection listener to the connection so that the debugger can be notified
--                // whenever the connection is closed.
--                connection.addConnectionListener(connListener);
--            }
--        });
--
--    }
--
--    public Reader getReader() {
--        return reader;
--    }
--
--    public Writer getWriter() {
--        return writer;
--    }
--
--    public PacketListener getReaderListener() {
--        return packetReaderListener;
--    }
--
--    public PacketListener getWriterListener() {
--        return packetWriterListener;
--    }
--
--    /**
--     * Updates the statistics table
--     */
--    private void updateStatistics() {
--        statisticsTable.setValueAt(Integer.valueOf(receivedIQPackets), 0, 1);
--        statisticsTable.setValueAt(Integer.valueOf(sentIQPackets), 0, 2);
--
--        statisticsTable.setValueAt(Integer.valueOf(receivedMessagePackets), 1, 1);
--        statisticsTable.setValueAt(Integer.valueOf(sentMessagePackets), 1, 2);
--
--        statisticsTable.setValueAt(Integer.valueOf(receivedPresencePackets), 2, 1);
--        statisticsTable.setValueAt(Integer.valueOf(sentPresencePackets), 2, 2);
--
--        statisticsTable.setValueAt(Integer.valueOf(receivedOtherPackets), 3, 1);
--        statisticsTable.setValueAt(Integer.valueOf(sentOtherPackets), 3, 2);
--
--        statisticsTable.setValueAt(Integer.valueOf(receivedPackets), 4, 1);
--        statisticsTable.setValueAt(Integer.valueOf(sentPackets), 4, 2);
--    }
--
--    /**
--     * Adds the received packet detail to the messages table.
--     *
--     * @param dateFormatter the SimpleDateFormat to use to format Dates
--     * @param packet        the read packet to add to the table
--     */
--    private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final Packet packet) {
--        SwingUtilities.invokeLater(new Runnable() {
--            public void run() {
--                String messageType;
--                String from = packet.getFrom();
--                String type = "";
--                Icon packetTypeIcon;
--                receivedPackets++;
--                if (packet instanceof IQ) {
--                    packetTypeIcon = iqPacketIcon;
--                    messageType = "IQ Received (class=" + packet.getClass().getName() + ")";
--                    type = ((IQ) packet).getType().toString();
--                    receivedIQPackets++;
--                }
--                else if (packet instanceof Message) {
--                    packetTypeIcon = messagePacketIcon;
--                    messageType = "Message Received";
--                    type = ((Message) packet).getType().toString();
--                    receivedMessagePackets++;
--                }
--                else if (packet instanceof Presence) {
--                    packetTypeIcon = presencePacketIcon;
--                    messageType = "Presence Received";
--                    type = ((Presence) packet).getType().toString();
--                    receivedPresencePackets++;
--                }
--                else {
--                    packetTypeIcon = unknownPacketTypeIcon;
--                    messageType = packet.getClass().getName() + " Received";
--                    receivedOtherPackets++;
--                }
--
--                // Check if we need to remove old rows from the table to keep memory consumption low
--                if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0 &&
--                        messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
--                    messagesTable.removeRow(0);
--                }
--
--                messagesTable.addRow(
--                        new Object[]{
--                                formatXML(packet.toXML()),
--                                dateFormatter.format(new Date()),
--                                packetReceivedIcon,
--                                packetTypeIcon,
--                                messageType,
--                                packet.getPacketID(),
--                                type,
--                                "",
--                                from});
--                // Update the statistics table
--                updateStatistics();
--            }
--        });
--    }
--
--    /**
--     * Adds the sent packet detail to the messages table.
--     *
--     * @param dateFormatter the SimpleDateFormat to use to format Dates
--     * @param packet        the sent packet to add to the table
--     */
--    private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final Packet packet) {
--        SwingUtilities.invokeLater(new Runnable() {
--            public void run() {
--                String messageType;
--                String to = packet.getTo();
--                String type = "";
--                Icon packetTypeIcon;
--                sentPackets++;
--                if (packet instanceof IQ) {
--                    packetTypeIcon = iqPacketIcon;
--                    messageType = "IQ Sent (class=" + packet.getClass().getName() + ")";
--                    type = ((IQ) packet).getType().toString();
--                    sentIQPackets++;
--                }
--                else if (packet instanceof Message) {
--                    packetTypeIcon = messagePacketIcon;
--                    messageType = "Message Sent";
--                    type = ((Message) packet).getType().toString();
--                    sentMessagePackets++;
--                }
--                else if (packet instanceof Presence) {
--                    packetTypeIcon = presencePacketIcon;
--                    messageType = "Presence Sent";
--                    type = ((Presence) packet).getType().toString();
--                    sentPresencePackets++;
--                }
--                else {
--                    packetTypeIcon = unknownPacketTypeIcon;
--                    messageType = packet.getClass().getName() + " Sent";
--                    sentOtherPackets++;
--                }
--
--                // Check if we need to remove old rows from the table to keep memory consumption low
--                if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0 &&
--                        messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
--                    messagesTable.removeRow(0);
--                }
--
--                messagesTable.addRow(
--                        new Object[]{
--                                formatXML(packet.toXML()),
--                                dateFormatter.format(new Date()),
--                                packetSentIcon,
--                                packetTypeIcon,
--                                messageType,
--                                packet.getPacketID(),
--                                type,
--                                to,
--                                ""});
--
--                // Update the statistics table
--                updateStatistics();
--            }
--        });
--    }
--
--    private String formatXML(String str) {
--        try {
--            // Use a Transformer for output
--            TransformerFactory tFactory = TransformerFactory.newInstance();
--            // Surround this setting in a try/catch for compatibility with Java 1.4. This setting is required
--            // for Java 1.5
--            try {
--                tFactory.setAttribute("indent-number", 2);
--            }
--            catch (IllegalArgumentException e) {
--                // Ignore
--            }
--            Transformer transformer = tFactory.newTransformer();
--            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
--            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
--            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
--
--            // Transform the requested string into a nice formatted XML string
--            StreamSource source = new StreamSource(new StringReader(str));
--            StringWriter sw = new StringWriter();
--            StreamResult result = new StreamResult(sw);
--            transformer.transform(source, result);
--            return sw.toString();
--
--        }
--        catch (TransformerConfigurationException tce) {
--            // Error generated by the parser
--            System.out.println("\n** Transformer Factory error");
--            System.out.println("   " + tce.getMessage());
--
--            // Use the contained exception, if any
--            Throwable x = tce;
--            if (tce.getException() != null)
--                x = tce.getException();
--            x.printStackTrace();
--
--        }
--        catch (TransformerException te) {
--            // Error generated by the parser
--            System.out.println("\n** Transformation error");
--            System.out.println("   " + te.getMessage());
--
--            // Use the contained exception, if any
--            Throwable x = te;
--            if (te.getException() != null)
--                x = te.getException();
--            x.printStackTrace();
--
--        }
--        return str;
--    }
--
--    /**
--     * Returns true if the debugger's connection with the server is up and running.
--     *
--     * @return true if the connection with the server is active.
--     */
--    boolean isConnectionActive() {
--        return connection.isConnected();
--    }
--
--    /**
--     * Stops debugging the connection. Removes any listener on the connection.
--     */
--    void cancel() {
--        connection.removeConnectionListener(connListener);
--        connection.removePacketListener(packetReaderListener);
--        connection.removePacketWriterListener(packetWriterListener);
--        ((ObservableReader) reader).removeReaderListener(readerListener);
--        ((ObservableWriter) writer).removeWriterListener(writerListener);
--        messagesTable = null;
--    }
--
--    /**
--     * An ad-hoc packet is like any regular packet but with the exception that it's intention is
--     * to be used only <b>to send packets</b>.<p>
--     * <p/>
--     * The whole text to send must be passed to the constructor. This implies that the client of
--     * this class is responsible for sending a valid text to the constructor.
--     */
--    private class AdHocPacket extends Packet {
--
--        private String text;
--
--        /**
--         * Create a new AdHocPacket with the text to send. The passed text must be a valid text to
--         * send to the server, no validation will be done on the passed text.
--         *
--         * @param text the whole text of the packet to send
--         */
--        public AdHocPacket(String text) {
--            this.text = text;
--        }
--
--        public String toXML() {
--            return text;
--        }
--
--    }
--
--    /**
--     * Listens for debug window popup dialog events.
--     */
--    private class PopupListener extends MouseAdapter {
--
--        JPopupMenu popup;
--
--        PopupListener(JPopupMenu popupMenu) {
--            popup = popupMenu;
--        }
--
--        public void mousePressed(MouseEvent e) {
--            maybeShowPopup(e);
--        }
--
--        public void mouseReleased(MouseEvent e) {
--            maybeShowPopup(e);
--        }
--
--        private void maybeShowPopup(MouseEvent e) {
--            if (e.isPopupTrigger()) {
--                popup.show(e.getComponent(), e.getX(), e.getY());
--            }
--        }
--    }
--
--    private class SelectionListener implements ListSelectionListener {
--
--        JTable table;
--
--        // It is necessary to keep the table since it is not possible
--        // to determine the table from the event's source
--        SelectionListener(JTable table) {
--            this.table = table;
--        }
--
--        public void valueChanged(ListSelectionEvent e) {
--            if (table.getSelectedRow() == -1) {
--                // Clear the messageTextArea since there is none packet selected
--                messageTextArea.setText(null);
--            }
--            else {
--                // Set the detail of the packet in the messageTextArea
--                messageTextArea.setText(
--                        (String) table.getModel().getValueAt(table.getSelectedRow(), 0));
--                // Scroll up to the top
--                messageTextArea.setCaretPosition(0);
--            }
--        }
--    }
--}
-diff -Nbdru org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java /home/nikita/devel/beem-ui/src/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java
---- org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java	2009-06-26 21:11:18.348252001 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java	1970-01-01 01:00:00.000000000 +0100
-@@ -1,375 +0,0 @@
--/**
-- * $RCSfile$
-- * $Revision: 7071 $
-- * $Date: 2007-02-12 01:59:05 +0100 (Mon, 12 Feb 2007) $
-- *
-- * Copyright 2003-2007 Jive Software.
-- *
-- * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
-- * you may not use this file except in compliance with the License.
-- * You may obtain a copy of the License at
-- *
-- *     http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing, software
-- * distributed under the License is distributed on an "AS IS" BASIS,
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- * See the License for the specific language governing permissions and
-- * limitations under the License.
-- */
--
--package org.jivesoftware.smackx.debugger;
--
--import org.jivesoftware.smack.SmackConfiguration;
--import org.jivesoftware.smack.provider.ProviderManager;
--
--import javax.swing.*;
--import java.awt.*;
--import java.awt.event.*;
--import java.net.URL;
--import java.util.ArrayList;
--import java.util.Collections;
--import java.util.Vector;
--
--/**
-- * The EnhancedDebuggerWindow is the main debug window that will show all the EnhancedDebuggers.
-- * For each connection to debug there will be an EnhancedDebugger that will be shown in the
-- * EnhancedDebuggerWindow.<p>
-- * <p/>
-- * This class also provides information about Smack like for example the Smack version and the
-- * installed providers.
-- *
-- * @author Gaston Dombiak
-- */
--public class EnhancedDebuggerWindow {
--
--    private static EnhancedDebuggerWindow instance;
--
--    private static ImageIcon connectionCreatedIcon;
--    private static ImageIcon connectionActiveIcon;
--    private static ImageIcon connectionClosedIcon;
--    private static ImageIcon connectionClosedOnErrorIcon;
--
--    public static boolean PERSISTED_DEBUGGER = false;
--    /**
--     * Keeps the max number of rows to keep in the tables. A value less than 0 means that packets
--     * will never be removed. If you are planning to use this debugger in a
--     * production environment then you should set a lower value (e.g. 50) to prevent the debugger
--     * from consuming all the JVM memory.
--     */
--    public static int MAX_TABLE_ROWS = 150;
--
--    {
--        URL url;
--
--        url =
--                Thread.currentThread().getContextClassLoader().getResource(
--                        "images/trafficlight_off.png");
--        if (url != null) {
--            connectionCreatedIcon = new ImageIcon(url);
--        }
--        url =
--                Thread.currentThread().getContextClassLoader().getResource(
--                        "images/trafficlight_green.png");
--        if (url != null) {
--            connectionActiveIcon = new ImageIcon(url);
--        }
--        url =
--                Thread.currentThread().getContextClassLoader().getResource(
--                        "images/trafficlight_red.png");
--        if (url != null) {
--            connectionClosedIcon = new ImageIcon(url);
--        }
--        url = Thread.currentThread().getContextClassLoader().getResource("images/warning.png");
--        if (url != null) {
--            connectionClosedOnErrorIcon = new ImageIcon(url);
--        }
--
--    }
--
--    private JFrame frame = null;
--    private JTabbedPane tabbedPane = null;
--    private java.util.List<EnhancedDebugger> debuggers = new ArrayList<EnhancedDebugger>();
--
--    private EnhancedDebuggerWindow() {
--    }
--
--    /**
--     * Returns the unique EnhancedDebuggerWindow instance available in the system.
--     *
--     * @return the unique EnhancedDebuggerWindow instance
--     */
--    public static EnhancedDebuggerWindow getInstance() {
--        if (instance == null) {
--            instance = new EnhancedDebuggerWindow();
--        }
--        return instance;
--    }
--
--    /**
--     * Adds the new specified debugger to the list of debuggers to show in the main window.
--     *
--     * @param debugger the new debugger to show in the debug window
--     */
--    synchronized static void addDebugger(EnhancedDebugger debugger) {
--        getInstance().showNewDebugger(debugger);
--    }
--
--    /**
--     * Shows the new debugger in the debug window.
--     *
--     * @param debugger the new debugger to show
--     */
--    private void showNewDebugger(EnhancedDebugger debugger) {
--        if (frame == null) {
--            createDebug();
--        }
--        debugger.tabbedPane.setName("Connection_" + tabbedPane.getComponentCount());
--        tabbedPane.add(debugger.tabbedPane, tabbedPane.getComponentCount() - 1);
--        tabbedPane.setIconAt(tabbedPane.indexOfComponent(debugger.tabbedPane), connectionCreatedIcon);
--        frame.setTitle(
--                "Smack Debug Window -- Total connections: " + (tabbedPane.getComponentCount() - 1));
--        // Keep the added debugger for later access
--        debuggers.add(debugger);
--    }
--
--    /**
--     * Notification that a user has logged in to the server. A new title will be set
--     * to the tab of the given debugger.
--     *
--     * @param debugger the debugger whose connection logged in to the server
--     * @param user     the user@host/resource that has just logged in
--     */
--    synchronized static void userHasLogged(EnhancedDebugger debugger, String user) {
--        int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane);
--        getInstance().tabbedPane.setTitleAt(
--                index,
--                user);
--        getInstance().tabbedPane.setIconAt(
--                index,
--                connectionActiveIcon);
--    }
--
--    /**
--     * Notification that the connection was properly closed.
--     *
--     * @param debugger the debugger whose connection was properly closed.
--     */
--    synchronized static void connectionClosed(EnhancedDebugger debugger) {
--        getInstance().tabbedPane.setIconAt(
--                getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane),
--                connectionClosedIcon);
--    }
--
--    /**
--     * Notification that the connection was closed due to an exception.
--     *
--     * @param debugger the debugger whose connection was closed due to an exception.
--     * @param e        the exception.
--     */
--    synchronized static void connectionClosedOnError(EnhancedDebugger debugger, Exception e) {
--        int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane);
--        getInstance().tabbedPane.setToolTipTextAt(
--                index,
--                "Connection closed due to the exception: " + e.getMessage());
--        getInstance().tabbedPane.setIconAt(
--                index,
--                connectionClosedOnErrorIcon);
--    }
--
--    synchronized static void connectionEstablished(EnhancedDebugger debugger) {
--        getInstance().tabbedPane.setIconAt(
--                getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane),
--                connectionActiveIcon);
--    }
--    
--    /**
--     * Creates the main debug window that provides information about Smack and also shows
--     * a tab panel for each connection that is being debugged.
--     */
--    private void createDebug() {
--
--        frame = new JFrame("Smack Debug Window");
--
--        if (!PERSISTED_DEBUGGER) {
--            // Add listener for window closing event
--            frame.addWindowListener(new WindowAdapter() {
--                public void windowClosing(WindowEvent evt) {
--                    rootWindowClosing(evt);
--                }
--            });
--        }
--
--        // We'll arrange the UI into tabs. The last tab contains Smack's information.
--        // All the connection debugger tabs will be shown before the Smack info tab. 
--        tabbedPane = new JTabbedPane();
--
--        // Create the Smack info panel 
--        JPanel informationPanel = new JPanel();
--        informationPanel.setLayout(new BoxLayout(informationPanel, BoxLayout.Y_AXIS));
--
--        // Add the Smack version label
--        JPanel versionPanel = new JPanel();
--        versionPanel.setLayout(new BoxLayout(versionPanel, BoxLayout.X_AXIS));
--        versionPanel.setMaximumSize(new Dimension(2000, 31));
--        versionPanel.add(new JLabel(" Smack version: "));
--        JFormattedTextField field = new JFormattedTextField(SmackConfiguration.getVersion());
--        field.setEditable(false);
--        field.setBorder(null);
--        versionPanel.add(field);
--        informationPanel.add(versionPanel);
--
--        // Add the list of installed IQ Providers
--        JPanel iqProvidersPanel = new JPanel();
--        iqProvidersPanel.setLayout(new GridLayout(1, 1));
--        iqProvidersPanel.setBorder(BorderFactory.createTitledBorder("Installed IQ Providers"));
--        Vector<String> providers = new Vector<String>();
--        for (Object provider : ProviderManager.getInstance().getIQProviders()) {
--            if (provider.getClass() == Class.class) {
--                providers.add(((Class) provider).getName());
--            }
--            else {
--                providers.add(provider.getClass().getName());
--            }
--        }
--        // Sort the collection of providers
--        Collections.sort(providers);
--        JList list = new JList(providers);
--        iqProvidersPanel.add(new JScrollPane(list));
--        informationPanel.add(iqProvidersPanel);
--
--        // Add the list of installed Extension Providers
--        JPanel extensionProvidersPanel = new JPanel();
--        extensionProvidersPanel.setLayout(new GridLayout(1, 1));
--        extensionProvidersPanel.setBorder(BorderFactory.createTitledBorder("Installed Extension Providers"));
--        providers = new Vector<String>();
--        for (Object provider : ProviderManager.getInstance().getExtensionProviders()) {
--            if (provider.getClass() == Class.class) {
--                providers.add(((Class) provider).getName());
--            }
--            else {
--                providers.add(provider.getClass().getName());
--            }
--        }
--        // Sort the collection of providers
--        Collections.sort(providers);
--        list = new JList(providers);
--        extensionProvidersPanel.add(new JScrollPane(list));
--        informationPanel.add(extensionProvidersPanel);
--
--        tabbedPane.add("Smack Info", informationPanel);
--
--        // Add pop-up menu.
--        JPopupMenu menu = new JPopupMenu();
--        // Add a menu item that allows to close the current selected tab
--        JMenuItem menuItem = new JMenuItem("Close");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                // Remove the selected tab pane if it's not the Smack info pane
--                if (tabbedPane.getSelectedIndex() < tabbedPane.getComponentCount() - 1) {
--                    int index = tabbedPane.getSelectedIndex();
--                    // Notify to the debugger to stop debugging
--                    EnhancedDebugger debugger = debuggers.get(index);
--                    debugger.cancel();
--                    // Remove the debugger from the root window
--                    tabbedPane.remove(debugger.tabbedPane);
--                    debuggers.remove(debugger);
--                    // Update the root window title
--                    frame.setTitle(
--                            "Smack Debug Window -- Total connections: "
--                                    + (tabbedPane.getComponentCount() - 1));
--                }
--            }
--        });
--        menu.add(menuItem);
--        // Add a menu item that allows to close all the tabs that have their connections closed
--        menuItem = new JMenuItem("Close All Not Active");
--        menuItem.addActionListener(new ActionListener() {
--            public void actionPerformed(ActionEvent e) {
--                ArrayList<EnhancedDebugger> debuggersToRemove = new ArrayList<EnhancedDebugger>();
--                // Remove all the debuggers of which their connections are no longer valid
--                for (int index = 0; index < tabbedPane.getComponentCount() - 1; index++) {
--                    EnhancedDebugger debugger = debuggers.get(index);
--                    if (!debugger.isConnectionActive()) {
--                        // Notify to the debugger to stop debugging
--                        debugger.cancel();
--                        debuggersToRemove.add(debugger);
--                    }
--                }
--                for (EnhancedDebugger debugger : debuggersToRemove) {
--                    // Remove the debugger from the root window
--                    tabbedPane.remove(debugger.tabbedPane);
--                    debuggers.remove(debugger);
--                }
--                // Update the root window title
--                frame.setTitle(
--                        "Smack Debug Window -- Total connections: "
--                                + (tabbedPane.getComponentCount() - 1));
--            }
--        });
--        menu.add(menuItem);
--        // Add listener to the text area so the popup menu can come up.
--        tabbedPane.addMouseListener(new PopupListener(menu));
--
--        frame.getContentPane().add(tabbedPane);
--
--        frame.setSize(650, 400);
--
--        if (!PERSISTED_DEBUGGER) {
--            frame.setVisible(true);
--        }
--    }
--
--    /**
--     * Notification that the root window is closing. Stop listening for received and
--     * transmitted packets in all the debugged connections.
--     *
--     * @param evt the event that indicates that the root window is closing
--     */
--    public void rootWindowClosing(WindowEvent evt) {
--        // Notify to all the debuggers to stop debugging
--        for (EnhancedDebugger debugger : debuggers) {
--            debugger.cancel();
--        }
--        // Release any reference to the debuggers
--        debuggers.removeAll(debuggers);
--        // Release the default instance
--        instance = null;
--    }
--
--    /**
--     * Listens for debug window popup dialog events.
--     */
--    private class PopupListener extends MouseAdapter {
--
--        JPopupMenu popup;
--
--        PopupListener(JPopupMenu popupMenu) {
--            popup = popupMenu;
--        }
--
--        public void mousePressed(MouseEvent e) {
--            maybeShowPopup(e);
--        }
--
--        public void mouseReleased(MouseEvent e) {
--            maybeShowPopup(e);
--        }
--
--        private void maybeShowPopup(MouseEvent e) {
--            if (e.isPopupTrigger()) {
--                popup.show(e.getComponent(), e.getX(), e.getY());
--            }
--        }
--    }
--
--    public void setVisible(boolean visible) {
--        if (frame != null) {
--            frame.setVisible(visible);
--        }
--    }
--
--    public boolean isVisible() {
--        return frame != null && frame.isVisible();
--    }
--}
-diff -Nbdru org/jivesoftware/smackx/debugger/package.html /home/nikita/devel/beem-ui/src/org/jivesoftware/smackx/debugger/package.html
---- org/jivesoftware/smackx/debugger/package.html	2009-06-26 21:11:18.352250912 +0200
-+++ /home/nikita/devel/beem-ui/src/org/jivesoftware/smackx/debugger/package.html	1970-01-01 01:00:00.000000000 +0100
-@@ -1 +0,0 @@
--<body>Smack optional Debuggers.</body>
-\ No newline at end of file
--- a/libs/smack-android-r1.diff	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +0,0 @@
-Index: org/jivesoftware/smack/XMPPConnection.java
-===================================================================
---- org/jivesoftware/smack/XMPPConnection.java	(revision 10869)
-+++ org/jivesoftware/smack/XMPPConnection.java	(working copy)
-@@ -1082,7 +1082,7 @@
-                     catch (Exception ex) {
-                         try {
-                             debuggerClass =
--                                    Class.forName("org.jivesoftware.smack.debugger.LiteDebugger");
-+                                    Class.forName("org.jivesoftware.smack.debugger.ConsoleDebugger");
-                         }
-                         catch (Exception ex2) {
-                             ex2.printStackTrace();
-Index: org/jivesoftware/smack/sasl/SASLMechanism.java
-===================================================================
---- org/jivesoftware/smack/sasl/SASLMechanism.java	(revision 10869)
-+++ org/jivesoftware/smack/sasl/SASLMechanism.java	(working copy)
-@@ -20,24 +20,18 @@
- 
- package org.jivesoftware.smack.sasl;
- 
--import org.jivesoftware.smack.XMPPException;
--import org.jivesoftware.smack.SASLAuthentication;
--import org.jivesoftware.smack.util.Base64;
--
- import java.io.IOException;
--import java.util.Map;
- import java.util.HashMap;
-+import java.util.Map;
-+
-+import javax.security.auth.callback.Callback;
- import javax.security.auth.callback.CallbackHandler;
- import javax.security.auth.callback.UnsupportedCallbackException;
--import javax.security.auth.callback.Callback;
--import javax.security.auth.callback.NameCallback;
--import javax.security.auth.callback.PasswordCallback;
--import javax.security.sasl.RealmCallback;
--import javax.security.sasl.RealmChoiceCallback;
--import javax.security.sasl.Sasl;
--import javax.security.sasl.SaslClient;
--import javax.security.sasl.SaslException;
- 
-+import org.jivesoftware.smack.SASLAuthentication;
-+import org.jivesoftware.smack.XMPPException;
-+import org.jivesoftware.smack.util.Base64;
-+
- /**
-  * Base class for SASL mechanisms. Subclasses must implement these methods:
-  * <ul>
-@@ -56,7 +50,7 @@
- public abstract class SASLMechanism implements CallbackHandler {
- 
-     private SASLAuthentication saslAuthentication;
--    protected SaslClient sc;
-+    //protected SaslClient sc;
-     protected String authenticationId;
-     protected String password;
-     protected String hostname;
-@@ -88,7 +82,7 @@
- 
-         String[] mechanisms = { getName() };
-         Map<String,String> props = new HashMap<String,String>();
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-         authenticate();
-     }
- 
-@@ -105,7 +99,7 @@
-     public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
-         String[] mechanisms = { getName() };
-         Map<String,String> props = new HashMap<String,String>();
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-         authenticate();
-     }
- 
-@@ -113,17 +107,17 @@
-         StringBuilder stanza = new StringBuilder();
-         stanza.append("<auth mechanism=\"").append(getName());
-         stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
--        try {
--            if(sc.hasInitialResponse()) {
--                byte[] response = sc.evaluateChallenge(new byte[0]);
--                String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
--                if(authenticationText != null && !authenticationText.equals("")) {                 
--                    stanza.append(authenticationText);
--                }
--            }
--        } catch (SaslException e) {
--            throw new XMPPException("SASL authentication failed", e);
--        }
-+//        try {
-+//            if(sc.hasInitialResponse()) {
-+//                byte[] response = sc.evaluateChallenge(new byte[0]);
-+//                String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
-+//                if(authenticationText != null && !authenticationText.equals("")) {                 
-+//                    stanza.append(authenticationText);
-+//                }
-+//            }
-+//        } catch (SaslException e) {
-+//            throw new XMPPException("SASL authentication failed", e);
-+//        }
-         stanza.append("</auth>");
- 
-         // Send the authentication to the server
-@@ -142,12 +136,12 @@
-         // Build the challenge response stanza encoding the response text
-         StringBuilder stanza = new StringBuilder();
- 
--        byte response[];
--        if(challenge != null) {
--            response = sc.evaluateChallenge(Base64.decode(challenge));
--        } else {
--            response = sc.evaluateChallenge(null);
--        }
-+        byte response[] = null;
-+//        if(challenge != null) {
-+//            response = sc.evaluateChallenge(Base64.decode(challenge));
-+//        } else {
-+//            response = sc.evaluateChallenge(null);
-+//        }
- 
-         String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
-         if(authenticationText.equals("")) {
-@@ -179,21 +173,21 @@
-      */
-     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-         for (int i = 0; i < callbacks.length; i++) {
--            if (callbacks[i] instanceof NameCallback) {
--                NameCallback ncb = (NameCallback)callbacks[i];
--                ncb.setName(authenticationId);
--            } else if(callbacks[i] instanceof PasswordCallback) {
--                PasswordCallback pcb = (PasswordCallback)callbacks[i];
--                pcb.setPassword(password.toCharArray());
--            } else if(callbacks[i] instanceof RealmCallback) {
--                RealmCallback rcb = (RealmCallback)callbacks[i];
--                rcb.setText(hostname);
--            } else if(callbacks[i] instanceof RealmChoiceCallback){
--                //unused
--                //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
--            } else {
-+//            if (callbacks[i] instanceof NameCallback) {
-+//                NameCallback ncb = (NameCallback)callbacks[i];
-+//                ncb.setName(authenticationId);
-+//            } else if(callbacks[i] instanceof PasswordCallback) {
-+//                PasswordCallback pcb = (PasswordCallback)callbacks[i];
-+//                pcb.setPassword(password.toCharArray());
-+//            } else if(callbacks[i] instanceof RealmCallback) {
-+//                RealmCallback rcb = (RealmCallback)callbacks[i];
-+//                rcb.setText(hostname);
-+//            } else if(callbacks[i] instanceof RealmChoiceCallback){
-+//                //unused
-+//                //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
-+//            } else {
-                throw new UnsupportedCallbackException(callbacks[i]);
--            }
-+            //}
-          }
-     }
- }
-Index: org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java
-===================================================================
---- org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	(revision 10869)
-+++ org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	(working copy)
-@@ -25,8 +25,6 @@
- import java.io.IOException;
- import java.util.Map;
- import java.util.HashMap;
--import javax.security.sasl.Sasl;
--import javax.security.sasl.SaslClient;
- import javax.security.auth.callback.CallbackHandler;
- 
- /**
-@@ -62,8 +60,8 @@
-     public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
-         String[] mechanisms = { getName() };
-         Map props = new HashMap();
--        props.put(Sasl.SERVER_AUTH,"TRUE");
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-+        //props.put(Sasl.SERVER_AUTH,"TRUE");
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
-         authenticate();
-     }
- 
-@@ -81,8 +79,8 @@
-     public void authenticate(String username, String host, String password) throws IOException, XMPPException {
-         String[] mechanisms = { getName() };
-         Map props = new HashMap();
--        props.put(Sasl.SERVER_AUTH,"TRUE");
--        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-+        //props.put(Sasl.SERVER_AUTH,"TRUE");
-+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
-         authenticate();
-     }
- 
-Index: org/jivesoftware/smack/ConnectionConfiguration.java
-===================================================================
---- org/jivesoftware/smack/ConnectionConfiguration.java	(revision 10869)
-+++ org/jivesoftware/smack/ConnectionConfiguration.java	(working copy)
-@@ -57,13 +57,13 @@
- 
-     private boolean compressionEnabled = false;
- 
--    private boolean saslAuthenticationEnabled = true;
-+    private boolean saslAuthenticationEnabled = false;
-     /**
-      * Used to get information from the user
-      */
-     private CallbackHandler callbackHandler;
- 
--    private boolean debuggerEnabled = XMPPConnection.DEBUG_ENABLED;
-+    private boolean debuggerEnabled = true;//XMPPConnection.DEBUG_ENABLED;
- 
-     // Flag that indicates if a reconnection should be attempted when abruptly disconnected
-     private boolean reconnectionAllowed = true;
-@@ -517,7 +517,7 @@
-      *        logging into the server.
-      */
-     public void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled) {
--        this.saslAuthenticationEnabled = saslAuthenticationEnabled;
-+        //this.saslAuthenticationEnabled = saslAuthenticationEnabled;
-     }
- 
-     /**
-Index: org/jivesoftware/smack/util/DNSUtil.java
-===================================================================
---- org/jivesoftware/smack/util/DNSUtil.java	(revision 10869)
-+++ org/jivesoftware/smack/util/DNSUtil.java	(working copy)
-@@ -19,9 +19,6 @@
- 
- package org.jivesoftware.smack.util;
- 
--import javax.naming.directory.Attributes;
--import javax.naming.directory.DirContext;
--import javax.naming.directory.InitialDirContext;
- import java.util.Hashtable;
- import java.util.Map;
- 
-@@ -38,13 +35,13 @@
-      */
-     private static Map cache = new Cache(100, 1000*60*10);
- 
--    private static DirContext context;
-+    //private static DirContext context;
- 
-     static {
-         try {
-             Hashtable env = new Hashtable();
-             env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
--            context = new InitialDirContext(env);
-+//            context = new InitialDirContext(env);
-         }
-         catch (Exception e) {
-             // Ignore.
-@@ -69,39 +66,8 @@
-      *      server can be reached at for the specified domain.
-      */
-     public static HostAddress resolveXMPPDomain(String domain) {
--        if (context == null) {
-             return new HostAddress(domain, 5222);
--        }
--        String key = "c" + domain;
--        // Return item from cache if it exists.
--        if (cache.containsKey(key)) {
--            HostAddress address = (HostAddress)cache.get(key);
--            if (address != null) {
--                return address;
--            }
--        }
--        String host = domain;
--        int port = 5222;
--        try {
--            Attributes dnsLookup =
--                    context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
--            String srvRecord = (String)dnsLookup.get("SRV").get();
--            String [] srvRecordEntries = srvRecord.split(" ");
--            port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--            host = srvRecordEntries[srvRecordEntries.length-1];
--        }
--        catch (Exception e) {
--            // Ignore.
--        }
--        // Host entries in DNS should end with a ".".
--        if (host.endsWith(".")) {
--            host = host.substring(0, host.length()-1);
--        }
--        HostAddress address = new HostAddress(host, port);
--        // Add item to cache.
--        cache.put(key, address);
--        return address;
--    }
-+      }
- 
-     /**
-      * Returns the host name and port that the specified XMPP server can be
-@@ -121,50 +87,8 @@
-      *      server can be reached at for the specified domain.
-      */
-     public static HostAddress resolveXMPPServerDomain(String domain) {
--        if (context == null) {
-             return new HostAddress(domain, 5269);
--        }
--        String key = "s" + domain;
--        // Return item from cache if it exists.
--        if (cache.containsKey(key)) {
--            HostAddress address = (HostAddress)cache.get(key);
--            if (address != null) {
--                return address;
--            }
--        }
--        String host = domain;
--        int port = 5269;
--        try {
--            Attributes dnsLookup =
--                    context.getAttributes("_xmpp-server._tcp." + domain, new String[]{"SRV"});
--            String srvRecord = (String)dnsLookup.get("SRV").get();
--            String [] srvRecordEntries = srvRecord.split(" ");
--            port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--            host = srvRecordEntries[srvRecordEntries.length-1];
--        }
--        catch (Exception e) {
--            // Attempt lookup with older "jabber" name.
--            try {
--                Attributes dnsLookup =
--                        context.getAttributes("_jabber._tcp." + domain, new String[]{"SRV"});
--                String srvRecord = (String)dnsLookup.get("SRV").get();
--                String [] srvRecordEntries = srvRecord.split(" ");
--                port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
--                host = srvRecordEntries[srvRecordEntries.length-1];
--            }
--            catch (Exception e2) {
--                // Ignore.
--            }
--        }
--        // Host entries in DNS should end with a ".".
--        if (host.endsWith(".")) {
--            host = host.substring(0, host.length()-1);
--        }
--        HostAddress address = new HostAddress(host, port);
--        // Add item to cache.
--        cache.put(key, address);
--        return address;
--    }
-+      }
- 
-     /**
-      * Encapsulates a hostname and port.
-Index: org/jivesoftware/smack/util/PacketParserUtils.java
-===================================================================
---- org/jivesoftware/smack/util/PacketParserUtils.java	(revision 10869)
-+++ org/jivesoftware/smack/util/PacketParserUtils.java	(working copy)
-@@ -25,7 +25,7 @@
- import org.jivesoftware.smack.provider.ProviderManager;
- import org.xmlpull.v1.XmlPullParser;
- 
--import java.beans.PropertyDescriptor;
-+//import java.beans.PropertyDescriptor;
- import java.io.ByteArrayInputStream;
- import java.io.ObjectInputStream;
- import java.util.ArrayList;
-@@ -428,26 +428,26 @@
-     {
-         boolean done = false;
-         Object object = objectClass.newInstance();
--        while (!done) {
--            int eventType = parser.next();
--            if (eventType == XmlPullParser.START_TAG) {
--                String name = parser.getName();
--                String stringValue = parser.nextText();
--                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
--                // Load the class type of the property.
--                Class propertyType = descriptor.getPropertyType();
--                // Get the value of the property by converting it from a
--                // String to the correct object type.
--                Object value = decode(propertyType, stringValue);
--                // Set the value of the bean.
--                descriptor.getWriteMethod().invoke(object, value);
--            }
--            else if (eventType == XmlPullParser.END_TAG) {
--                if (parser.getName().equals(elementName)) {
--                    done = true;
--                }
--            }
--        }
-+//        while (!done) {
-+//            int eventType = parser.next();
-+//            if (eventType == XmlPullParser.START_TAG) {
-+//                String name = parser.getName();
-+//                String stringValue = parser.nextText();
-+//                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
-+//                // Load the class type of the property.
-+//                Class propertyType = descriptor.getPropertyType();
-+//                // Get the value of the property by converting it from a
-+//                // String to the correct object type.
-+//                Object value = decode(propertyType, stringValue);
-+//                // Set the value of the bean.
-+//                descriptor.getWriteMethod().invoke(object, value);
-+//            }
-+//            else if (eventType == XmlPullParser.END_TAG) {
-+//                if (parser.getName().equals(elementName)) {
-+//                    done = true;
-+//                }
-+//            }
-+//        }
-         return object;
-     }
- 
--- a/libs/smack-android.diff	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-Only in .: smack-android.diff
-Only in ..\..\smack_src_3_0_4/source/org: apache
-diff -r -u ./source/org/jivesoftware/smack/PacketReader.java ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/PacketReader.java
---- ./source/org/jivesoftware/smack/PacketReader.java	2007-12-31 09:28:46.453125000 -0500
-+++ ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/PacketReader.java	2007-12-30 21:17:14.343750000 -0500
-@@ -25,9 +25,9 @@
- import org.jivesoftware.smack.provider.IQProvider;
- import org.jivesoftware.smack.provider.ProviderManager;
- import org.jivesoftware.smack.util.PacketParserUtils;
--import org.xmlpull.mxp1.MXParser;
- import org.xmlpull.v1.XmlPullParser;
- import org.xmlpull.v1.XmlPullParserException;
-+import org.kxml2.io.KXmlParser;
- 
- import java.io.IOException;
- import java.util.*;
-@@ -249,7 +249,7 @@
-      */
-     private void resetParser() {
-         try {
--            parser = new MXParser();
-+            parser = new KXmlParser();
-             parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-             parser.setInput(connection.reader);
-         }
-diff -r -u ./source/org/jivesoftware/smack/SmackConfiguration.java ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/SmackConfiguration.java
---- ./source/org/jivesoftware/smack/SmackConfiguration.java	2007-12-31 09:28:46.593750000 -0500
-+++ ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/SmackConfiguration.java	2007-12-30 21:17:14.359375000 -0500
-@@ -20,8 +20,8 @@
- 
- package org.jivesoftware.smack;
- 
--import org.xmlpull.mxp1.MXParser;
- import org.xmlpull.v1.XmlPullParser;
-+import org.kxml2.io.KXmlParser;
- 
- import java.io.InputStream;
- import java.net.URL;
-@@ -72,7 +72,7 @@
-                     InputStream systemStream = null;
-                     try {
-                         systemStream = url.openStream();
--                        XmlPullParser parser = new MXParser();
-+                        XmlPullParser parser = new KXmlParser();
-                         parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-                         parser.setInput(systemStream, "UTF-8");
-                         int eventType = parser.getEventType();
-diff -r -u ./source/org/jivesoftware/smack/XMPPConnection.java ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/XMPPConnection.java
---- ./source/org/jivesoftware/smack/XMPPConnection.java	2007-12-31 09:28:46.593750000 -0500
-+++ ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/XMPPConnection.java	2007-12-30 21:34:37.296875000 -0500
-@@ -1113,14 +1113,14 @@
-         SSLContext context = SSLContext.getInstance("TLS");
-         // Verify certificate presented by the server
-         context.init(null, // KeyManager not required
--                new javax.net.ssl.TrustManager[]{new ServerTrustManager(serviceName, configuration)},
-+                new javax.net.ssl.TrustManager[]{new OpenTrustManager()},
-                 new java.security.SecureRandom());
-         Socket plain = socket;
-         // Secure the plain connection
-         socket = context.getSocketFactory().createSocket(plain,
-                 plain.getInetAddress().getHostName(), plain.getPort(), true);
--        socket.setSoTimeout(0);
--        socket.setKeepAlive(true);
-+        //socket.setSoTimeout(0);
-+        //socket.setKeepAlive(true);
-         // Initialize the reader and writer with the new secured version
-         initReaderAndWriter();
-         // Proceed to do the handshake
-diff -r -u ./source/org/jivesoftware/smack/provider/ProviderManager.java ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/provider/ProviderManager.java
---- ./source/org/jivesoftware/smack/provider/ProviderManager.java	2007-12-31 09:28:46.843750000 -0500
-+++ ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/provider/ProviderManager.java	2007-12-30 21:17:14.343750000 -0500
-@@ -22,8 +22,8 @@
- 
- import org.jivesoftware.smack.packet.IQ;
- import org.jivesoftware.smack.packet.PacketExtension;
--import org.xmlpull.mxp1.MXParser;
- import org.xmlpull.v1.XmlPullParser;
-+import org.kxml2.io.KXmlParser;
- 
- import java.io.InputStream;
- import java.net.URL;
-@@ -164,7 +164,7 @@
-                     InputStream providerStream = null;
-                     try {
-                         providerStream = url.openStream();
--                        XmlPullParser parser = new MXParser();
-+                        XmlPullParser parser = new KXmlParser();
-                         parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-                         parser.setInput(providerStream, "UTF-8");
-                         int eventType = parser.getEventType();
-diff -r -u ./source/org/jivesoftware/smack/util/PacketParserUtils.java ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/util/PacketParserUtils.java
---- ./source/org/jivesoftware/smack/util/PacketParserUtils.java	2007-12-31 09:28:46.953125000 -0500
-+++ ..\..\smack_src_3_0_4/source/org/jivesoftware/smack/util/PacketParserUtils.java	2007-12-30 21:45:08.093750000 -0500
-@@ -426,29 +426,30 @@
-     public static Object parseWithIntrospection(String elementName,
-             Class objectClass, XmlPullParser parser) throws Exception
-     {
--        boolean done = false;
--        Object object = objectClass.newInstance();
--        while (!done) {
--            int eventType = parser.next();
--            if (eventType == XmlPullParser.START_TAG) {
--                String name = parser.getName();
--                String stringValue = parser.nextText();
--                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
--                // Load the class type of the property.
--                Class propertyType = descriptor.getPropertyType();
--                // Get the value of the property by converting it from a
--                // String to the correct object type.
--                Object value = decode(propertyType, stringValue);
--                // Set the value of the bean.
--                descriptor.getWriteMethod().invoke(object, value);
--            }
--            else if (eventType == XmlPullParser.END_TAG) {
--                if (parser.getName().equals(elementName)) {
--                    done = true;
--                }
--            }
--        }
--        return object;
-+//        boolean done = false;
-+//        Object object = objectClass.newInstance();
-+//        while (!done) {
-+//            int eventType = parser.next();
-+//            if (eventType == XmlPullParser.START_TAG) {
-+//                String name = parser.getName();
-+//                String stringValue = parser.nextText();
-+//                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
-+//                // Load the class type of the property.
-+//                Class propertyType = descriptor.getPropertyType();
-+//                // Get the value of the property by converting it from a
-+//                // String to the correct object type.
-+//                Object value = decode(propertyType, stringValue);
-+//                // Set the value of the bean.
-+//                descriptor.getWriteMethod().invoke(object, value);
-+//            }
-+//            else if (eventType == XmlPullParser.END_TAG) {
-+//                if (parser.getName().equals(elementName)) {
-+//                    done = true;
-+//                }
-+//            }
-+//        }
-+//        return object;
-+        return null;
-     }
- 
-     /**
-Only in ..\..\smack_src_3_0_4: target
Binary file libs/smack.jar has changed
Binary file libs/smackx-debug.jar has changed
Binary file libs/smackx-jingle.jar has changed
Binary file libs/smackx.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/call.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_height="fill_parent" android:layout_width="fill_parent"
+	android:orientation="vertical">
+	<LinearLayout android:layout_width="fill_parent"
+		android:layout_height="fill_parent" android:orientation="vertical"
+		android:layout_weight="1">
+		<ImageView android:id="@+id/call_logo_anim" android:src="@drawable/beem_launcher_icon_color"
+			android:layout_height="fill_parent" android:layout_width="fill_parent"
+			android:layout_weight="1" />
+		<TextView android:id="@+id/call_info" android:layout_width="fill_parent"
+			android:layout_height="fill_parent" android:text="Message pour savoir ou en est la conversation"
+			android:layout_gravity="bottom" android:layout_weight="1"
+			android:gravity="center" />
+	</LinearLayout>
+	<Button android:id="@+id/call_cancel_button"
+		android:layout_height="wrap_content" android:layout_width="fill_parent"
+		android:layout_gravity="bottom" android:text="~ Close Call ~" />
+	<Button android:id="@+id/call_accept_button"
+		android:layout_height="wrap_content" android:layout_width="fill_parent"
+		android:layout_gravity="bottom" android:text="~ Accept Call ~" android:visible="true" />
+</LinearLayout>
+
--- a/res/layout/jingle_call_activity.xml	Thu Jan 21 01:35:17 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:layout_width="fill_parent" android:layout_height="wrap_content"
-	android:orientation="vertical">
-<!--         <TextView android:text="Jid:" android:id="@+id/jingledemocalljidlabel"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-	<EditText android:id="@+id/jingledemocalljid"
-		android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
-	<TextView android:text="Password:" android:id="@+id/jingledemocallpasswordlabel"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-	<EditText android:id="@+id/jingledemocallpassword"
-		android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textPassword" ></EditText>
-
-	<Button android:text="Connexion" android:id="@+id/jingledemocallconnectbutton"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
-	<TextView android:text="Call who :" android:id="@+id/jingledemocallreceiverlabel"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-
-<EditText android:text="" android:id="@+id/jingledemocallreceiver" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
-
-<Button android:text="Call" android:id="@+id/jingledemocallbutton" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>       -->
-<ImageView android:id="@+id/log_as_logo"
-    android:layout_width="fill_parent" android:layout_height="wrap_content"
-    android:layout_marginBottom="25px" android:layout_marginTop="42px" />
-</LinearLayout>
--- a/res/layout/login_anim.xml	Thu Jan 21 01:35:17 2010 +0100
+++ b/res/layout/login_anim.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -6,6 +6,9 @@
 	<ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_launcher_icon_color"
 		android:layout_height="fill_parent" android:layout_width="fill_parent"
 		android:layout_weight="1" />
+	<TextView android:id="@+id/loginanim_status_text"
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:textSize="20sp" android:gravity="center" android:textColor="@color/vert_manu"/>
 	<Button android:id="@+id/loginanim_cancel_button"
 		android:layout_height="wrap_content" android:layout_width="fill_parent"
 		android:layout_gravity="bottom" android:text="@string/CancelButton" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/menu/call.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,10 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+	<item android:id="@+id/call_speaker_on" android:visible="true"
+		android:title="~ speaker on ~" android:icon="@android:drawable/ic_lock_silent_mode_off" />
+	<item android:id="@+id/call_speaker_off" android:visible="true"
+		android:title="~ speaker off ~" android:icon="@android:drawable/ic_lock_silent_mode" />
+	<item android:id="@+id/call_hold_on" android:visible="true"
+		android:title="~ hold on ~ " android:icon="@android:drawable/ic_lock_lock" />
+	<item android:id="@+id/call_hold_on" android:visible="true"
+		android:title="~ hold on ~ " android:icon="@android:drawable/ic_menu_call" /> 
+</menu>
--- a/res/values-fr/arrays.xml	Thu Jan 21 01:35:17 2010 +0100
+++ b/res/values-fr/arrays.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -18,4 +18,10 @@
 		<item name="@string/privacy_list_select_dialog_groups">Groupes</item>
 		<item name="@string/privacy_list_select_dialog_delete">Supprimer</item>
 	</string-array>
+	<string-array name="loganim_state">
+		<item name="@string/loganim_connecting">Connexion en cours...</item>
+		<item name="@string/loganim_authenticating">Authentification...</item>
+		<item name="@string/loganim_login_success">Connexion effectuée</item>
+		<item name="@string/loganim_login_failed">Echec de la connexion</item>
+	</string-array>
 </resources>
--- a/res/values/arrays.xml	Thu Jan 21 01:35:17 2010 +0100
+++ b/res/values/arrays.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -18,4 +18,10 @@
 		<item name="@string/privacy_list_select_dialog_groups">Groups</item>
 		<item name="@string/privacy_list_select_dialog_delete">Delete</item>
 	</string-array>
+	<string-array name="loganim_state">
+		<item name="@string/loganim_connecting">Connecting...</item>
+		<item name="@string/loganim_authenticating">Authenticating...</item>
+		<item name="@string/loganim_login_success">Login success</item>
+		<item name="@string/loganim_login_failed">Login failed</item>
+	</string-array>
 </resources>
--- a/res/values/colors.xml	Thu Jan 21 01:35:17 2010 +0100
+++ b/res/values/colors.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 	<color name="blue_sky">#A0C8FF</color>
+	<color name="vert_manu">#CCFF00</color>
 	<color name="black">#000000</color>
 	<color name="white">#FFFFFF</color>
 	<color name="red">#FF0000</color>
--- a/src/com/beem/project/beem/jingle/JingleService.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/jingle/JingleService.java	Sat Jan 23 13:42:20 2010 +0100
@@ -40,7 +40,7 @@
     Flavien Astraud, November 26, 2009
     Head of the EIP Laboratory.
 
-*/
+ */
 package com.beem.project.beem.jingle;
 
 import java.util.ArrayList;
@@ -60,196 +60,246 @@
 import org.sipdroid.media.codecs.CodecManager;
 
 import android.content.Context;
+import android.net.Uri;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
 import android.util.Log;
 import android.content.Intent;
 
-import com.beem.project.beem.ui.CallScreen;
+import com.beem.project.beem.ui.Call;
+import com.beem.project.beem.service.aidl.IBeemJingleListener;
+import com.beem.project.beem.service.aidl.IJingle;
 
-// TODO: Auto-generated Javadoc
 /**
  * Beem Jingle Service, manage jingle call.
  * @author nikita
  */
-public class JingleService {
-	private static final String TAG = "JingleService";
-	private JingleManager mJingleManager;
-	private final List<JingleMediaManager> mMediaManagers;
-	private JingleSession mIn;
-	private JingleSession mOut;
-	private Context mContext;
+public class JingleService extends IJingle.Stub {
+    private static final String TAG = "JingleService";
+    private JingleManager mJingleManager;
+    private final List<JingleMediaManager> mMediaManagers;
+    private final RemoteCallbackList<IBeemJingleListener> mRemoteJingleListeners = new RemoteCallbackList<IBeemJingleListener>();
+    private JingleSession mIn;
+
+    private JingleSession mOut;
+    private JingleSessionRequest mRequest;
+    private Context mContext;
+    private boolean isCaller;
+
+    /**
+     * JingleService constructor.
+     * @param xmppConnection a valid XMPPConnection
+     */
+    public JingleService(final XMPPConnection xmppConnection,final Context ctx) {
+	BasicTransportManager bt = new BasicTransportManager();
+	mMediaManagers = new ArrayList<JingleMediaManager>();
+	mMediaManagers.add(new MicrophoneRTPManager(bt, ctx));
+	CodecManager.load();
+	mContext = ctx;
+    }
 
-	/**
-	 * JingleService constructor.
-	 * @param xmppConnection a valid XMPPConnection
-	 */
-	public JingleService(final XMPPConnection xmppConnection,final Context ctx) {
-		BasicTransportManager bt = new BasicTransportManager();
-		mMediaManagers = new ArrayList<JingleMediaManager>();
-		mMediaManagers.add(new MicrophoneRTPManager(bt, ctx));
-		CodecManager.load();
-		mContext = ctx;
-	}
+    /**
+     * finish to construct the instance.
+     * @param conn the xmppConnection used with constructor
+     */
+    public void initWhenConntected(XMPPConnection conn) {
+	mJingleManager = new JingleManager(conn, mMediaManagers);
+	mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addJingleListener(IBeemJingleListener listen) throws RemoteException {
+	if (listen != null)
+	    mRemoteJingleListeners.register(listen);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeJingleListener(IBeemJingleListener listen) throws RemoteException {
+	if (listen != null)
+	    mRemoteJingleListeners.unregister(listen);
+    }
 
-	/**
-	 * finish to construct the instance.
-	 * @param conn the xmppConnection used with constructor
-	 */
-	public void initWhenConntected(XMPPConnection conn) {
-		mJingleManager = new JingleManager(conn, mMediaManagers);
-		mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
+    /**
+     * begin a jingle call.
+     * @param receiver the call receiver
+     */
+    @Override
+    public void call(final String receiver) throws RemoteException {
+	try {
+	    mOut = mJingleManager.createOutgoingJingleSession(receiver);
+	    mOut.addListener(new BeemJingleSessionListener());
+	    mOut.startOutgoing();
+	    isCaller = true;
+	} catch (XMPPException e) {
+	    e.printStackTrace();
 	}
+    }
+
+
+    @Override
+    public void acceptCall() throws RemoteException {
+	try {
+	    mRequest.accept();
+	} catch (XMPPException e) {
+	    e.printStackTrace();
+	}
+	isCaller = false;
+    }
 
-	/**
-	 * begin a jingle call.
-	 * @param receiver the call receiver
-	 */
-	public void call(final String receiver) {
-		try {
-			mOut = mJingleManager.createOutgoingJingleSession(receiver);
-			// TODO configure out avec addMediaSession et addNegociator
-			mOut.addListener(new BeemJingleCallerSessionListener());
-			mOut.startOutgoing();
-		} catch (XMPPException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
+    /**
+     * close a jingle call.
+     */
+    @Override
+    public void closeCall() throws RemoteException {
+	if (isCaller) {
+	    try {
+		mOut.terminate("Cancelled");
+		//mOut.close();
+	    } catch (XMPPException e) {
+		e.printStackTrace();
+	    }
+	    mOut = null;
+	} else {
+	    try {
+		mRequest.reject();
+		mIn.terminate();
+		mIn.close();		    
+	    } catch (XMPPException e) {
+		e.printStackTrace();
+	    }
+	    mIn = null;
 	}
-
-	/*private void call(PayloadType pt, TransportCandidate remoteCandidate,
-			TransportCandidate localCandidate, JingleSession jingleSession) {
+    }
 
-		audio = new JAudioLauncher(localCandidate.getPort(), remoteCandidate.getIp(),
-				remoteCandidate.getPort(), pt); 
-
-	}*/
+    /**
+     * Listen on session events.
+     * @author nikita
+     */
+    private class BeemJingleSessionListener implements JingleSessionListener {
 
 	/**
-	 * Listen on receiver session events.
-	 * @author nikita
+	 * constructor.
 	 */
-	private class BeemJingleReceiverSessionListener implements JingleSessionListener {
+	public BeemJingleSessionListener() {
+	    super();
+	}
+
+	@Override
+	public void sessionClosed(String reason, JingleSession jingleSession) {
+	    System.out.println("Session " + jingleSession.getResponder() + "closedd because " + reason);
 
-		/**
-		 * constructor.
-		 */
-		public BeemJingleReceiverSessionListener() {
-			super();
-			// TODO Auto-generated constructor stub
+	    final int n = mRemoteJingleListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionClosed(reason);
+		} catch (RemoteException e) {
+		    e.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
+	}
 
-		@Override
-		public void sessionClosed(String reason, JingleSession jingleSession) {
-			System.out.println("Session " + jingleSession.getResponder() + "closedd because " + reason);
-			//audio.stopMedia();
+	@Override
+	public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
+	    System.out.println("Session " + jingleSession.getResponder() + " closed");
 
+	    final int n = mRemoteJingleListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionClosedOnError(e.getMessage());
+		} catch (RemoteException err) {
+		    err.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
+	}
+
+	@Override
+	public void sessionDeclined(String reason, JingleSession jingleSession) {
+	    Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
 
-		@Override
-		public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
-			// TODO Auto-generated method stub
-			System.out.println("Session " + jingleSession.getResponder() + " closed");
-			//audio.stopMedia();
+	    final int n = mRemoteJingleListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionDeclined(reason);
+		} catch (RemoteException e) {
+		    e.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
 
-		@Override
-		public void sessionDeclined(String reason, JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
-		}
+	}
+
+	@Override
+	public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
+	    TransportCandidate localCandidate, JingleSession jingleSession) {
+	    Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
+
+	    jingleSession.getSession().getMediaSession(pt.getName());
+	    final int n = mRemoteJingleListeners.beginBroadcast();
 
-		@Override
-		public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
-				TransportCandidate localCandidate, JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
-			jingleSession.getSession().getMediaSession(pt.getName());
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionEstablished();
+		} catch (RemoteException e) {
+		    e.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
+	}
 
-		@Override
-		public void sessionMediaReceived(JingleSession jingleSession, String participant) {
-			Log.d(TAG, "Session Media received from " + participant);
-		}
+	@Override
+	public void sessionMediaReceived(JingleSession jingleSession, String participant) {
+	    Log.d(TAG, "Session Media received from " + participant);
+	}
 
-		@Override
-		public void sessionRedirected(String redirection, JingleSession jingleSession) {
-		}
+	@Override
+	public void sessionRedirected(String redirection, JingleSession jingleSession) {
 	}
+    }
+
+
+    /**
+     * Listen for a Jingle session request.
+     * @author nikita
+     */
+    private class BeemJingleSessionRequestListener implements JingleSessionRequestListener {
 
 	/**
-	 * Listen on caller session events.
-	 * @author nikita
+	 * Constructor.
 	 */
-	private class BeemJingleCallerSessionListener implements JingleSessionListener {
-
-		private static final int SLP_DURATION = 20000;
-
-		/**
-		 * constructor.
-		 */
-		public BeemJingleCallerSessionListener() {
-			super();
-			// TODO Auto-generated constructor stub
-		}
-
-		@Override
-		public void sessionClosed(final String reason, final JingleSession jingleSession) {
-			System.out.println("Session " + jingleSession.getResponder() + "closed because " + reason);
-		}
-
-		@Override
-		public void sessionClosedOnError(final XMPPException e, final JingleSession jingleSession) {
-			System.out.println("Session " + jingleSession.getResponder() + " closed on error");
-		}
-
-		@Override
-		public void sessionDeclined(final String reason, final JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
-		}
-
-		@Override
-		public void sessionEstablished(final PayloadType pt, final TransportCandidate remoteCandidate,
-				final TransportCandidate localCandidate, final JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
-			Intent callIntent = new Intent(mContext, CallScreen.class);
-			callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-			mContext.startActivity(callIntent);
-			//call(pt, remoteCandidate, localCandidate, jingleSession);
-		}
-
-		@Override
-		public void sessionMediaReceived(final JingleSession jingleSession, final String participant) {
-			// TODO Auto-generated method stub
-			System.out.println("Session Media received from " + participant);
-		}
-
-		@Override
-		public void sessionRedirected(final String redirection, final JingleSession jingleSession) {
-			// TODO Auto-generated method stub
-		}
+	public BeemJingleSessionRequestListener() {
+	    super();
 	}
 
-	/**
-	 * Listen for a Jingle session request.
-	 * @author nikita
-	 */
-	private class BeemJingleSessionRequestListener implements JingleSessionRequestListener {
-
-		/**
-		 * Constructor.
-		 */
-		public BeemJingleSessionRequestListener() {
-			super();
-		}
-
-		@Override
-		public void sessionRequested(JingleSessionRequest request) {
-			System.out.println("Jingle Session request from " + request.getFrom());
-			try {
-				mIn = request.accept();
-				mIn.addListener(new BeemJingleReceiverSessionListener());
-				mIn.startIncoming();
-			} catch (XMPPException e) {
-				e.printStackTrace();
-			}
-		}
+	@Override
+	public void sessionRequested(JingleSessionRequest request) {
+	    mRequest = request;
+	    try {
+		mIn = mJingleManager.createIncomingJingleSession(mRequest);
+		mIn.addListener(new BeemJingleSessionListener());
+		mIn.startIncoming();
+	    } catch (XMPPException e) {
+		e.printStackTrace();
+	    }
+	    System.out.println("Jingle Session request from " + request.getFrom());
+	    isCaller = false;
+	    Intent intent = new Intent(mContext, Call.class);
+	    intent.setData(Uri.parse("jingle:"+request.getFrom()));
+	    intent.putExtra("isCaller", false);
+	    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+	    mContext.startActivity(intent);
 	}
+    }
 
 }
--- a/src/com/beem/project/beem/service/Contact.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/service/Contact.java	Sat Jan 23 13:42:20 2010 +0100
@@ -194,7 +194,6 @@
      */
     @Override
     public int describeContents() {
-	// TODO Auto-generated method stub
 	return 0;
     }
 
--- a/src/com/beem/project/beem/service/LoginAsyncTask.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/service/LoginAsyncTask.java	Sat Jan 23 13:42:20 2010 +0100
@@ -59,19 +59,19 @@
     /**
      * State of a running connection.
      */
-    public static final int STATE_CONNECTION_RUNNING = 1;
+    public static final int STATE_CONNECTION_RUNNING = 0;
     /**
      * State of an already connected connection but authentication is running.
      */
-    public static final int STATE_LOGIN_RUNNING = 2;
+    public static final int STATE_LOGIN_RUNNING = 1;
     /**
      * State of a connected and authenticated succesfully.
      */
-    public static final int STATE_LOGIN_SUCCESS = 3;
+    public static final int STATE_LOGIN_SUCCESS = 2;
     /**
      * State of a connected but failed authentication.
      */
-    public static final int STATE_LOGIN_FAILED = 4;
+    public static final int STATE_LOGIN_FAILED = 3;
 
     private static final String TAG = "BeemLoginTask";
 
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Sat Jan 23 13:42:20 2010 +0100
@@ -64,6 +64,7 @@
 import com.beem.project.beem.R;
 import com.beem.project.beem.service.aidl.IBeemRosterListener;
 import com.beem.project.beem.utils.Status;
+import com.beem.project.beem.service.aidl.IRoster;
 
 /**
  * This class implement a Roster adapter for BEEM.
@@ -371,8 +372,6 @@
 	 */
 	@Override
 	public void presenceChanged(Presence presence) {
-	    // Log.i(TAG, "presence Changed");
-	    /* redispatch vers les IBeemRosterListener */
 	    final int n = mRemoteRosListeners.beginBroadcast();
 
 	    for (int i = 0; i < n; i++) {
@@ -385,8 +384,6 @@
 		    }
 		    listener.onPresenceChanged(new PresenceAdapter(presence));
 		} catch (RemoteException e) {
-		    // The RemoteCallbackList will take care of removing the
-		    // dead listeners.
 		    Log.w(TAG, "Error while updating roster presence entries", e);
 		}
 	    }
--- a/src/com/beem/project/beem/service/XmppFacade.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/service/XmppFacade.java	Sat Jan 23 13:42:20 2010 +0100
@@ -55,6 +55,7 @@
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppConnection;
 import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.aidl.IJingle;
 import com.beem.project.beem.utils.PresenceType;
 
 /**
@@ -123,6 +124,14 @@
     public IChatManager getChatManager() throws RemoteException {
 	return mConnexion.getChatManager();
     }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IJingle getJingleService() throws RemoteException {
+	return mJingle;
+    }
 
     /**
      * {@inheritDoc}
@@ -148,14 +157,6 @@
     }
 
     /* (non-Javadoc)
-     * @see com.beem.project.beem.service.aidl.IXmppFacade#call(java.lang.String)
-     */
-    @Override
-    public void call(String jid) throws RemoteException {
-	mJingle.call(jid);
-    }
-
-    /* (non-Javadoc)
      * @see com.beem.project.beem.service.aidl.IXmppFacade#getVcardAvatar(java.lang.String)
      */
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IBeemJingleListener.aidl	Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,77 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM 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 3 of the License, or
+    (at your option) any later version.
+
+    BEEM 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 BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+/**
+ * Interface to listen for jingle sessions events
+ * @author Nikita Kozlov <nikita@beem-project.com>
+ */
+interface IBeemJingleListener {
+
+    /**
+     *  Callback to call when the session is closed
+     */
+    void sessionClosed(in String reason);
+
+    /**
+     *  Callback to call when the session is declined
+     */
+    void sessionDeclined(in String reason);
+
+    
+    /**
+     *  Callback to call when the session is closed on error
+     */
+    void sessionClosedOnError(in String error);
+
+    /**
+     * Callback to call when session is established
+     */
+    void sessionEstablished();
+    
+    /**
+     * Callback to call when session is requested
+     */
+    void sessionRequested(in String fromJID);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IJingle.aidl	Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,70 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM 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 3 of the License, or
+    (at your option) any later version.
+
+    BEEM 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 BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IBeemJingleListener;
+
+
+interface IJingle {
+
+    void addJingleListener(in IBeemJingleListener listen);
+    void removeJingleListener(in IBeemJingleListener listen);
+    
+        /**
+     * make a jingle audio call
+     * @param jid the receiver id
+     */
+     void call(in String jid);
+     
+     /**
+     * Accept call a jingle audio call
+     */
+     void acceptCall();
+     
+     /**
+     * close a jingle audio call
+     */
+     void closeCall();
+
+}
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Sat Jan 23 13:42:20 2010 +0100
@@ -45,9 +45,10 @@
 
 import  com.beem.project.beem.service.aidl.IXmppConnection;
 import  com.beem.project.beem.service.aidl.IRoster;
+import  com.beem.project.beem.service.aidl.IJingle;
 import  com.beem.project.beem.service.aidl.IChatManager;
 import  com.beem.project.beem.service.aidl.IPrivacyListManager;
-import com.beem.project.beem.service.PresenceAdapter;
+import  com.beem.project.beem.service.PresenceAdapter;
 
 interface IXmppFacade {
 
@@ -80,6 +81,11 @@
      * Get the chat manager.
      */
     IChatManager getChatManager();
+    
+    /**
+     * Get the Jingle service.
+     */
+    IJingle getJingleService();
 
     /**
      * Change the status of the user.
@@ -90,12 +96,6 @@
 
     void sendPresencePacket(in PresenceAdapter presence);
 
-    /**
-     * make a jingle audio call
-     * @param jid the receiver id
-     */
-     void call(in String jid);
-
      /**
       * get the user vcard avatar
       * @param jid the user jid
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Call.java	Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,265 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM 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 3 of the License, or
+    (at your option) any later version.
+
+    BEEM 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 BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+ */
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.aidl.IJingle;
+import com.beem.project.beem.service.aidl.IBeemJingleListener;
+
+/**
+ * This class is an activity which display an animation during the connection with the server.
+ * @author Da Risk <darisk972@gmail.com>
+ */
+public class Call extends Activity {
+
+    private static final Intent SERVICE_INTENT = new Intent();
+    static {
+	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+    }
+    private ImageView mLogo;
+    private TextView mCallInfo;
+    private Animation mRotateAnim;
+    private final ServiceConnection mServConn = new BeemServiceConnection();
+    private BeemJingleSessionListener mJingleListener = new BeemJingleSessionListener();
+    private IXmppFacade mXmppFacade;
+    private final Handler mHandler = new Handler();
+    private Button mCloseCall;
+    private Button mAcceptCall;
+    private IJingle mJingle;
+
+    /**
+     * Constructor.
+     */
+    public Call() {
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+	super.onCreate(savedInstanceState);
+	setContentView(R.layout.call);
+	Intent callingIntent = this.getIntent();
+
+	mLogo = (ImageView) findViewById(R.id.call_logo_anim);
+	mRotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotate_and_scale);
+	mCloseCall = (Button) findViewById(R.id.call_cancel_button);
+	mCloseCall.setOnClickListener(new ClickListener());
+	if (callingIntent.getBooleanExtra("isCaller", false)) {
+	    mAcceptCall = (Button) findViewById(R.id.call_accept_button);
+	    mAcceptCall.setVisibility(View.GONE);
+	} else {
+	    mAcceptCall = (Button) findViewById(R.id.call_accept_button);
+	    mAcceptCall.setOnClickListener(new ClickListener());
+	}
+	mCallInfo = (TextView) findViewById(R.id.call_info);
+    }
+
+    @Override
+    protected void onStart() {
+	super.onStart();
+	mLogo.startAnimation(mRotateAnim);
+    }
+
+    @Override
+    protected void onResume() {
+	super.onResume();
+	if (mXmppFacade == null)
+	    bindService(Call.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+    }
+
+    @Override
+    protected void onPause() {
+	super.onPause();
+	if (mXmppFacade != null) {
+	    try {
+		mJingle.removeJingleListener(mJingleListener);
+	    } catch (RemoteException e) {
+		e.printStackTrace();
+	    }
+	    unbindService(mServConn);
+	    mXmppFacade = null;
+	}
+    }
+
+    @Override
+    public final boolean onCreateOptionsMenu(Menu menu) {
+	super.onCreateOptionsMenu(menu);
+	MenuInflater inflater = getMenuInflater();
+	inflater.inflate(R.menu.call, menu);
+	return true;
+    }
+
+    /**
+     * Click event listener on cancel button.
+     */
+    private class ClickListener implements OnClickListener {
+
+	/**
+	 * Constructor.
+	 */
+	ClickListener() {
+	}
+
+	@Override
+	public void onClick(View v) {
+	    try {
+		if (v == mCloseCall)
+		    mJingle.closeCall();
+		else if (v == mAcceptCall)
+		    mJingle.acceptCall();
+	    } catch (RemoteException e) {
+		e.printStackTrace();
+	    }
+	    //finish();
+	}
+    }
+
+    private class BeemJingleSessionListener extends IBeemJingleListener.Stub {
+	
+	/**
+	 * Refresh the call activity.
+	 */
+	private class RunnableChange implements Runnable {
+	    
+	    private String mStr;
+	    /**
+	     * Constructor.
+	     */
+	    public RunnableChange(String str) {
+		mStr = str;
+	    }
+
+	    /**
+	     * {@inheritDoc}
+	     */
+	    @Override
+	    public void run() {
+		mCallInfo.setText(mStr);
+		
+	    }
+	}
+
+	public BeemJingleSessionListener() {
+	}
+
+	@Override
+	public void sessionClosed(final String reason) {
+	    android.util.Log.d("TEST", "TEST " + reason);
+	    mHandler.post(new RunnableChange(reason));
+	    Call.this.runOnUiThread(new RunnableChange(reason));
+	}
+
+	@Override
+	public void sessionDeclined(final String reason)  {
+	    android.util.Log.d("TEST", "TEST4 " + reason);
+	    mHandler.post(new RunnableChange(reason));
+	}
+
+	@Override
+	public void sessionClosedOnError(final String error) {
+	    android.util.Log.d("TEST", "TEST5 " + error);
+	    mHandler.post(new RunnableChange(error));
+	}
+
+	@Override
+	public void sessionEstablished() {
+	    android.util.Log.d("TEST", "TEST2 ");
+	    mCallInfo.setText("established");
+	    mHandler.post(new RunnableChange("ok"));
+	}
+
+	@Override
+	public void sessionRequested(final String fromJID) {
+	    android.util.Log.d("TEST", "TEST3 " + fromJID);
+	    mHandler.post(new RunnableChange(fromJID));
+	}
+    }
+
+    /**
+     * The service connection used to connect to the Beem service.
+     */
+    private class BeemServiceConnection implements ServiceConnection {
+
+	/**
+	 * Constructor.
+	 */
+	public BeemServiceConnection() {
+	}
+
+	@Override
+	public void onServiceConnected(ComponentName name, IBinder service) {
+	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
+	    try {
+		mJingle = mXmppFacade.getJingleService();
+		mJingle.addJingleListener(mJingleListener);
+	    } catch (RemoteException e) {
+		e.printStackTrace();
+	    }
+	}
+
+	@Override
+	public void onServiceDisconnected(ComponentName name) {
+	    mXmppFacade = null;
+	}
+    }
+}
--- a/src/com/beem/project/beem/ui/Chat.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/ui/Chat.java	Sat Jan 23 13:42:20 2010 +0100
@@ -299,7 +299,7 @@
 	    public void onClick(DialogInterface dialog, int item) {
 		Intent chatIntent = new Intent(getApplicationContext(), com.beem.project.beem.ui.Chat.class);
 		chatIntent.setData((openedChats.get(item)).toUri());
-		Chat.this.onNewIntent(chatIntent);
+		startActivity(chatIntent);
 	    }
 	});
 	AlertDialog chatSwitcherDialog = builder.create();
@@ -330,9 +330,9 @@
 	mChat.setOpen(true);
 	mChatManager.deleteChatNotification(mChat);
 
-	// TODO thecontact isnotnecesarrely ubn the roseter.
-	// this can leadtoa null exception
 	mContact = mRoster.getContact(contact.getJID());
+	if (mContact == null)
+	    mContact = contact;
 	updateContactInformations();
 	updateContactStatusIcon();
 
--- a/src/com/beem/project/beem/ui/ContactList.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Jan 23 13:42:20 2010 +0100
@@ -39,7 +39,7 @@
 
     Flavien Astraud, November 26, 2009
 
-*/
+ */
 package com.beem.project.beem.ui;
 
 import java.util.ArrayList;
@@ -85,6 +85,7 @@
 import com.beem.project.beem.service.Contact;
 import com.beem.project.beem.service.PresenceAdapter;
 import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.service.aidl.IJingle;
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppFacade;
 import com.beem.project.beem.ui.dialogs.builders.Alias;
@@ -123,6 +124,7 @@
     private String mCurGroup;
     private Contact mContact;
     private IXmppFacade mXmppFacade;
+    private IJingle mJingle;
     private SharedPreferences mSettings;
     private LayoutInflater mInflater;
 
@@ -200,7 +202,11 @@
 		    break;
 		case R.id.contact_list_context_menu_call_item:
 		    try {
-			mXmppFacade.call(mContact.getJID() + "/Beem");
+			mJingle.call(mContact.getJID() + "/Beem");
+			in = new Intent(this, Call.class);
+			in.setData(mContact.toUri());
+			in.putExtra("isCaller", true);
+			startActivity(in);
 			result = true;
 		    } catch (RemoteException e) {
 			e.printStackTrace();
@@ -432,11 +438,11 @@
 	mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
 	    android.R.drawable.presence_online)));
 	mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT,
-		new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online)));
+	    new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online)));
 	mIconsMap.put(Status.CONTACT_STATUS_AWAY,
-		new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away)));
+	    new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away)));
 	mIconsMap.put(Status.CONTACT_STATUS_BUSY,
-		new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy)));
+	    new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy)));
 	mIconsMap.put(Status.CONTACT_STATUS_DISCONNECT, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
 	    android.R.drawable.presence_offline)));
 	mIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
@@ -757,6 +763,7 @@
 	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
 	    try {
 		mRoster = mXmppFacade.getRoster();
+		mJingle = mXmppFacade.getJingleService();
 		if (mRoster != null) {
 		    mRoster.addRosterListener(mBeemRosterListener);
 		    List<Contact> tmpContactList = mRoster.getContactList();
@@ -803,6 +810,7 @@
 	    }
 	    mXmppFacade = null;
 	    mRoster = null;
+	    mJingle = null;
 	    mListContact.clear();
 	    mListGroup.clear();
 	    mContactOnGroup.clear();
--- a/src/com/beem/project/beem/ui/LoginAnim.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/com/beem/project/beem/ui/LoginAnim.java	Sat Jan 23 13:42:20 2010 +0100
@@ -58,10 +58,11 @@
 import android.view.animation.AnimationUtils;
 import android.widget.Button;
 import android.widget.ImageView;
+import android.widget.TextView;
 
 import com.beem.project.beem.R;
+import com.beem.project.beem.service.LoginAsyncTask;
 import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.service.LoginAsyncTask;
 
 /**
  * This class is an activity which display an animation during the connection with the server.
@@ -80,6 +81,7 @@
     private IXmppFacade mXmppFacade;
     private AsyncTask<IXmppFacade, Integer, Boolean> mTask;
     private Button mCancelBt;
+    private TextView mLoginState;
 
     /**
      * Constructor.
@@ -94,6 +96,7 @@
     protected void onCreate(Bundle savedInstanceState) {
 	super.onCreate(savedInstanceState);
 	setContentView(R.layout.login_anim);
+	mLoginState = (TextView) findViewById(R.id.loginanim_status_text);
 	mLogo = (ImageView) findViewById(R.id.loginanim_logo_anim);
 	mRotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotate_and_scale);
 	mCancelBt = (Button) findViewById(R.id.loginanim_cancel_button);
@@ -174,7 +177,7 @@
     /**
      * Asynchronous class for connection.
      */
-    private class LoginTask extends LoginAsyncTask{
+    private class LoginTask extends LoginAsyncTask {
 
 	/**
 	 * Constructor.
@@ -207,6 +210,7 @@
 	@Override
 	protected void onProgressUpdate(Integer ... values) {
 	    Log.d(TAG, "onProgress " + values[0]);
+	    mLoginState.setText(getResources().getStringArray(R.array.loganim_state)[values[0]]);
 	}
 
 	/* (non-Javadoc)
--- a/src/org/sipdroid/media/RtpStreamReceiver.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/org/sipdroid/media/RtpStreamReceiver.java	Sat Jan 23 13:42:20 2010 +0100
@@ -58,7 +58,6 @@
 	public static final int SO_TIMEOUT = 200;
 
 	/** The RtpSocket */
-	//RtpSocket rtp_socket = null;
 	RTPSession rtpSession = null;
 	byte[] buffer;
 
@@ -334,13 +333,7 @@
 				System.arraycopy(lin, 0, lin2, 0, REAL_BUFFER_SIZE);
 			}
 		}
-		println("POOL SIZE " + DatagramPool.getInstance().getPoolSize());
 		track.stop();
-		//if (Receiver.pstn_state == null || Receiver.pstn_state.equals("IDLE"))
-		//	am.setMode(AudioManager.MODE_NORMAL);
-		//saveVolume();
-		//am.setStreamVolume(AudioManager.STREAM_MUSIC,oldvol,0);
-		//restoreSettings();
 		ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_RING,ToneGenerator.MAX_VOLUME/4*3);
 		tg.startTone(ToneGenerator.TONE_PROP_PROMPT);
 		try {
--- a/src/org/sipdroid/media/RtpStreamSender.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/org/sipdroid/media/RtpStreamSender.java	Sat Jan 23 13:42:20 2010 +0100
@@ -44,7 +44,6 @@
 	private static final boolean DEBUG = true;
 
 	/** The RtpSocket */
-	//private RtpSocket rtp_socket = null;
 	private RTPSession rtpSession = null;
 
 	/** Codec */
--- a/src/org/sipdroid/net/SipdroidSocket.java	Thu Jan 21 01:35:17 2010 +0100
+++ b/src/org/sipdroid/net/SipdroidSocket.java	Sat Jan 23 13:42:20 2010 +0100
@@ -42,7 +42,6 @@
 			impl = new PlainDatagramSocketImpl();
 			impl.create();
 			impl.bind(port,InetAddress.getByName("0"));
-			android.util.Log.d("TEST","name : " + InetAddress.getByName("0"));
 		}
 	}
 	
@@ -83,7 +82,5 @@
 		        System.loadLibrary("OSNetworkSystem");
 		        OSNetworkSystem.getOSNetworkSystem().oneTimeInitialization(true);
 		        SipdroidSocket.loaded = true;
-		        android.util.Log.d("OSNetworkSystem", "LOADED");
-			
 	}
 }
--- a/tools/eclipse_formatter.xml	Thu Jan 21 01:35:17 2010 +0100
+++ b/tools/eclipse_formatter.xml	Sat Jan 23 13:42:20 2010 +0100
@@ -49,7 +49,7 @@
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
@@ -232,7 +232,7 @@
 <setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
 <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
 <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
 <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>