merge
authordarisk@kaaliyah
Sun, 09 Aug 2009 23:42:22 +0200
changeset 338 ab6210103750
parent 336 4dbd2caf2a6e (diff)
parent 337 9ff7cb885f94 (current diff)
child 339 c57c94a97ff2
merge
--- a/.classpath	Sun Aug 09 23:23:28 2009 +0200
+++ b/.classpath	Sun Aug 09 23:42:22 2009 +0200
@@ -1,12 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-	<classpathentry kind="lib" path="libs/smack.jar" sourcepath="/home/nikita/devel/smack_src_3_1_0"/>
 	<classpathentry kind="lib" path="libs/smackx-debug.jar"/>
 	<classpathentry kind="lib" path="libs/smackx-jingle.jar"/>
-	<classpathentry kind="lib" path="libs/smackx.jar" sourcepath="/home/nikita/devel/smack_src_3_1_0"/>
 	<classpathentry kind="lib" path="libs/jlibrtp-0.2.2.jar"/>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="src" path=".apt_generated">
+		<attributes>
+			<attribute name="optional" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="libs/security.jar"/>
+	<classpathentry kind="lib" path="libs/smack.jar"/>
+	<classpathentry kind="lib" path="libs/smackx.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
--- a/AndroidManifest.xml	Sun Aug 09 23:23:28 2009 +0200
+++ b/AndroidManifest.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 	package="com.beem.project.beem" android:versionCode="1"
 	android:versionName="1.0">
@@ -10,8 +10,6 @@
 				<category android:name="android.intent.category.LAUNCHER" />
 			</intent-filter>
 		</activity>
-		<activity android:name=".ui.ContactListSettings"
-			android:label="@string/app_name" />
 		<activity android:name=".ui.SendIM" android:label="@string/SendIMActTitle"
 			android:launchMode="singleTop" />
 		<activity android:name=".ui.ChangeStatus" android:label="@string/ChangeStatusActTitle" />
@@ -35,6 +33,6 @@
 	<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
 	<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
 	<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"></uses-permission>
-	<uses-sdk android:minSdkVersion="2"></uses-sdk>
+	<uses-sdk android:minSdkVersion="3"></uses-sdk>
 
 </manifest> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/patch-smack-android-sasl.diff	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,2074 @@
+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
Binary file libs/security.jar has changed
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
--- a/res/layout/addcontact.xml	Sun Aug 09 23:23:28 2009 +0200
+++ b/res/layout/addcontact.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -1,45 +1,38 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:orientation="vertical" android:layout_width="fill_parent"
+<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="fill_parent"
 	android:layout_height="fill_parent">
-	<LinearLayout
-		android:orientation="horizontal" android:layout_width="fill_parent"
-		android:layout_height="wrap_content">
-		<TextView android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:text="@string/AddCLogin"
-			android:minWidth="70dp" />
-
-		<EditText android:id="@+id/addc_login" android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:singleLine="true"
-			android:textSize="16sp" android:autoText="false" android:capitalize="none"
-			android:minWidth="250dp" android:scrollHorizontally="true" />
-	</LinearLayout>
-
-	<LinearLayout
-		android:orientation="horizontal" android:layout_width="fill_parent"
-		android:layout_height="wrap_content">
-		<TextView android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:text="@string/AddCAlias"
-			android:minWidth="70dp" />
-		<EditText android:id="@+id/addc_alias" android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:singleLine="true"
-			android:textSize="16sp" android:autoText="false" android:minWidth="250dp"
-			android:capitalize="none" android:scrollHorizontally="true" />
-	</LinearLayout>
-	<LinearLayout
-		android:orientation="horizontal" android:layout_width="fill_parent"
-		android:layout_height="wrap_content">
-		<TextView android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:text="@string/AddCGroup"
-			android:minWidth="70dp" />
-		<EditText android:id="@+id/addc_group" android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:singleLine="true"
-			android:textSize="16sp" android:autoText="false" android:minWidth="250dp"
-			android:capitalize="none" android:scrollHorizontally="true" />
-	</LinearLayout>
+	<TableRow>
+		<TextView android:text="@string/AddCLogin"
+			android:gravity="left" android:padding="3dip" 
+			/>
+		<EditText android:id="@+id/addc_login" android:inputType="textEmailAddress"
+			android:scrollHorizontally="true" android:layout_width="fill_parent"
+			android:layout_weight="1" android:layout_margin="3dip"
+			 />
+	</TableRow>
+	<TableRow>
+		<TextView android:text="@string/AddCAlias"
+			android:gravity="left" android:padding="3dip" />
+		<EditText android:id="@+id/addc_alias" android:inputType="text"
+			android:textSize="16sp" android:layout_width="fill_parent"
+			android:scrollHorizontally="true"
+			android:layout_weight="1" android:layout_margin="3dip"
+			/>
+	</TableRow>
+	<TableRow>
+		<TextView android:text="@string/AddCGroup"
+			android:minWidth="70dp" android:gravity="left" android:padding="3dip"
+			/>
+		<EditText android:id="@+id/addc_group"  android:inputType="text"
+			android:textSize="16sp" android:layout_width="fill_parent"
+			android:scrollHorizontally="true" 
+			android:layout_weight="1" android:layout_margin="3dip"
+			/>
+	</TableRow>
 	<Button android:id="@+id/addc_ok" android:layout_width="fill_parent"
 		android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
 		android:text="@string/AddCOkButton">
 		<requestFocus />
 	</Button>
-</LinearLayout>
\ No newline at end of file
+</TableLayout>
\ No newline at end of file
--- a/res/layout/contactlist.xml	Sun Aug 09 23:23:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-
-        <ExpandableListView android:id="@+id/android:list"
-			android:layout_width="fill_parent"
-			android:layout_height="fill_parent"
-            android:layout_weight="1" />
-
-        <TextView android:id="@+id/android:empty"
-			android:layout_width="fill_parent"
-            android:layout_height="fill_parent" android:text="@string/ConListNotConnected" />
-
-</LinearLayout>
--- a/res/layout/edit_settings.xml	Sun Aug 09 23:23:28 2009 +0200
+++ b/res/layout/edit_settings.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -108,6 +108,7 @@
     				android:layout_height="wrap_content"
     				android:text="@string/settings_xmpp_use_tls"
     				android:layout_below="@id/settings_xmpp_table_sp"
+    				android:focusable="true"
     				style="@style/CheckBoxLabel" />
 				<Button android:id="@+id/settings_xmpp_button_save"
 					android:layout_width="wrap_content"
@@ -134,6 +135,7 @@
     				android:layout_width="wrap_content"
     				android:layout_height="wrap_content"
     				android:text="@string/settings_proxy_use"
+    				android:focusable="true"
     				style="@style/CheckBoxLabel" />
     			<LinearLayout android:id="@+id/settings_proxy_parameters"
     				android:layout_width="fill_parent"
--- a/res/layout/login.xml	Sun Aug 09 23:23:28 2009 +0200
+++ b/res/layout/login.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -6,14 +6,15 @@
 		android:layout_width="fill_parent" android:layout_height="wrap_content"
 		android:layout_marginBottom="25px" android:layout_marginTop="15px" />
 	<TextView android:id="@+id/log_as_msg" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:gravity="center" />
+		android:layout_height="wrap_content" android:gravity="center"
+		android:textColor="#FF0000" />
 	<LinearLayout android:orientation="vertical"
 		android:layout_width="fill_parent" android:layout_height="fill_parent"
 		android:gravity="bottom">
 		<Button android:id="@+id/log_as_settings" android:layout_width="fill_parent"
-			android:layout_height="wrap_content" android:text="Settings" />
+			android:layout_height="wrap_content" android:text="@string/login_settings_button" />
 		<Button android:id="@+id/log_as_login" android:layout_width="fill_parent"
-			android:layout_height="wrap_content" android:text="Login" />
+			android:layout_height="wrap_content" android:text="@string/login_login_button" />
 	</LinearLayout>
 
 </LinearLayout>
\ No newline at end of file
--- a/res/layout/sendim.xml	Sun Aug 09 23:23:28 2009 +0200
+++ b/res/layout/sendim.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -15,8 +15,7 @@
 			android:layout_width="fill_parent" android:layout_height="wrap_content">
 			<TextView android:id="@+id/sendimlogin"
 				android:layout_width="fill_parent" android:layout_height="wrap_content"
-				android:lines="1"
-				android:paddingLeft="10sp" />
+				android:lines="1" android:paddingLeft="10sp" />
 			<TextView android:id="@+id/sendimchatstate"
 				android:layout_width="fill_parent" android:layout_height="wrap_content"
 				android:lines="1" android:scrollHorizontally="true"
@@ -24,35 +23,11 @@
 			<TextView android:id="@+id/sendimstatus"
 				android:layout_width="fill_parent" android:layout_height="wrap_content"
 				android:lines="1" android:scrollHorizontally="true"
-				android:hint="@string/SendIMNoStatusSet" android:paddingLeft="15sp" />
+				android:hint="@string/SendIMNoStatusSet" android:paddingLeft="15sp"
+				android:autoLink="all" />
 		</LinearLayout>
 	</LinearLayout>
 
-	<!--
-		<LinearLayout android:paddingLeft="5px" android:paddingTop="5px"
-		android:background="@drawable/beem_sendim_header_1"
-		android:orientation="horizontal" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:layout_weight="4">
-
-		<ImageView android:id="@+id/sendimavatar"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content" android:maxHeight="80px"
-		android:layout_weight="5" android:src="@drawable/background"/>
-
-		<LinearLayout android:layout_width="fill_parent"
-		android:layout_height="fill_parent" android:layout_weight="1"
-		android:orientation="vertical"> <TextView
-		android:id="@+id/sendimlogin" android:paddingLeft="15px"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"
-		android:hint="@string/SendIMLoginHint"/> <TextView
-		android:id="@+id/sendimstatus" android:paddingLeft="20px"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"
-		android:hint="@string/SendIMNoStatusSet"/> </LinearLayout>
-		</LinearLayout>
-	-->
-
 	<ScrollView android:id="@+id/sendimscroll"
 		android:layout_width="fill_parent" android:layout_height="fill_parent"
 		android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
@@ -62,7 +37,9 @@
 		<TextView android:id="@+id/sendimlist" android:paddingLeft="10px"
 			android:paddingRight="10px" android:paddingTop="10px"
 			android:layout_width="fill_parent" android:layout_height="fill_parent"
-			android:singleLine="false"/>
+			android:textColor="@color/white"
+			android:background="@color/black"
+			android:singleLine="false" />
 
 	</ScrollView>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,1 @@
+values-en
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-en/arrays.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<string-array name="proxy_types">
+		<item>HTTP</item>
+		<item>SOCKS4</item>
+		<item>SOCKS5</item>
+	</string-array>
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-en/colors.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<color name="blue_sky">#A0C8FF</color>
+	<color name="black">#000000</color>
+	<color name="white">#FFFFFF</color>
+</resources>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-en/strings.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<string name="app_name">Beem</string>
+	<string name="OkButton">Ok</string>
+	<string name="ClearButton">Clear</string>
+	<string name="AcceptButton">Accept</string>
+	<string name="RefuseButton">Refuse</string>
+
+	<!--  Beem class -->
+	<string name="BeemJabberID">Jabber ID</string>
+
+	<!--  BeemApplication class -->
+	<string name="BeemApplicationConnect">Connecting...</string>
+
+	<!--  BeemService class -->
+	<string name="BeemServiceDescription">Use the Beem Service</string>
+	<string name="BeemServiceCreated">BeemService Created</string>
+	<string name="BeemServiceDestroyed">BeemService destroyed</string>
+
+	<!--  Preferences informations -->
+	<string name="PreferenceStatus">status</string>
+	<string name="PreferenceStatusText">status_text</string>
+	<string name="PreferenceIsConfigured">preference_is_configured</string>
+
+	<!-- ContactListSettings class -->
+	<string name="CLSServerConnection">Server connection</string>
+	<string name="CLSUserid">Userid:</string>
+	<string name="CLSPassword">Password:</string>
+	<string name="CLSService">Service:</string>
+	<string name="CLSHostPort">Host/Port:</string>
+	<string name="CLSProxyInfo">Proxy informations</string>
+	<string name="CLSLogin">Login:</string>
+	<string name="CLSOkButton">Ok</string>
+
+	<!--  ContactDialog class -->
+	<string name="CDChat">Chat</string>
+	<string name="CDAlias">Alias</string>
+	<string name="CDResend">Resend suscription</string>
+	<string name="CDInfos">User infos</string>
+	<string name="CDBlock">Block user</string>
+	<string name="CDDelete">Delete user</string>
+	<string name="CDSure2Delete">Are you sure you want to delete this contact?
+	</string>
+	<string name="CDSure2DeleteYes">Yes</string>
+	<string name="CDSure2DeleteNo">No</string>
+	
+
+	<!-- AddContact class -->
+	<string name="AddCActTitle">Beem - Add contact</string>
+	<string name="AddCLogin">Login :</string>
+	<string name="AddCAlias">Alias :</string>
+	<string name="AddCGroup">Group :</string>
+	<string name="AddCOkButton">Ok</string>
+	<string name="AddCContactAdded">Contact added</string>
+	<string name="AddCContactAddedError">Error Contact not added</string>
+	<string name="AddCContactAddedLoginError">Error Login</string>
+	<string name="AddCBadForm">Bad form</string>
+
+	<!--  SendIM class -->
+	<string name="SendIMActTitle">Beem - Chat</string>
+	<string name="SendIMSays"> %s says :\n%s\n</string>
+	<string name="SendIMYouSay">You say :\n%s\n</string>
+	<string name="SendIMSameSpeaker">%s\n</string>
+	<string name="SendIMToSendHint">Tip text here</string>
+	<string name="SendIMState">Is : </string>
+	<string name="SendIMErrorMsg">Error : %s\n</string>
+	<string name="SendIMFrom">and is speaking from : </string>
+	<string name="SendIMSmiley">Insert a smiley</string>
+	<string name="SendIMLoginHint">login</string>
+	<string name="SendIMNoStatusSet">No status set</string>
+	
+	<!--  ChangeStatus class -->
+	<string name="ChangeStatusText">Type here your status message :</string>
+	<string name="ChangeStatusActTitle">Beem - Change status</string>
+	<string name="MenuAddContact">Add new contact</string>
+	<string name="MenuAccountAbout">Beem Project</string>
+	<string name="MenuAccountCreate">Create account</string>
+	<string name="MenuConnection">Edit account</string>
+	<string name="ChangeStatusOk">Updating status</string>
+	<string name="ChangeStatusNoChange">Nothing to change</string>
+	
+	<!-- Subscription class -->
+	<string name="SubscriptAccept">Subscription accepted</string>
+	<string name="SubscriptError">Subscription error</string>
+	<string name="SubscriptRefused">Subscription refused</string>
+	<string name="SubscriptText">You have received a request for add by %s. Do you want to accept it ?</string>
+	
+	<!-- ContactList class -->
+	<string name="ConListNotConnected">Not connected</string>
+
+	<!--  BeemChatManager -->
+	<string name="BeemChatManagerNewMessage">You have got a new message</string>
+	
+    <!--
+    	Services
+    -->
+    
+    <!--
+    	Activities
+    -->
+    <string name="login_tag">BEEM - Login Activity</string>
+    
+    <string name="edit_settings_name">BEEM - Settings</string>
+	<string name="edit_settings_tag">BEEM - EditSettings Activity</string>
+	
+    <string name="create_account_name">BEEM - Create an account</string>
+    <string name="create_account_tag">BEEM - CreateAccount Activity</string>
+    
+    <string name="contact_list_name">BEEM - Contacts</string>
+    <string name="contact_list_tag">BEEM - ContactList Activity</string>
+
+    
+    <!--
+    	Buttons
+    -->
+    <string name="button_reset">Reset</string>
+    <string name="button_login">Login</string>
+    <string name="button_save">Save</string>
+    <string name="button_create_account">Create this account</string>
+    <string name="button_create_login_account">Create and log</string>
+    
+    
+    <!--
+    	LogAs Activity
+    -->
+	<string name="login_username">Username</string>
+	<string name="login_password">Password</string>
+	<string name="login_error_dialog_title">Login - Error</string>
+	<string name="login_close_dialog_button">Close</string>
+	<string name="login_menu_create_account">Create an account</string>
+	<string name="login_menu_settings">Settings</string>
+	<string name="login_menu_about">About</string>
+	<string name="login_about_title">About</string>
+	<string name="login_about_msg">
+		BEEM is an EPITECH Innovative Project. Visit us at http://www.beem-project.com !
+	</string>
+	<string name="login_about_button">Close</string>
+	<string name="login_settings_button">Settings</string>
+	<string name="login_login_button">Log in</string>
+	<string name="login_login_progress">Connecting. Please wait...</string>
+	<string name="login_error_msg">Unfortunately, an error occured.\n\nError detail:\n%s</string>
+	
+	<!--
+		EditSettings Activity
+	-->
+	<string name="settings_menu_create_account">Create an account</string>
+	<string name="settings_menu_login">Login</string>
+	<string name="settings_saved_ok">The settings have been saved successfully.</string>
+	<string name="settings_filename">beem_settings</string>
+	<string name="settings_key_account_username">beem_account_username</string>
+	<string name="settings_key_account_password">beem_account_password</string>
+	<string name="settings_key_xmpp_server">beem_xmpp_server</string>
+	<string name="settings_key_xmpp_port">beem_xmpp_port</string>
+	<string name="settings_key_xmpp_tls_use">beem_xmpp_tls_use</string>
+	<string name="settings_key_proxy_use">beem_xmpp_proxy_use</string>
+	<string name="settings_key_proxy_server">beem_xmpp_proxy_server</string>
+	<string name="settings_key_proxy_port">beem_xmpp_proxy_port</string>
+	<string name="settings_key_proxy_username">beem_xmpp_proxy_username</string>
+	<string name="settings_key_proxy_password">beem_xmpp_proxy_password</string>
+	<string name="settings_key_proxy_type">beem_xmpp_proxy_type</string>
+	
+	<!-- EditSettings Activity tabs -->
+	<string name="settings_tab_tag_account">edit_settings_tab_account</string>
+	<string name="settings_tab_label_account">Account</string>
+	<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+	<string name="settings_tab_label_xmpp">XMPP</string>
+	<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+	<string name="settings_tab_label_proxy">Proxy</string>
+	
+	<!-- EditSettings Activity Account tab -->
+	<string name="settings_account_username">Username</string>
+	<string name="settings_account_password">Password</string>
+	<string name="settings_account_server">Server</string>
+	<string name="settings_account_port">Port</string>
+	
+	<!-- EditSettings Activity XMPP tab -->
+	<string name="settings_xmpp_server">Server</string>
+	<string name="settings_xmpp_port">Port</string>
+	<string name="settings_xmpp_use_tls">Require SSL/TLS</string>
+	
+	<!-- EditSettings Activity Proxy tab -->
+	<string name="settings_proxy_use">Connect using a proxy</string>
+	<string name="settings_proxy_type_prompt">Choose a type of proxy</string>
+	<string name="settings_proxy_server">Server</string>
+	<string name="settings_proxy_port">Port</string>
+	<string name="settings_proxy_username">Username</string>
+	<string name="settings_proxy_password">Password</string>
+	
+	<!--
+		Create an account Activity
+	-->
+	<string name="create_account_instr_dialog_title">Create an account - Instructions</string>
+	<string name="create_account_err_dialog_title">Create an account - Error</string>
+	<string name="create_account_err_dialog_settings_button">Change my settings</string>
+	<string name="create_account_close_dialog_button">Close</string>
+	<string name="create_account_successfull_after">has been created successfully</string>
+	<string name="create_account_err_username">Bad JabberID</string>
+	<string name="create_account_err_passwords">Passwords do not match.</string>
+	<string name="create_account_username">Username</string>
+	<string name="create_account_password">Password</string>
+	<string name="create_account_confirm_password">Confirm password</string>
+	
+	<!--
+		ContactList Activity 
+	 -->
+	 <string name="contact_list_menu_add_contact">Add a contact</string>
+	 <string name="contact_list_menu_settings">Settings</string>
+
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-en/styles.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<style name="Label">
+		<item name="android:textSize">16sp</item>
+		<item name="android:textStyle">bold</item>
+		<item name="android:typeface">sans</item>
+		<item name="android:capitalize">characters</item>
+		<item name="android:textColor">#FFFFFF</item>
+		<item name="android:focusable">false</item>
+	</style>
+	<style name="CheckBoxLabel" parent="@style/Label">
+		<item name="android:enabled">true</item>
+	</style>
+	<style name="Theme.BEEM.Default" parent="@android:style/Theme">
+		<item name="android:windowBackground">@drawable/background</item>
+	</style>
+	
+
+<!-- Old PC style -->
+
+	<style name="OldTheme">
+		<item name="android:textViewStyle" >@style/OldThemeTextView</item>
+	</style>
+	<style name="OldThemeTextView" parent="@android:style/Widget.TextView">
+		<item name="android:textColor">#ff009900</item>
+		<item name="android:background">@color/black</item>
+	</style>
+	
+	
+<!-- Other style -->
+
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-fr/arrays.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<string-array name="proxy_types">
+		<item>HTTP</item>
+		<item>SOCKS4</item>
+		<item>SOCKS5</item>
+	</string-array>
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-fr/colors.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<color name="blue_sky">#A0C8FF</color>
+	<color name="black">#000000</color>
+	<color name="white">#FFFFFF</color>
+</resources>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-fr/strings.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<string name="app_name">Beem</string>
+	<string name="OkButton">Ok</string>
+	<string name="ClearButton">Annuler</string>
+	<string name="AcceptButton">Accepter</string>
+	<string name="RefuseButton">Refuser</string>
+
+	<!--  Beem class -->
+	<string name="BeemJabberID">Jabber ID</string>
+
+	<!--  BeemApplication class -->
+	<string name="BeemApplicationConnect">Connexion en cours...</string>
+
+	<!--  BeemService class -->
+	<string name="BeemServiceDescription">Utilisation du service BEEM</string>
+	<string name="BeemServiceCreated">BeemService Créé</string>
+	<string name="BeemServiceDestroyed">BeemService détruit</string>
+
+	<!--  Preferences informations -->
+	<string name="PreferenceStatus">status</string>
+	<string name="PreferenceStatusText">status_text</string>
+	<string name="PreferenceIsConfigured">preference_is_configured</string>
+
+	<!-- ContactListSettings class -->
+	<string name="CLSServerConnection">Connexion au serveur</string>
+	<string name="CLSUserid">Utilisateurid:</string>
+	<string name="CLSPassword">Mot de passe:</string>
+	<string name="CLSService">Service:</string>
+	<string name="CLSHostPort">Host/Port:</string>
+	<string name="CLSProxyInfo">Informations Proxy</string>
+	<string name="CLSLogin">Nom d\'utilisateur:</string>
+	<string name="CLSOkButton">Ok</string>
+
+	<!--  ContactDialog class -->
+	<string name="CDChat">Chat</string>
+	<string name="CDAlias">Alias</string>
+	<string name="CDResend">Réenvoyer la demande</string>
+	<string name="CDInfos">Informations utilisateur</string>
+	<string name="CDBlock">Bloquer l\'utilisateur</string>
+	<string name="CDDelete">Supprimer l\'utilisateur</string>
+	<string name="CDSure2Delete">Êtes-vous sûr de vouloir supprimer ce contact ?</string>
+	<string name="CDSure2DeleteYes">Oui</string>
+	<string name="CDSure2DeleteNo">Non</string>
+
+	<!-- AddContact class -->
+	<string name="AddCActTitle">Beem - Ajouter un contact</string>
+	<string name="AddCLogin">Nom d\'utilisateur :</string>
+	<string name="AddCAlias">Alias :</string>
+	<string name="AddCGroup">Groupe :</string>
+	<string name="AddCOkButton">Ok</string>
+	<string name="AddCContactAdded">Contact ajouté</string>
+	<string name="AddCContactAddedError">Erreur Contact pas ajouté</string>
+	<string name="AddCContactAddedLoginError">Error Nom d\'utilisateur</string>
+	<string name="AddCBadForm">Mauvais formulaire</string>
+
+	<!--  SendIM class -->
+	<string name="SendIMActTitle">Beem - Chat</string>
+	<string name="SendIMSays"> %s dit :\n%s\n</string>
+	<string name="SendIMYouSay">Vous dites :\n%s\n</string>
+	<string name="SendIMSameSpeaker">%s\n</string>
+	<string name="SendIMToSendHint">Tapez votre texte ici</string>
+	<string name="SendIMState">Est : </string>
+	<string name="SendIMErrorMsg">Erreur : %s\n</string>
+	<string name="SendIMFrom">et est entrain de parler depuis : </string>
+	<string name="SendIMSmiley">Insérer un sourire</string>
+	<string name="SendIMLoginHint">nom d'uilisateur</string>
+	<string name="SendIMNoStatusSet">Aucun statut défini</string>
+	
+	<!--  ChangeStatus class -->
+	<string name="ChangeStatusText">Tapez votre message de statut ici :</string>
+	<string name="ChangeStatusActTitle">Beem - Changer statut</string>
+	<string name="MenuAddContact">Ajouter un nouveau contact</string>
+	<string name="MenuAccountAbout">Beem Project</string>
+	<string name="MenuAccountCreate">Créé un compte</string>
+	<string name="MenuConnection">Modifier compte</string>
+	<string name="ChangeStatusOk">Mise à jour du statut</string>
+	<string name="ChangeStatusNoChange">Rien à changer</string>
+	
+	<!-- Subscription class -->
+	<string name="SubscriptAccept">Abonnement accepté</string>
+	<string name="SubscriptError">Erreur d\'abonnement</string>
+	<string name="SubscriptRefused">Abonnement refusé</string>
+	<string name="SubscriptText">Vous avez une requête d\'ajout de la part de %s. Souhaitez-vous l\'accepter ?</string>
+	
+	<!-- ContactList class -->
+	<string name="ConListNotConnected">Non connecté</string>
+
+	<!--  BeemChatManager -->
+	<string name="BeemChatManagerNewMessage">Vous avez reçu un nouveau message</string>
+	
+    <!--
+    	Services
+    -->
+    
+    <!--
+    	Activities
+    -->
+    <string name="login_tag">BEEM - Activité de connexion</string>
+    <string name="edit_settings_name">BEEM - Paramètres</string>
+	<string name="edit_settings_tag">BEEM - EditSettings Activity</string>
+    <string name="create_account_name">BEEM - Créer un compte</string>
+    <string name="create_account_tag">BEEM - CreateAccount Activity</string>
+    <string name="contact_list_name">BEEM - Contacts</string>
+    <string name="contact_list_tag">BEEM - ContactList Activity</string>
+    
+    <!--
+    	Buttons
+    -->
+    <string name="button_reset">Réinitialiser</string>
+    <string name="button_login">Se connecter</string>
+    <string name="button_save">Enregistrer</string>
+    <string name="button_create_account">Créer ce compte</string>
+    <string name="button_create_login_account">Créer et enregistrer</string>
+    
+    
+    <!--
+    	LogAs Activity
+    -->
+	<string name="login_username">Nom d'utilisateur</string>
+	<string name="login_password">Mot de passe</string>
+	<string name="login_error_dialog_title">Connexion - Erreur</string>
+	<string name="login_close_dialog_button">Fermer</string>
+	<string name="login_menu_create_account">Créer un compte</string>
+	<string name="login_menu_settings">Paramètres</string>
+	<string name="login_menu_about">À propos</string>
+	<string name="login_about_title">À propos</string>
+	<string name="login_about_msg">
+		BEEM est un EPITECH Innovative Project. Rencontrez nous sur http://www.beem-project.com !
+	</string>
+	<string name="login_about_button">Fermer</string>
+	<string name="login_settings_button">Paramètres</string>
+	<string name="login_login_button">Connexion</string>
+	<string name="login_login_progress">Connexion en cours. Veuillez patienter...</string>	
+	<string name="login_error_msg">Malheureusement, une erreur est survenu.\n\nDétail de l\'erreur :\n%s</string>
+	
+	<!--
+		EditSettings Activity
+	-->
+	<string name="settings_menu_create_account">Créer un compte</string>
+	<string name="settings_menu_login">Se connecter</string>
+	<string name="settings_saved_ok">Les paramètres ont été enregistrés avec succès.</string>
+	<string name="settings_filename">beem_settings</string>
+	<string name="settings_key_account_username">beem_account_username</string>
+	<string name="settings_key_account_password">beem_account_password</string>
+	<string name="settings_key_xmpp_server">beem_xmpp_server</string>
+	<string name="settings_key_xmpp_port">beem_xmpp_port</string>
+	<string name="settings_key_xmpp_tls_use">beem_xmpp_tls_use</string>
+	<string name="settings_key_proxy_use">beem_xmpp_proxy_use</string>
+	<string name="settings_key_proxy_server">beem_xmpp_proxy_server</string>
+	<string name="settings_key_proxy_port">beem_xmpp_proxy_port</string>
+	<string name="settings_key_proxy_username">beem_xmpp_proxy_username</string>
+	<string name="settings_key_proxy_password">beem_xmpp_proxy_password</string>
+	<string name="settings_key_proxy_type">beem_xmpp_proxy_type</string>
+	
+	<!-- EditSettings Activity tabs -->
+	<string name="settings_tab_tag_account">edit_settings_tab_account</string>
+	<string name="settings_tab_label_account">Compte</string>
+	<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+	<string name="settings_tab_label_xmpp">XMPP</string>
+	<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+	<string name="settings_tab_label_proxy">Proxy</string>
+	
+	<!-- EditSettings Activity Account tab -->
+	<string name="settings_account_username">Nom d\'utilisateur</string>
+	<string name="settings_account_password">Mot de passe</string>
+	<string name="settings_account_server">Serveur</string>
+	<string name="settings_account_port">Port</string>
+	
+	<!-- EditSettings Activity XMPP tab -->
+	<string name="settings_xmpp_server">Serveur</string>
+	<string name="settings_xmpp_port">Port</string>
+	<string name="settings_xmpp_use_tls">Utiliser SSL/TLS</string>
+	
+	<!-- EditSettings Activity Proxy tab -->
+	<string name="settings_proxy_use">Utiliser un proxy</string>
+	<string name="settings_proxy_type_prompt">Choisir un type de proxy</string>
+	<string name="settings_proxy_server">Serveur</string>
+	<string name="settings_proxy_port">Port</string>
+	<string name="settings_proxy_username">Nom d\'utilisateur</string>
+	<string name="settings_proxy_password">Mot de passe</string>
+	
+	<!--
+		Create an account Activity
+	-->
+	<string name="create_account_instr_dialog_title">Créer un compte - Instructions</string>
+	<string name="create_account_err_dialog_title">Créer un compte - Erreur</string>
+	<string name="create_account_err_dialog_settings_button">Changer mes paramètres</string>
+	<string name="create_account_close_dialog_button">Fermer</string>
+	<string name="create_account_successfull_after">a été créé avec succès</string>
+	<string name="create_account_err_username">Mauvais JabberID</string>
+	<string name="create_account_err_passwords">Les mots de passe ne correspondent pas</string>
+	<string name="create_account_username">Nom d\'utilisateur</string>
+	<string name="create_account_password">Mot de passe</string>
+	<string name="create_account_confirm_password">Confirmer le mot de passe</string>
+	
+	<!--
+		ContactList Activity 
+	 -->
+	 <string name="contact_list_menu_add_contact">Ajouter un contact</string>
+	 <string name="contact_list_menu_settings">Paramètres</string>
+
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/values-fr/styles.xml	Sun Aug 09 23:42:22 2009 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<style name="Label">
+		<item name="android:textSize">16sp</item>
+		<item name="android:textStyle">bold</item>
+		<item name="android:typeface">sans</item>
+		<item name="android:capitalize">characters</item>
+		<item name="android:textColor">#FFFFFF</item>
+		<item name="android:focusable">false</item>
+	</style>
+	<style name="CheckBoxLabel" parent="@style/Label">
+		<item name="android:enabled">true</item>
+	</style>
+	<style name="Theme.BEEM.Default" parent="@android:style/Theme">
+		<item name="android:windowBackground">@drawable/background</item>
+	</style>
+	
+
+<!-- Old PC style -->
+
+	<style name="OldTheme">
+		<item name="android:textViewStyle" >@style/OldThemeTextView</item>
+	</style>
+	<style name="OldThemeTextView" parent="@android:style/Widget.TextView">
+		<item name="android:textColor">#ff009900</item>
+		<item name="android:background">@color/black</item>
+	</style>
+	
+	
+<!-- Other style -->
+
+</resources>
--- a/res/values/arrays.xml	Sun Aug 09 23:23:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-	<string-array name="proxy_types">
-		<item>HTTP</item>
-		<item>SOCKS4</item>
-		<item>SOCKS5</item>
-	</string-array>
-</resources>
--- a/res/values/colors.xml	Sun Aug 09 23:23:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-	<color name="blue_sky">#A0C8FF</color>
-	<color name="black">#000000</color>
-	<color name="white">#FFFFFF</color>
-</resources>
\ No newline at end of file
--- a/res/values/strings.xml	Sun Aug 09 23:23:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-	<string name="app_name">Beem</string>
-	<string name="OkButton">Ok</string>
-	<string name="ClearButton">Clear</string>
-	<string name="AcceptButton">Accept</string>
-	<string name="RefuseButton">Refuse</string>
-
-	<!--  Beem class -->
-
-	<string name="BeemJabberID">Jabber ID</string>
-
-	<!--  BeemApplication class -->
-
-	<string name="BeemApplicationConnect">Connecting...</string>
-
-	<!--  BeemService class -->
-
-	<string name="BeemServiceDescription">Use the Beem Service</string>
-	<string name="BeemServiceCreated">BeemService Created</string>
-	<string name="BeemServiceDestroyed">BeemService destroyed</string>
-
-	<!--  Preferences informations -->
-
-	<string name="PreferenceFileName">Beem</string>
-	<string name="PreferenceHostKey">host</string>
-	<string name="PreferenceJID">Jabber ID</string>
-	<string name="PreferenceLoginKey">login</string>
-	<string name="PreferencePasswordKey">password</string>
-	<string name="PreferenceService">service</string>
-	<string name="PreferencePortKey">port</string>
-	<string name="PreferenceProxyHost">proxy_host</string>
-	<string name="PreferenceProxyPort">proxy_port</string>
-	<string name="PreferenceUseProxy">use_proxy</string>
-	<string name="PreferenceProxyType">proxy_type</string>
-	<string name="PreferenceProxyUser">proxy_user</string>
-	<string name="PreferenceProxyPassword">proxy_password</string>
-	<string name="PreferenceProxyTypeNone">None</string>
-	<string name="PreferenceProxyTypeHttp">HTTP</string>
-	<string name="PreferenceProxyTypeSocks4">SOCKS4</string>
-	<string name="PreferenceProxyTypeSocks5">SOCKS5</string>
-	<string name="PreferenceStatus">status</string>
-	<string name="PreferenceStatusText">status_text</string>
-
-	<!-- ContactListSettings class -->
-	<string name="CLSServerConnection">Server connection</string>
-	<string name="CLSUserid">Userid:</string>
-	<string name="CLSPassword">Password:</string>
-	<string name="CLSService">Service:</string>
-	<string name="CLSHostPort">Host/Port:</string>
-	<string name="CLSProxyInfo">Proxy informations</string>
-	<string name="CLSLogin">Login:</string>
-	<string name="CLSOkButton">Ok</string>
-
-	<!--  ContactDialog class -->
-	<string name="CDChat">Chat</string>
-	<string name="CDAlias">Alias</string>
-	<string name="CDResend">Resend suscription</string>
-	<string name="CDInfos">User infos</string>
-	<string name="CDBlock">Block user</string>
-	<string name="CDDelete">Delete user</string>
-	<string name="CDSure2Delete">Are you sure you want to delete this contact?
-	</string>
-	<string name="CDSure2DeleteYes">Yes</string>
-	<string name="CDSure2DeleteNo">No</string>
-	
-	<!-- AccountCreation class -->
-	<string name="ACLogin">Login:</string>
-	<string name="ACEmail">Email:</string>
-	<string name="ACPassword">Password:</string>
-	<string name="ACRepeat">Repeat:</string>
-	<string name="ACOkButton">Ok</string>
-	<string name="ACOkLoginButton">Log with</string>
-	<string name="ACBadForm">Bad form</string>
-	<string name="ACCreated">Account created</string>
-
-	<!-- AddContact class -->
-	<string name="AddCActTitle">Beem - Add contact</string>
-	<string name="AddCLogin">Login:</string>
-	<string name="AddCAlias">Alias:</string>
-	<string name="AddCGroup">Group:</string>
-	<string name="AddCOkButton">Ok</string>
-	<string name="AddCContactAdded">Contact added</string>
-	<string name="AddCContactAddedError">Error Contact not added</string>
-	<string name="AddCContactAddedLoginError">Error Login</string>
-	<string name="AddCBadForm">Bad form</string>
-
-	<!--  SendIM class -->
-
-	<string name="SendIMActTitle">Beem - Chat</string>
-	<string name="SendIMSays"> %s says :\n%s\n</string>
-	<string name="SendIMYouSay">You say :\n%s\n</string>
-	<string name="SendIMSameSpeaker">%s\n</string>
-	<string name="SendIMToSendHint">Tip text here</string>
-	<string name="SendIMState">Is : </string>
-	<string name="SendIMErrorMsg">Error : %s\n</string>
-	<string name="SendIMFrom">and is speaking from : </string>
-	<string name="SendIMSmiley">Insert a smiley</string>
-	<string name="SendIMLoginHint">login</string>
-	<string name="SendIMNoStatusSet">No status set</string>
-	
-	<!--  ChangeStatus class -->
-	<string name="ChangeStatusText">Type here your status message :</string>
-	<string name="ChangeStatusActTitle">Beem - Change status</string>
-
-	<string name="MenuAddContact">Add new contact</string>
-	<string name="MenuAccountAbout">Beem Project</string>
-	<string name="MenuAccountCreate">Create account</string>
-	<string name="MenuConnection">Edit account</string>
-
-	<string name="ChangeStatusOk">Updating status</string>
-	<string name="ChangeStatusNoChange">Nothing to change</string>
-	
-	<!-- Subscription class -->
-	<string name="SubscriptAccept">Subscription accepted</string>
-	<string name="SubscriptError">Subscription error</string>
-	<string name="SubscriptRefused">Subscription refused</string>
-	<string name="SubscriptText">You have received a request for add by %s. Do you want to accept it ?</string>
-	
-	<!-- ContactList class -->
-	<string name="ConListNotConnected">Not connected</string>
-
-	<!--  BeemChatManager -->
-	<string name="BeemChatManagerNewMessage">You have got a new message</string>
-	
-    <!--
-    	Services
-    -->
-    
-    <!--
-    	Activities
-    -->
-    <string name="login_tag">BEEM - Login Activity</string>
-    
-    <string name="edit_settings_name">BEEM - Settings</string>
-	<string name="edit_settings_tag">BEEM - EditSettings Activity</string>
-	
-    <string name="create_account_name">BEEM - Create an account</string>
-    <string name="create_account_tag">BEEM - CreateAccount Activity</string>
-    
-    <string name="contact_list_name">BEEM - Contacts</string>
-    <string name="contact_list_tag">BEEM - ContactList Activity</string>
-
-    
-    <!--
-    	Buttons
-    -->
-    <string name="button_reset">Reset</string>
-    <string name="button_login">Login</string>
-    <string name="button_save">Save</string>
-    <string name="button_create_account">Create this account</string>
-    <string name="button_create_login_account">Create and log</string>
-    
-    
-    <!--
-    	LogAs Activity
-    -->
-	<string name="login_username">Username</string>
-	<string name="login_password">Password</string>
-	
-	<string name="login_error_dialog_title">Login - Error</string>
-	<string name="login_close_dialog_button">Close</string>
-	
-	<string name="login_menu_create_account">Create an account</string>
-	<string name="login_menu_settings">Settings</string>
-	<string name="login_menu_about">About</string>
-	
-	<string name="login_about_title">About</string>
-	<string name="login_about_msg">
-		BEEM is an EPITECH Innovative Project. Visit us at http://www.beem-project.com !
-	</string>
-	<string name="login_about_button">Close</string>
-	
-	
-	<!--
-		EditSettings Activity
-	-->
-	<string name="settings_menu_create_account">Create an account</string>
-	<string name="settings_menu_login">Login</string>
-
-	<string name="settings_saved_ok">The settings have been saved successfully.</string>
-	
-	<string name="settings_filename">beem_settings</string>
-	<string name="settings_key_account_username">beem_account_username</string>
-	<string name="settings_key_account_password">beem_account_password</string>
-	<string name="settings_key_xmpp_server">beem_xmpp_server</string>
-	<string name="settings_key_xmpp_port">beem_xmpp_port</string>
-	<string name="settings_key_xmpp_tls_use">beem_xmpp_tls_use</string>
-	<string name="settings_key_proxy_use">beem_xmpp_proxy_use</string>
-	<string name="settings_key_proxy_server">beem_xmpp_proxy_server</string>
-	<string name="settings_key_proxy_port">beem_xmpp_proxy_port</string>
-	<string name="settings_key_proxy_username">beem_xmpp_proxy_username</string>
-	<string name="settings_key_proxy_password">beem_xmpp_proxy_password</string>
-	<string name="settings_key_proxy_type">beem_xmpp_proxy_type</string>
-	
-	<!-- EditSettings Activity tabs -->
-	<string name="settings_tab_tag_account">edit_settings_tab_account</string>
-	<string name="settings_tab_label_account">Account</string>
-	
-	<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
-	<string name="settings_tab_label_xmpp">XMPP</string>
-	
-	<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
-	<string name="settings_tab_label_proxy">Proxy</string>
-	
-	<!-- EditSettings Activity Account tab -->
-	<string name="settings_account_username">Username</string>
-	<string name="settings_account_password">Password</string>
-	<string name="settings_account_server">Server</string>
-	<string name="settings_account_port">Port</string>
-	
-	
-	<!-- EditSettings Activity XMPP tab -->
-	<string name="settings_xmpp_server">Server</string>
-	<string name="settings_xmpp_port">Port</string>
-	<string name="settings_xmpp_use_tls">Require SSL/TLS</string>
-	
-	<!-- EditSettings Activity Proxy tab -->
-	<string name="settings_proxy_use">Connect using a proxy</string>
-	<string name="settings_proxy_type_prompt">Choose a type of proxy</string>
-	<string name="settings_proxy_server">Server</string>
-	<string name="settings_proxy_port">Port</string>
-	<string name="settings_proxy_username">Username</string>
-	<string name="settings_proxy_password">Password</string>
-	
-	<!--
-		Create an account Activity
-	-->
-	<string name="create_account_instr_dialog_title">Create an account - Instructions</string>
-	<string name="create_account_err_dialog_title">Create an account - Error</string>
-	<string name="create_account_err_dialog_settings_button">Change my settings</string>
-	<string name="create_account_close_dialog_button">Close</string>
-
-	
-	<string name="create_account_successfull_after">has been created successfully</string>
-	<string name="create_account_err_passwords">Passwords do not match.</string>
-	
-	<string name="create_account_username">Username</string>
-	<string name="create_account_password">Password</string>
-	<string name="create_account_confirm_password">Confirm password</string>
-	
-	<!--
-		ContactList Activity 
-	 -->
-	 <string name="contact_list_menu_add_contact">Add a contact</string>
-	 <string name="contact_list_menu_settings">Settings</string>
-
-</resources>
--- a/res/values/styles.xml	Sun Aug 09 23:23:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-	<style name="Label">
-		<item name="android:textSize">16sp</item>
-		<item name="android:textStyle">bold</item>
-		<item name="android:typeface">sans</item>
-		<item name="android:capitalize">characters</item>
-		<item name="android:textColor">#FFFFFF</item>
-		<item name="android:focusable">false</item>
-	</style>
-	<style name="CheckBoxLabel" parent="@style/Label">
-		<item name="android:enabled">true</item>
-	</style>
-	<style name="Theme.BEEM.Default" parent="@android:style/Theme">
-		<item name="android:windowBackground">@drawable/background</item>
-	</style>
-	
-
-<!-- Old PC style -->
-
-	<style name="OldTheme">
-		<item name="android:textViewStyle" >@style/OldThemeTextView</item>
-	</style>
-	<style name="OldThemeTextView" parent="@android:style/Widget.TextView">
-		<item name="android:textColor">#ff009900</item>
-		<item name="android:background">@color/black</item>
-	</style>
-	
-	
-<!-- Other style -->
-
-</resources>
--- a/src/com/beem/project/beem/BeemService.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Sun Aug 09 23:42:22 2009 +0200
@@ -4,12 +4,14 @@
 import org.jivesoftware.smack.PacketListener;
 import org.jivesoftware.smack.Roster;
 import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
 import org.jivesoftware.smack.Roster.SubscriptionMode;
 import org.jivesoftware.smack.filter.PacketFilter;
 import org.jivesoftware.smack.packet.Packet;
 import org.jivesoftware.smack.packet.Presence;
 import org.jivesoftware.smack.proxy.ProxyInfo;
 import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
+import org.jivesoftware.smack.util.StringUtils;
 
 import android.app.Notification;
 import android.app.NotificationManager;
@@ -30,9 +32,8 @@
 import com.beem.project.beem.ui.Subscription;
 
 /**
- * This class is for the Beem service. The connection to the xmpp server will be made asynchronously
- * when the service will start.
- * 
+ * This class is for the Beem service. The connection to the xmpp server will be made asynchronously when the service
+ * will start.
  * @author darisk
  */
 public class BeemService extends Service {
@@ -40,20 +41,20 @@
     /**
      * The id to use for status notification.
      */
-    public static final int         NOTIFICATION_STATUS_ID = 100;
+    public static final int NOTIFICATION_STATUS_ID = 100;
 
-    private NotificationManager     mNotificationManager;
-    private XmppConnectionAdapter   mConnection;
-    private SharedPreferences       mSettings;
-    private String                  mLogin;
-    private String                  mPassword;
-    private String                  mHost;
-    private String                  mService;
-    private int                     mPort;
+    private NotificationManager mNotificationManager;
+    private XmppConnectionAdapter mConnection;
+    private SharedPreferences mSettings;
+    private String mLogin;
+    private String mPassword;
+    private String mHost;
+    private String mService;
+    private int mPort;
     private ConnectionConfiguration mConnectionConfiguration;
-    private ProxyInfo               mProxyInfo;
-    private boolean                 mUseProxy;
-    private IXmppFacade.Stub        mBind;
+    private ProxyInfo mProxyInfo;
+    private boolean mUseProxy;
+    private IXmppFacade.Stub mBind;
 
     /**
      * Constructor.
@@ -74,10 +75,11 @@
      */
     private void initConnectionConfig() {
 	// TODO mettre a false par defaut et remplacer les valeurs par defaut
+	java.security.Security.addProvider(new com.sun.security.sasl.Provider());
 	mUseProxy = mSettings.getBoolean(getString(R.string.settings_key_proxy_use), false);
 	if (mUseProxy) {
 	    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.proxy_types,
-		    android.R.layout.simple_spinner_item);
+		android.R.layout.simple_spinner_item);
 	    int pos = mSettings.getInt(getString(R.string.settings_key_proxy_type), 0);
 	    String stype = adapter.getItem(pos).toString();
 	    String phost = mSettings.getString(getString(R.string.settings_key_proxy_server), "");
@@ -96,6 +98,9 @@
 	    else
 		mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort);
 	}
+	if (mSettings.getBoolean(getString(R.string.settings_key_xmpp_tls_use), false) == true) {
+	    mConnectionConfiguration.setSecurityMode(SecurityMode.required);
+	}
 	mConnectionConfiguration.setDebuggerEnabled(false);
 	mConnectionConfiguration.setSendPresence(true);
     }
@@ -147,15 +152,13 @@
 			public void processPacket(Packet packet) {
 			    String from = packet.getFrom();
 			    Notification notif = new Notification(com.beem.project.beem.R.drawable.signal,
-				    "Demande d'ajout", System.currentTimeMillis());
+				"Demande d'ajout", System.currentTimeMillis());
 			    notif.defaults = Notification.DEFAULT_ALL;
 			    notif.flags = Notification.FLAG_AUTO_CANCEL;
 			    Intent intent = new Intent(BeemService.this, Subscription.class);
 			    intent.putExtra("from", from);
-			    notif
-				    .setLatestEventInfo(BeemService.this, from, "demande d'ajout de " + from,
-				            PendingIntent.getActivity(BeemService.this, 0, intent,
-				                    PendingIntent.FLAG_ONE_SHOT));
+			    notif.setLatestEventInfo(BeemService.this, from, "demande d'ajout de " + from,
+				PendingIntent.getActivity(BeemService.this, 0, intent, PendingIntent.FLAG_ONE_SHOT));
 			    int id = packet.hashCode();
 			    sendNotification(id, notif);
 			}
@@ -233,12 +236,17 @@
 	mPort = Integer.parseInt(mSettings.getString(getString(R.string.settings_key_xmpp_port), "5222"));
 
 	Log.i("BEEEMSERVICE", mLogin);
-	if (mHost.equals("talk.google.com"))
-	    mService = "gmail.com";
-	else
+	/*
+	 * Gestion pour gmail.
+	 */
+	if ("".equals(mHost)) {
+	    mHost = StringUtils.parseServer(mLogin);
 	    mService = null;
+	    mLogin = StringUtils.parseName(mLogin);
+	} else
+	    mService = StringUtils.parseServer(mLogin);
 	initConnectionConfig();
-	mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);	
+	mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 	mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, mPassword, this);
 	initRosterRequestListener();
 	mBind = new XmppFacade(mConnection, this);
@@ -271,11 +279,8 @@
 
     /**
      * Show a notification.
-     * 
-     * @param id
-     *            the id of the notification.
-     * @param notif
-     *            the notification to show
+     * @param id the id of the notification.
+     * @param notif the notification to show
      */
     public void sendNotification(int id, Notification notif) {
 	mNotificationManager.notify(id, notif);
--- a/src/com/beem/project/beem/service/BeemChatManager.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java	Sun Aug 09 23:42:22 2009 +0200
@@ -104,7 +104,6 @@
 	public void processMessage(Chat chat, Message message) {
 	    ChatAdapter newchat = getChat(chat);
 	    try {
-		Log.d(TAG, message.getBody());
 		if (message.getBody() != null)
 		    newchat.addMessage(new com.beem.project.beem.service.Message(message));
 		final int n = mRemoteMessageListeners.beginBroadcast();
--- a/src/com/beem/project/beem/service/Contact.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java	Sun Aug 09 23:42:22 2009 +0200
@@ -7,7 +7,6 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.jivesoftware.smack.RosterEntry;
 import org.jivesoftware.smack.RosterGroup;
 import org.jivesoftware.smack.packet.Presence;
 import org.jivesoftware.smack.util.StringUtils;
@@ -307,8 +306,11 @@
      */
     public Uri toUri() {
 	StringBuilder build = new StringBuilder("xmpp:");
-	build.append(StringUtils.parseName(mJID)).append('@').append(
-		StringUtils.parseServer(mJID));
+	String name = StringUtils.parseName(mJID);
+	build.append(name);
+	if (! "".equals(name))
+	    build.append('@');
+	build.append(StringUtils.parseServer(mJID));
 	Uri u = Uri.parse(build.toString());
 	return u;
     }
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Sun Aug 09 23:42:22 2009 +0200
@@ -3,11 +3,10 @@
  */
 package com.beem.project.beem.service;
 
+
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.jivesoftware.smack.Roster;
 import org.jivesoftware.smack.RosterEntry;
@@ -33,8 +32,6 @@
     private Roster mAdaptee;
     private RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners = new RemoteCallbackList<IBeemRosterListener>();
 
-    private Map<String, Contact> mContacts = new HashMap<String, Contact>();
-
     private RosterListenerAdapter mRosterListener = new RosterListenerAdapter();
 
     /**
@@ -44,13 +41,6 @@
     public RosterAdapter(final Roster roster) {
 	mAdaptee = roster;
 	roster.addRosterListener(mRosterListener);
-	for (RosterEntry entry : roster.getEntries()) {
-	    String user = StringUtils.parseBareAddress(entry.getUser());
-	    if (!mContacts.containsKey(user)) {
-		Contact c = getContactFromRosterEntry(entry);
-		mContacts.put(user, c);
-	    }
-	}
     }
 
     /**
@@ -67,20 +57,13 @@
      */
     @Override
     public Contact addContact(String user, String name, String[] groups) throws RemoteException {
-	Contact res = null;
 	RosterEntry contact = mAdaptee.getEntry(user);
-	if (contact != null) {
-	    res = mContacts.get(user);
-	} else {
-	    try {
-		mAdaptee.createEntry(user, name, groups);
-		contact = mAdaptee.getEntry(user);
-		res = new Contact(user);
-		mContacts.put(user, res);
-	    } catch (XMPPException e) {
-		Log.e(TAG, "Error while adding new contact", e);
-		return null;
-	    }
+	try {
+	    mAdaptee.createEntry(user, name, groups);
+	    contact = mAdaptee.getEntry(user);
+	} catch (XMPPException e) {
+	    Log.e(TAG, "Error while adding new contact", e);
+	    return null;
 	}
 	if (groups != null) {
 	    for (String groupStr : groups) {
@@ -92,11 +75,11 @@
 		    group.addEntry(contact);
 		} catch (XMPPException e) {
 		    e.printStackTrace();
+		    return null;
 		}
-		res.addGroup(groupStr);
 	    }		
 	}
-	return res;
+	return getContactFromRosterEntry(contact);
     }
 
     /**
@@ -107,10 +90,8 @@
 	try {
 	    RosterEntry entry = mAdaptee.getEntry(contact.getJID());
 	    if (entry.getGroups().size() == 0) {
-		mContacts.remove(contact.getJID());
 		mAdaptee.removeEntry(entry);
 	    } else {
-		mContacts.get(contact.getJID()).delGroup(group);
 		mAdaptee.getGroup(group).removeEntry(entry);
 		mRosterListener.onEntryDeleteFromGroup(group, contact.getJID());
 	    }
@@ -124,8 +105,11 @@
      */
     @Override
     public void createGroup(String groupname) throws RemoteException {
-	if (!mAdaptee.contains(groupname))
+	try {
 	    mAdaptee.createGroup(groupname);
+	} catch (IllegalArgumentException e) {
+	    //pas grave, plus simple a gerer comme ca.
+	}
     }
 
     /**
@@ -133,7 +117,9 @@
      */
     @Override
     public Contact getContact(String jid) throws RemoteException {
-	return mContacts.get(jid);
+	if (mAdaptee.contains(jid))
+	    return getContactFromRosterEntry(mAdaptee.getEntry(jid));
+	return null;
     }
 
     /**
@@ -141,9 +127,11 @@
      */
     @Override
     public List<Contact> getContactList() throws RemoteException {
-	List<Contact> res = new ArrayList<Contact>();
-	res.addAll(mContacts.values());
-	return res;
+	List<Contact> coList= new ArrayList<Contact> (mAdaptee.getEntries().size());
+	for(RosterEntry entry: mAdaptee.getEntries()){
+	    coList.add(getContactFromRosterEntry(entry));
+	}
+	return coList;
     }
 
     /**
@@ -173,7 +161,6 @@
      */
     @Override
     public void setContactName(String jid, String name) throws RemoteException {
-	mContacts.get(jid).setName(name);
 	mAdaptee.getEntry(jid).setName(name);
     }
 
@@ -204,7 +191,7 @@
 	}
 
 	public void onEntryDeleteFromGroup(String group, String jid) {
-	    Log.i(TAG, "entry delete listener");
+	    //Log.i(TAG, "entry delete listener");
 	    final int n = mRemoteRosListeners.beginBroadcast();
 	    for (int i = 0; i < n; i++) {
 		IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
@@ -223,7 +210,7 @@
 	 */
 	@Override
 	public void entriesAdded(Collection<String> addresses) {
-	    Log.i(TAG, "Ajout de l'entry " + addresses.size() + " " + addresses.toArray()[0]);
+	    //Log.i(TAG, "Ajout de l'entry " + addresses.size() + " " + addresses.toArray()[0]);
 	    final int n = mRemoteRosListeners.beginBroadcast();
 
 	    List<String> tab = new ArrayList<String>();
@@ -244,7 +231,7 @@
 	 */
 	@Override
 	public void entriesDeleted(Collection<String> addresses) {
-	    Log.i(TAG, "Suppression de l'entry");
+	    //Log.i(TAG, "Suppression de l'entry");
 	    final int n = mRemoteRosListeners.beginBroadcast();
 
 	    List<String> tab = new ArrayList<String>();
@@ -265,7 +252,7 @@
 	 */
 	@Override
 	public void entriesUpdated(Collection<String> addresses) {
-	    Log.i(TAG, "Update de l'entry " + addresses.size() + " " + addresses.toArray()[0]);
+	    //Log.i(TAG, "Update de l'entry " + addresses.size() + " " + addresses.toArray()[0]);
 	    final int n = mRemoteRosListeners.beginBroadcast();
 
 	    List<String> tab = new ArrayList<String>();
@@ -286,17 +273,7 @@
 	 */
 	@Override
 	public void presenceChanged(Presence presence) {
-	    Log.i(TAG, "presence Changed");
-	    String user = StringUtils.parseBareAddress(presence.getFrom());
-	    Contact c = mContacts.get(StringUtils.parseBareAddress(user));
-	    if (c == null) {
-		c = new Contact(user);
-		mContacts.put(user, c);
-	    }
-	    c.addRes(StringUtils.parseResource(presence.getFrom()));
-	    c.setStatus(mAdaptee.getPresence(presence.getFrom()));
-	    c.setMsgState(presence.getStatus());
-	    c.setName(mAdaptee.getEntry(user).getName());
+	    //Log.i(TAG, "presence Changed");
 	    /* redispatch vers les IBeemRosterListener */
 	    final int n = mRemoteRosListeners.beginBroadcast();
 
--- a/src/com/beem/project/beem/ui/AddContact.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/ui/AddContact.java	Sun Aug 09 23:42:22 2009 +0200
@@ -14,6 +14,7 @@
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
@@ -30,8 +31,6 @@
 public class AddContact extends Activity {
 
     protected static final String TAG = "AddContact";
-    private String mLogin;
-    private String mAlias;
     private final List<String> mGroup = new ArrayList<String>();
     private IXmppFacade xmppFacade;
     private final ServiceConnection mServConn = new BeemServiceConnection();
@@ -73,38 +72,39 @@
 
 	@Override
 	public void onClick(View v) {
-	    boolean valid = true;
-	    mLogin = getWidgetText(R.id.addc_login);
-	    boolean isEmail = Pattern.matches("[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,4}", mLogin);
+	    String login;
+	    login = getWidgetText(R.id.addc_login);
+	    if (login.length() == 0) {
+		Toast.makeText(AddContact.this, getString(R.string.AddCBadForm), Toast.LENGTH_SHORT).show();
+		return;
+	    }
+	    boolean isEmail = Pattern.matches("[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,4}", login);
 	    if (!isEmail) {
 		Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedLoginError), Toast.LENGTH_SHORT)
 		    .show();
 		return;
 	    }
-	    mAlias = getWidgetText(R.id.addc_alias);
-	    if (mLogin.length() == 0)
-		valid = false;
+	    String alias;
+	    alias = getWidgetText(R.id.addc_alias);
 	    if (getWidgetText(R.id.addc_group).length() != 0)
 		mGroup.add(getWidgetText(R.id.addc_group));
-	    if (valid) {
-		try {
-		    if (xmppFacade.getRoster().addContact(mLogin, mAlias, mGroup.toArray(new String[mGroup.size()])) == null) {
+	    try {
+		if (xmppFacade != null) {
+		    if (xmppFacade.getRoster().getContact(login) != null)
+			mGroup.addAll(xmppFacade.getRoster().getContact(login).getGroups());
+		    if (xmppFacade.getRoster().addContact(login, alias, mGroup.toArray(new String[mGroup.size()])) == null) {
 			Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedError), Toast.LENGTH_SHORT)
 			    .show();
 			return;
 		    } else {
 			Toast.makeText(AddContact.this, getString(R.string.AddCContactAdded), Toast.LENGTH_SHORT)
 			    .show();
+			finish();
 		    }
-		    finish();
-		} catch (RemoteException e) {
-		    Toast.makeText(AddContact.this, e.getMessage(), Toast.LENGTH_SHORT).show();
-		    e.printStackTrace();
 		}
-		setResult(RESULT_OK);
-	    } else {
-		Toast.makeText(AddContact.this, getString(R.string.AddCBadForm), Toast.LENGTH_SHORT).show();
-		setResult(RESULT_CANCELED);
+	    } catch (RemoteException e) {
+		Toast.makeText(AddContact.this, e.getMessage(), Toast.LENGTH_SHORT).show();
+		Log.e(TAG, "Problem adding contact", e);
 	    }
 
 	}
--- a/src/com/beem/project/beem/ui/ContactList.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sun Aug 09 23:42:22 2009 +0200
@@ -4,7 +4,6 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -20,7 +19,6 @@
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.RemoteException;
-import android.text.util.Linkify;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -95,6 +93,7 @@
 	if (requestCode == REQUEST_CODE) {
 	    if (resultCode == 69) {
 		finish();
+		stopService(new Intent(this, BeemService.class));
 		startActivity(new Intent(this, Login.class));
 	    }
 	}
@@ -116,6 +115,7 @@
 
     @Override
     protected void onStop() {
+	Log.e(TAG, "UNBINSERVICE");
 	super.onStop();
 	unbindService(mServConn);
 	groupName.clear();
@@ -144,47 +144,72 @@
     private void buildContactList(List<Contact> listContact) {
 	mListContact = listContact;
 	Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>());
+	Collections.sort(groupName);
 	for (Contact contact : mListContact) {
 	    for (String group : contact.getGroups()) {
-		if (!groupMap.containsKey(group)) {
-		    groupMap.put(group, new ArrayList<Contact>());
-		    groupName.add(group);
-		}
-		try {
-		    if (!groupMap.get(group).contains(contact))
-			groupMap.get(group).add(contact);
-		} catch (NullPointerException e) {
-		    Log.e(TAG, "Failed to find group in groupMap", e);
-		}
+		addGroup(group);
+		addContactInGroup(contact, group);
 	    }
 	    if (contact.getGroups().isEmpty()) {
-		if (!groupMap.containsKey(DEFAULT_GROUP)) {
-		    groupMap.put(DEFAULT_GROUP, new ArrayList<Contact>());
-		    groupName.add(DEFAULT_GROUP);
-		}
-		groupMap.get(DEFAULT_GROUP).add(contact);
+		addGroup(DEFAULT_GROUP);
+		addContactInGroup(contact, DEFAULT_GROUP);
 	    }
 	}
+	Collections.sort(groupName);
 	mAdapter = new MyExpandableListAdapter();
 	setListAdapter(mAdapter);
     }
 
+    protected void addGroup(String group) {
+	if (!groupMap.containsKey(group)) {
+	    groupMap.put(group, new ArrayList<Contact>());
+	    groupName.add(group);
+	}
+    }
+
+    protected void addContactInGroup(Contact c, String group) {
+	boolean found = false;
+	for (Contact tmpContact : groupMap.get(group)) {
+	    if (c.getJID().equals(tmpContact.getJID())) {
+		found = true;
+		break;
+	    }
+	}
+	if (!found)
+	    groupMap.get(group).add(c);
+    }
+
+    protected void delContactInGroup(Contact c, String group) {
+	groupMap.get(group).remove(c);
+	c.delGroup(group);
+	if (groupMap.get(group).isEmpty()) {
+	    groupMap.remove(group);
+	    groupName.remove(group);
+	}
+    }
+
     private class BeemRosterListener extends IBeemRosterListener.Stub {
 
 	@Override
 	public void onEntriesAdded(List<String> addresses) throws RemoteException {
-	    Log.d("CONTACTLIST", "DEBUG - ONENTRIESADDED()");
 	    for (String str : addresses) {
 		Contact curContact = mRoster.getContact(str);
 		for (String group : curContact.getGroups()) {
-		    if (!groupMap.containsKey(group)) {
-			groupMap.put(group, new ArrayList<Contact>());
-			groupName.add(group);
-		    }
-		    try {
-			groupMap.get(group).add(curContact);
-		    } catch (NullPointerException e) {
-			Log.e(TAG, "Failed to find group in groupMap", e);
+		    addGroup(group);
+		    addContactInGroup(curContact, group);
+		}
+	    }
+	    mHandler.post(new RunnableChange());
+	}
+
+	@Override
+	public void onEntriesDeleted(List<String> addresses) throws RemoteException {
+	    for (String user : addresses) {
+		List<Contact> tmpListContact = groupMap.get(DEFAULT_GROUP);
+		for (Contact contact : tmpListContact) {
+		    if (contact.getJID().equals(user)) {
+			delContactInGroup(contact, DEFAULT_GROUP);
+			break;
 		    }
 		}
 	    }
@@ -192,43 +217,12 @@
 	}
 
 	@Override
-	public void onEntriesDeleted(List<String> addresses) throws RemoteException {
-	    Log.d("CONTACTLIST", "DEBUG - ONENTRIESDELETED() " + addresses.get(0));
-	    for (String user : addresses) {
-		List<Contact> tmpListContact = groupMap.get(DEFAULT_GROUP);
-		for (Contact contact : tmpListContact) {
-		    if (contact.getJID().equals(user))
-			tmpListContact.remove(contact);
-		}
-	    }
-	    if (groupMap.get(DEFAULT_GROUP).isEmpty()) {
-		groupMap.remove(DEFAULT_GROUP);
-		groupName.remove(DEFAULT_GROUP);
-	    }
-	    mHandler.post(new RunnableChange());
-	}
-
-	@Override
 	public void onEntriesUpdated(List<String> addresses) throws RemoteException {
-	    Log.d("CONTACTLIST", "DEBUG - ONENTRIESUPDATED()");
 	    for (String str : addresses) {
 		Contact curContact = mRoster.getContact(str);
 		for (String group : curContact.getGroups()) {
-		    if (!groupMap.containsKey(group)) {
-			groupMap.put(group, new ArrayList<Contact>());
-			groupName.add(group);
-			groupMap.get(group).add(curContact);
-		    } else {
-			boolean found = false;
-			for (Contact tempContact : groupMap.get(group)) {
-			    if (tempContact.getJID().equals(str)) {
-				found = true;
-				break;
-			    }
-			}
-			if (!found)
-			    groupMap.get(group).add(curContact);
-		    }
+		    addGroup(group);
+		    addContactInGroup(curContact, group);
 		}
 	    }
 	    mHandler.post(new RunnableChange());
@@ -236,7 +230,6 @@
 
 	@Override
 	public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
-	    Log.d("CONTACTLIST", "DEBUG - ONPRESENCECHANGED()");
 	    for (Contact curContact : mListContact) {
 		if (curContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
 		    curContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom())));
@@ -255,24 +248,14 @@
 
 	@Override
 	public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
-	    Log.d("CONTACTLIST", "DEBUG - ONENTRYDELETEFROMGROUP()");
 	    for (Contact contact : mListContact) {
-		if (jid.equals(contact.getJID())
-		    && (contact.getGroups().contains(group) || contact.getGroups().size() == 0)) {
-		    groupMap.get(group).remove(contact);
-		    contact.delGroup(group);
-		    if (groupMap.get(group).size() == 0) {
-			groupMap.remove(group);
-			groupName.remove(group);
+		if (jid.equals(contact.getJID())) {
+		    delContactInGroup(contact, group);
+		    if (contact.getGroups().size() == 0) {
+			addGroup(DEFAULT_GROUP);
+			addContactInGroup(contact, DEFAULT_GROUP);
 		    }
-		    if (contact.getGroups().size() == 0) {
-			if (!groupMap.containsKey(DEFAULT_GROUP)) {
-			    groupMap.put(DEFAULT_GROUP, new ArrayList<Contact>());
-			    groupName.add(DEFAULT_GROUP);
-			}
-			groupMap.get(DEFAULT_GROUP).add(contact);
-		    }
-
+		    break;
 		}
 	    }
 	    mHandler.post(new RunnableChange());
@@ -358,9 +341,14 @@
 		}
 		imgV.setImageDrawable(imageDrawable);
 
-		if (v != null) {
-		    v.setText(curContact.getName());
+		String mContactName = curContact.getName();
+		if ("".equals(mContactName)) {
+		    mContactName = curContact.getJID();
+		    mContactName = StringUtils.parseName(mContactName);
+		    if ("".equals(mContactName))
+			mContactName = curContact.getJID();
 		}
+		v.setText(mContactName);
 
 		v = (TextView) view.findViewById(R.id.contactlistmsgperso);
 		if (v != null) {
--- a/src/com/beem/project/beem/ui/ContactListSettings.java	Sun Aug 09 23:23:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-package com.beem.project.beem.ui;
-
-import android.app.Activity;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.LinearLayout.LayoutParams;
-
-import com.beem.project.beem.R;
-
-public class ContactListSettings extends Activity {
-
-    public static final int              CHANGE      = 1;
-    private boolean                      mIsChanged  = false;
-    private SharedPreferences            mSettings;
-    private String[]                     mProxyTypeString;
-
-    private final OnItemSelectedListener mProxyType  = new OnItemSelectedListener() {
-
-	                                                 @Override
-	                                                 public void onItemSelected(AdapterView<?> parent, View arg1,
-	                                                         int arg2, long arg3) {
-		                                             String value = parent.getSelectedItem().toString();
-		                                             LinearLayout ll = (LinearLayout) findViewById(R.id.proxy_layout);
-		                                             SharedPreferences.Editor editor = mSettings.edit();
-		                                             LayoutParams lp = (LayoutParams) ll.getLayoutParams();
-		                                             if (value
-		                                                     .equals(getString(R.string.PreferenceProxyTypeNone))) {
-		                                                 ll.setVisibility(View.INVISIBLE);
-		                                                 lp.height = 0;
-		                                                 ll.setLayoutParams(lp);
-		                                                 editor.putBoolean(
-		                                                         getString(R.string.PreferenceUseProxy), false);
-		                                             } else {
-		                                                 ll.setVisibility(View.VISIBLE);
-		                                                 lp.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-		                                                 ll.setLayoutParams(lp);
-		                                                 editor.putBoolean(
-		                                                         getString(R.string.PreferenceUseProxy), true);
-		                                             }
-		                                             if (!value
-		                                                     .equals(getPreferenceString(R.string.PreferenceProxyType))) {
-		                                                 editor
-		                                                         .putString(
-		                                                                 getString(R.string.PreferenceProxyType),
-		                                                                 value);
-		                                                 mIsChanged = true;
-		                                             }
-		                                             editor.commit();
-	                                                 }
-
-	                                                 @Override
-	                                                 public void onNothingSelected(AdapterView<?> arg0) {
-	                                                 }
-
-	                                             };
-
-    private final OnClickListener        mOkListener = new OnClickListener() {
-
-	                                                 public void onClick(View v) {
-		                                             SharedPreferences.Editor editor = mSettings.edit();
-
-		                                             if (isChanged(R.id.host, R.string.PreferenceHostKey)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceHostKey),
-		                                                         getWidgetText(R.id.host));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (Integer.parseInt(getWidgetText(R.id.port)) != mSettings
-		                                                     .getInt(getString(R.string.PreferencePortKey),
-		                                                             5222)) {
-		                                                 editor.putInt(getString(R.string.PreferencePortKey),
-		                                                         Integer.parseInt(getWidgetText(R.id.port)));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.userid, R.string.PreferenceLoginKey)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceLoginKey),
-		                                                         getWidgetText(R.id.userid));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.password,
-		                                                     R.string.PreferencePasswordKey)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferencePasswordKey),
-		                                                         getWidgetText(R.id.password));
-		                                                 mIsChanged = true;
-		                                             }
-
-		                                             if (isChanged(R.id.proxy_host,
-		                                                     R.string.PreferenceProxyHost)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceProxyHost),
-		                                                         getWidgetText(R.id.proxy_host));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (Integer.parseInt(getWidgetText(R.id.proxy_port)) != mSettings
-		                                                     .getInt(getString(R.string.PreferenceProxyPort), 0)) {
-		                                                 editor
-		                                                         .putInt(
-		                                                                 getString(R.string.PreferenceProxyPort),
-		                                                                 Integer
-		                                                                         .parseInt(getWidgetText(R.id.proxy_port)));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.proxy_login,
-		                                                     R.string.PreferenceProxyUser)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceProxyUser),
-		                                                         getWidgetText(R.id.proxy_login));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.proxy_pwd,
-		                                                     R.string.PreferenceProxyPassword)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceProxyPassword),
-		                                                         getWidgetText(R.id.proxy_pwd));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (mIsChanged == true) {
-		                                                 editor.commit();
-		                                                 setResult(RESULT_OK);
-		                                             } else
-		                                                 setResult(RESULT_CANCELED);
-		                                             finish();
-	                                                 }
-	                                             };
-
-    private String getPreferenceString(int id) {
-	return mSettings.getString(getString(id), "");
-    }
-
-    private String getWidgetText(int id) {
-	EditText widget = (EditText) this.findViewById(id);
-	return widget.getText().toString();
-    }
-
-    private boolean isChanged(int idEdit, int idPreference) {
-	return (!getWidgetText(idEdit).equals(getPreferenceString(idPreference)));
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-	super.onCreate(savedInstanceState);
-	setContentView(R.layout.contactlistsettings);
-
-	String TypeNone = getString(R.string.PreferenceProxyTypeNone);
-	String TypeHTTP = getString(R.string.PreferenceProxyTypeHttp);
-	String TypeSocks4 = getString(R.string.PreferenceProxyTypeSocks4);
-	String TypeSocks5 = getString(R.string.PreferenceProxyTypeSocks5);
-
-	mProxyTypeString = new String[] { TypeNone, TypeHTTP, TypeSocks4, TypeSocks5 };
-	mSettings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
-
-	Spinner sp = (Spinner) findViewById(R.id.proxy_type);
-	ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
-	        mProxyTypeString);
-	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
-	sp.setAdapter(adapter);
-	for (int i = 0; i < mProxyTypeString.length; ++i)
-	    if (mProxyTypeString[i].equals(getPreferenceString(R.string.PreferenceProxyType)))
-		sp.setSelection(i);
-	sp.setOnItemSelectedListener(mProxyType);
-
-	Button ok = (Button) findViewById(R.id.ok);
-	ok.setOnClickListener(mOkListener);
-
-	showSettings();
-    }
-
-    private void showSettings() {
-	EditText e = (EditText) findViewById(R.id.host);
-	e.setText(getPreferenceString(R.string.PreferenceHostKey));
-	e = (EditText) findViewById(R.id.port);
-	e.setText(String.valueOf(mSettings.getInt(getString(R.string.PreferencePortKey), 5222)));
-	e = (EditText) findViewById(R.id.userid);
-	e.setText(getPreferenceString(R.string.PreferenceLoginKey));
-	e = (EditText) findViewById(R.id.password);
-	e.setText(getPreferenceString(R.string.PreferencePasswordKey));
-
-	e = (EditText) findViewById(R.id.proxy_host);
-	e.setText(getPreferenceString(R.string.PreferenceProxyHost));
-	e = (EditText) findViewById(R.id.proxy_port);
-	e.setText(String.valueOf(mSettings.getInt(getString(R.string.PreferenceProxyPort), 1080)));
-	e = (EditText) findViewById(R.id.proxy_login);
-	e.setText(getPreferenceString(R.string.PreferenceProxyUser));
-	e = (EditText) findViewById(R.id.proxy_pwd);
-	e.setText(getPreferenceString(R.string.PreferenceProxyPassword));
-    }
-
-}
--- a/src/com/beem/project/beem/ui/CreateAccount.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java	Sun Aug 09 23:42:22 2009 +0200
@@ -1,10 +1,13 @@
 package com.beem.project.beem.ui;
 
+import java.util.regex.Pattern;
+
 import org.jivesoftware.smack.AccountManager;
 import org.jivesoftware.smack.ConnectionConfiguration;
 import org.jivesoftware.smack.XMPPConnection;
 import org.jivesoftware.smack.XMPPException;
 import org.jivesoftware.smack.proxy.ProxyInfo;
+import org.jivesoftware.smack.util.StringUtils;
 
 import android.app.Activity;
 import android.app.AlertDialog;
@@ -15,29 +18,25 @@
 import android.view.View;
 import android.widget.Button;
 import android.widget.EditText;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.beem.project.beem.R;
 
 /**
- * This class represents an activity which allows the user to create an account on the XMPP server
- * saved in settings
- * 
+ * This class represents an activity which allows the user to create an account on the XMPP server saved in settings
  * @author dasilvj
  */
 public class CreateAccount extends Activity {
 
     private final static boolean DEFAULT_BOOLEAN_VALUE = false;
-    private final static String  DEFAULT_STRING_VALUE  = "";
-    private final static int     DEFAULT_INT_VALUE     = 0;
-
-    private final static String  DEFAULT_XMPP_PORT     = "5222";
+    private final static String DEFAULT_STRING_VALUE = "";
+    private final static int DEFAULT_INT_VALUE = 0;
 
-    private final static int     NOTIFICATION_DURATION = Toast.LENGTH_SHORT;
+    private final static int NOTIFICATION_DURATION = Toast.LENGTH_SHORT;
 
-    private SharedPreferences    settings              = null;
-    private Button               createAccountButton   = null;
-
+    private SharedPreferences settings = null;
+    private Button createAccountButton = null;
 
     /**
      * {@inheritDoc}
@@ -51,21 +50,6 @@
     }
 
     /**
-     * Check if the fields password and confirm password match
-     * 
-     * @return return true if password & confirm password fields match, else false
-     */
-    private boolean checkPasswords() {
-	final String passwordFieldValue = ((EditText) findViewById(R.id.create_account_password)).getText().toString();
-	final String passwordConfirmFielddValue = ((EditText) findViewById(R.id.create_account_confirm_password))
-	.getText().toString();
-
-	if (passwordFieldValue.equals(passwordConfirmFielddValue))
-	    return (true);
-	return (false);
-    }
-
-    /**
      * Create an account on the XMPP server specified in settings
      */
     private boolean createAccount(String username, String password) {
@@ -73,10 +57,9 @@
 	ConnectionConfiguration connectionConfiguration = null;
 
 	if (getRegisteredProxy() != null) {
-	    connectionConfiguration = new ConnectionConfiguration(getRegisteredXMPPServer(), getRegisteredXMPPPort(),
-		getRegisteredProxy());
+	    connectionConfiguration = new ConnectionConfiguration(getXMPPServer(), 5222, getRegisteredProxy());
 	} else {
-	    connectionConfiguration = new ConnectionConfiguration(getRegisteredXMPPServer(), getRegisteredXMPPPort());
+	    connectionConfiguration = new ConnectionConfiguration(getXMPPServer(), 5222);
 	}
 	if (getRegisteredXMPPTLSUse())
 	    connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
@@ -100,9 +83,7 @@
 
     /**
      * Create a dialog containing an error message
-     * 
-     * @param errMsg
-     *            the error message
+     * @param errMsg the error message
      */
     private void createErrorDialog(String errMsg) {
 	Log.v(getString(R.string.create_account_tag), errMsg);
@@ -121,7 +102,6 @@
 
     /**
      * Retrive proxy informations from the preferences
-     * 
      * @return Registered proxy informations
      */
     private ProxyInfo getRegisteredProxy() {
@@ -135,7 +115,6 @@
 
     /**
      * Retrieve proxy password from the preferences
-     * 
      * @return Registered proxy password
      */
     private String getRegisteredProxyPassword() {
@@ -144,7 +123,6 @@
 
     /**
      * Retrieve proxy port from the preferences
-     * 
      * @return Registered proxy port
      */
     private int getRegisteredProxyPort() {
@@ -153,7 +131,6 @@
 
     /**
      * Retrieve proxy server from the preferences
-     * 
      * @return Registered proxy server
      */
     private String getRegisteredProxyServer() {
@@ -162,7 +139,6 @@
 
     /**
      * Retrieve proxy type from the preferences
-     * 
      * @return Registered proxy type
      */
     private ProxyInfo.ProxyType getRegisteredProxyType() {
@@ -181,7 +157,6 @@
 
     /**
      * Retrieve proxy use from the preferences
-     * 
      * @return Registered proxy use
      */
     private boolean getRegisteredProxyUse() {
@@ -190,7 +165,6 @@
 
     /**
      * Retrieve proxy username from the preferences
-     * 
      * @return Registered proxy username
      */
     private String getRegisteredProxyUsername() {
@@ -198,26 +172,17 @@
     }
 
     /**
-     * Retrieve xmpp port from the preferences
-     * 
-     * @return Registered xmpp port
-     */
-    private int getRegisteredXMPPPort() {
-	return (Integer.parseInt(settings.getString(getString(R.string.settings_key_xmpp_port), DEFAULT_XMPP_PORT)));
-    }
-
-    /**
      * Retrieve xmpp server from the preferences
-     * 
      * @return Registered xmpp server
      */
-    private String getRegisteredXMPPServer() {
-	return (settings.getString(getString(R.string.settings_key_xmpp_server), DEFAULT_STRING_VALUE));
+    private String getXMPPServer() {
+	TextView xmppServerTextView = (TextView) findViewById(R.id.create_account_username);
+	String xmppServer = StringUtils.parseServer(xmppServerTextView.getText().toString());
+	return xmppServer;
     }
 
     /**
      * Retrieve TLS use from the preferences
-     * 
      * @return Registered TLS use
      */
     private boolean getRegisteredXMPPTLSUse() {
@@ -225,6 +190,25 @@
     }
 
     /**
+     * Check if the fields password and confirm password match
+     * @return return true if password & confirm password fields match, else false
+     */
+    private boolean checkPasswords() {
+	final String passwordFieldValue = ((EditText) findViewById(R.id.create_account_password)).getText().toString();
+	final String passwordConfirmFielddValue = ((EditText) findViewById(R.id.create_account_confirm_password))
+	    .getText().toString();
+
+	if (passwordFieldValue.equals(passwordConfirmFielddValue))
+	    return (true);
+	return (false);
+    }
+
+    private boolean checkEmail() {
+	String email = ((TextView) findViewById(R.id.create_account_username)).getText().toString();
+	return (Pattern.matches("[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,4}", email));
+    }
+
+    /**
      * Initialize the "Create this account" button which allows the user to create an account
      */
     private void initCreateAccountButton() {
@@ -232,36 +216,44 @@
 	createAccountButton.setOnClickListener(new View.OnClickListener() {
 	    public void onClick(View v) {
 		String usernameFieldValue = ((EditText) findViewById(R.id.create_account_username)).getText()
-		.toString();
+		    .toString();
 		String passwordFieldValue = ((EditText) findViewById(R.id.create_account_password)).getText()
-		.toString();
+		    .toString();
+		String username = StringUtils.parseName(usernameFieldValue);
+		if (!checkEmail())
+		    createErrorDialog(getString(R.string.create_account_err_username));
+		else if (!checkPasswords())
+		    createErrorDialog(getString(R.string.create_account_err_passwords));
+		else {
+		    if (createAccount(username, passwordFieldValue))
+			finish();
+		}
 
-		if (!checkPasswords())
-		    createErrorDialog(getString(R.string.create_account_err_passwords));
-		else if (createAccount(usernameFieldValue, passwordFieldValue))
-			finish();
 	    }
 	});
 	Button createAccountLoginButton = (Button) findViewById(R.id.create_account_login_button);
 	createAccountLoginButton.setOnClickListener(new View.OnClickListener() {
 	    public void onClick(View v) {
 		String usernameFieldValue = ((EditText) findViewById(R.id.create_account_username)).getText()
-		.toString();
+		    .toString();
+		String username = StringUtils.parseName(usernameFieldValue);
 		String passwordFieldValue = ((EditText) findViewById(R.id.create_account_password)).getText()
-		.toString();
-
-		if (!checkPasswords())
+		    .toString();
+		if (!checkEmail())
+		    createErrorDialog(getString(R.string.create_account_err_username));
+		else if (!checkPasswords())
 		    createErrorDialog(getString(R.string.create_account_err_passwords));
 		else {
-		    if (createAccount(usernameFieldValue, passwordFieldValue)) {
+		    if (createAccount(username, passwordFieldValue)) {
 			SharedPreferences.Editor settingsEditor = settings.edit();
 			settingsEditor.putString(getString(R.string.settings_key_account_username), usernameFieldValue);
 			settingsEditor.putString(getString(R.string.settings_key_account_password), passwordFieldValue);
+			settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), true);
 			settingsEditor.commit();
 			finish();
 		    }
 		}
 	    }
 	});
-    }	
+    }
 }
--- a/src/com/beem/project/beem/ui/EditSettings.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/ui/EditSettings.java	Sun Aug 09 23:42:22 2009 +0200
@@ -99,6 +99,16 @@
 	proxyPortField.setEnabled(false);
 	proxyUsernameField.setEnabled(false);
 	proxyPasswordField.setEnabled(false);
+	proxyTypeSpinner.setFocusable(false);
+	proxyServerField.setFocusable(false);
+	proxyPortField.setFocusable(false);
+	proxyUsernameField.setFocusable(false);
+	proxyPasswordField.setFocusable(false);
+	proxyTypeSpinner.setFocusableInTouchMode(false);
+	proxyServerField.setFocusableInTouchMode(false);
+	proxyPortField.setFocusableInTouchMode(false);
+	proxyUsernameField.setFocusableInTouchMode(false);
+	proxyPasswordField.setFocusableInTouchMode(false);
     }
 
     private void displayNotification(CharSequence msg) {
@@ -115,6 +125,16 @@
 	proxyPortField.setEnabled(true);
 	proxyUsernameField.setEnabled(true);
 	proxyPasswordField.setEnabled(true);
+	proxyTypeSpinner.setFocusable(true);
+	proxyServerField.setFocusable(true);
+	proxyPortField.setFocusable(true);
+	proxyUsernameField.setFocusable(true);
+	proxyPasswordField.setFocusable(true);
+	proxyTypeSpinner.setFocusableInTouchMode(true);
+	proxyServerField.setFocusableInTouchMode(true);
+	proxyPortField.setFocusableInTouchMode(true);
+	proxyUsernameField.setFocusableInTouchMode(true);
+	proxyPasswordField.setFocusableInTouchMode(true);
     }
 
     /**
@@ -481,6 +501,14 @@
 	    registerProxySettingsChanges(settingsEditor);
 	registerAccountSettingsChanges(settingsEditor);
 	registerXMPPSettingsChanges(settingsEditor);
+	String password = accPasswordField.getText().toString();
+	String username = accUsernameField.getText().toString();
+	String port = xmppPortField.getText().toString();
+	if("".equals(password) || "".equals(username)
+	    || "".equals(port))
+	    settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), false);
+	else
+	    settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), true);
 
 	if (settingsEditor.commit()) {
 	    displayNotification(getText(R.string.settings_saved_ok));
--- a/src/com/beem/project/beem/ui/Login.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java	Sun Aug 09 23:42:22 2009 +0200
@@ -7,6 +7,7 @@
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -18,7 +19,6 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.beem.project.beem.BeemService;
 import com.beem.project.beem.R;
 import com.beem.project.beem.service.aidl.IBeemConnectionListener;
 import com.beem.project.beem.service.aidl.IXmppConnection;
@@ -44,6 +44,11 @@
     private final ServiceConnection mServConn = new BeemServiceConnection();
     private IXmppFacade xmppFacade = null;
 
+    private SharedPreferences settings = null;
+    private boolean isConfigured = false;
+
+    private Button mButtonLogin = null;
+
     /**
      * Create an about "BEEM" dialog
      */
@@ -66,6 +71,7 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
 	super.onCreate(savedInstanceState);
+	settings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
 	setContentView(R.layout.login);
 	Button button = (Button) findViewById(R.id.log_as_settings);
 	button.setOnClickListener(new OnClickListener() {
@@ -76,8 +82,8 @@
 	    }
 
 	});
-	button = (Button) findViewById(R.id.log_as_login);
-	button.setOnClickListener(new OnClickListener() {
+	mButtonLogin = (Button) findViewById(R.id.log_as_login);
+	mButtonLogin.setOnClickListener(new OnClickListener() {
 
 	    @Override
 	    public void onClick(View v) {
@@ -91,7 +97,7 @@
     @Override
     protected void onDestroy() {
 	super.onDestroy();
-	if (mIsConnected || xmppFacade == null) {
+	if (isConfigured && (mIsConnected || xmppFacade == null)) {
 	    unbindService(mServConn);
 	}
     }
@@ -103,7 +109,13 @@
     public void onStart() {
 	super.onStart();
 	Log.e("LOGIN", "BINDSERVICE");
-	bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+	isConfigured = settings.getBoolean(getString(R.string.PreferenceIsConfigured), false);
+
+	if (isConfigured)
+	    bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+	else
+	    mButtonLogin.setEnabled(false);
+
     }
 
     private class BeemConnectionListener extends IBeemConnectionListener.Stub {
@@ -126,19 +138,28 @@
 	@Override
 	public void connectionClosed() throws RemoteException {
 	    Log.e("Login", "CONNECTIONCLOSED");
+	    mIsConnected = false;
+	    if (xmppFacade != null) {
+		Login.this.unbindService(mServConn);
+		Login.this.stopService(SERVICE_INTENT);
+		xmppFacade = null;
+	    }
 	}
 
 	@Override
 	public void connectionClosedOnError() throws RemoteException {
 	    Log.e("Login", "CONNECTIONCLOSEONERROR");
+
 	}
 
 	@Override
 	public void connectionFailed(String errorMsg) throws RemoteException {
+	    Log.e("Login", "CONNECTIONFAILLED");
 	    mIsConnected = false;
 	    if (xmppFacade != null) {
 		Login.this.unbindService(mServConn);
 		Login.this.stopService(SERVICE_INTENT);
+		xmppFacade = null;
 	    }
 	    connectionHandler.post(new ErrorRunnable(errorMsg));
 	    dismissProgressDialog();
@@ -151,7 +172,7 @@
 		public void run() {
 		    Toast.makeText(Login.this, errorMsg, Toast.LENGTH_LONG).show();
 		    TextView labelError = (TextView) findViewById(R.id.log_as_msg);
-		    labelError.setText(errorMsg);
+		    labelError.setText(getString(R.string.login_error_msg, errorMsg));
 		}
 	    });
 	}
@@ -208,7 +229,7 @@
 
 			@Override
 			public void run() {
-			    progressDialog.setMessage("Connecting. Please wait...");
+			    progressDialog.setMessage(getString(R.string.login_login_progress));
 			    progressDialog.show();
 			}
 		    });
--- a/src/com/beem/project/beem/ui/SendIM.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java	Sun Aug 09 23:42:22 2009 +0200
@@ -42,8 +42,7 @@
 import com.beem.project.beem.service.aidl.IXmppFacade;
 
 /**
- * This activity class provides the view for instant messaging after selecting a
- * correspondant.
+ * This activity class provides the view for instant messaging after selecting a correspondant.
  * @author barbu
  */
 
@@ -92,7 +91,7 @@
     @Override
     protected void onCreate(Bundle saveBundle) {
 	super.onCreate(saveBundle);
-	setTheme(R.style.OldTheme);
+	//setTheme(R.style.OldTheme);
 	setContentView(R.layout.sendim);
 	mHandler = new Handler();
 	mChatManagerListener = new OnChatListener();
@@ -130,6 +129,8 @@
 	if (mContactName == null || "".equals(mContactName)) {
 	    mContactName = mContact.getJID();
 	    mContactName = StringUtils.parseName(mContactName);
+	    if ("".equals(mContactName))
+		mContactName = mContact.getJID();
 	}
 	mLogin.setText(mContactName);
     }
@@ -218,7 +219,8 @@
     protected void onPause() {
 	super.onPause();
 	try {
-	    mChat.setOpen(false);
+	    if (mChat != null)
+		mChat.setOpen(false);
 	} catch (RemoteException e) {
 	    Log.d(TAG, "Error while closing chat", e);
 	}
@@ -231,8 +233,7 @@
     @Override
     protected void onResume() {
 	super.onResume();
-	bindService(new Intent(this, BeemService.class), mServConn,
-		BIND_AUTO_CREATE);
+	bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
 	mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
     }
 
@@ -243,8 +244,6 @@
     protected void onStart() {
 	super.onStart();
 	// TODO cancel the notification if any
-	if (mContact == null)
-	    mContact = getIntent().getParcelableExtra("contact");
 	try {
 	    if (mRoster != null)
 		mContact = mRoster.getContact(mContact.getJID());
@@ -271,9 +270,10 @@
 		if (mRoster != null) {
 		    mRoster.addRosterListener(mBeemRosterListener);
 		    // mContact.setStatus(mRoster.getPresence(mContact.getJID()));
-		    mContact = mRoster.getContact(mContact.getJID());
-		    mStatusText.setText(mContact.getMsgState());
-		    Linkify.addLinks(mStatusText, Linkify.WEB_URLS);
+		    if (mRoster.getContact(mContact.getJID()) != null) {
+			mContact = mRoster.getContact(mContact.getJID());
+			mStatusText.setText(mContact.getMsgState());
+		    }
 		}
 		switchChat(mContact);
 	    } catch (RemoteException e) {
@@ -293,9 +293,8 @@
     }
 
     /**
-     * Send a message to the contact over the XMPP connection. Also display it
-     * on activity view. TODO : Gerer l'exception si la connexion se coupe
-     * pendant la conversation
+     * Send a message to the contact over the XMPP connection. Also display it on activity view. TODO : Gerer
+     * l'exception si la connexion se coupe pendant la conversation
      */
     private void sendText() {
 	String text = mToSend.getText().toString();
@@ -307,11 +306,9 @@
 		// INTERDICTION !
 		mChat.sendMessage(msg);
 		if (mSpeak != 1)
-		    mText.append(String.format(
-			    getString(R.string.SendIMYouSay), text));
+		    mText.append(getString(R.string.SendIMYouSay, text));
 		else
-		    mText.append(String.format(
-			    getString(R.string.SendIMSameSpeaker), text));
+		    mText.append(getString(R.string.SendIMSameSpeaker, text));
 		mToSend.setText(null);
 		mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
 		mToSend.requestFocus();
@@ -325,8 +322,7 @@
 
     /**
      * Show the message history.
-     * @param messages
-     *            list of message to display
+     * @param messages list of message to display
      */
     private void showMessageList(List<Message> messages) {
 	mText.setText("");
@@ -335,23 +331,15 @@
 	    String from = message.getFrom();
 	    if (from == null) {
 		if (mSpeak != 1)
-		    mText.append(String
-			    .format(getString(R.string.SendIMYouSay), message
-				    .getBody()));
+		    mText.append(getString(R.string.SendIMYouSay, message.getBody()));
 		else
-		    mText.append(String.format(
-			    getString(R.string.SendIMSameSpeaker), message
-				    .getBody()));
+		    mText.append(getString(R.string.SendIMYouSay, message.getBody()));
 		mSpeak = 1;
 	    } else {
-		if (mSpeak != 2) {
-		    String str = String.format(getString(R.string.SendIMSays),
-			    mContactName, message.getBody());
-		    mText.append(str);
-		} else
-		    mText.append(String.format(
-			    getString(R.string.SendIMSameSpeaker), message
-				    .getBody()));
+		if (mSpeak != 2)
+		    mText.append(getString(R.string.SendIMSays, mContactName, message.getBody()));
+		else
+		    mText.append(getString(R.string.SendIMSameSpeaker, message.getBody()));
 		mSpeak = 2;
 	    }
 	}
@@ -360,10 +348,8 @@
 
     /**
      * Change the correspondant of the chat.
-     * @param newContact
-     *            New contact to chat with
-     * @throws RemoteException
-     *             if an errors occurs in the connection with the service
+     * @param newContact New contact to chat with
+     * @throws RemoteException if an errors occurs in the connection with the service
      */
     private void switchChat(Contact newContact) throws RemoteException {
 	if (mChat != null)
@@ -384,8 +370,7 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void chatCreated(IChat chat, boolean locally)
-		throws RemoteException {
+	public void chatCreated(IChat chat, boolean locally) throws RemoteException {
 	    Log.i("LOG", "chatCreated");
 	}
 
@@ -394,33 +379,27 @@
     private class BeemRosterListener extends IBeemRosterListener.Stub {
 
 	@Override
-	public void onEntriesAdded(List<String> addresses)
-		throws RemoteException {
-	    // TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public void onEntriesDeleted(List<String> addresses)
-		throws RemoteException {
+	public void onEntriesAdded(List<String> addresses) throws RemoteException {
 	    // TODO Auto-generated method stub
 
 	}
 
 	@Override
-	public void onEntriesUpdated(List<String> addresses)
-		throws RemoteException {
+	public void onEntriesDeleted(List<String> addresses) throws RemoteException {
 	    // TODO Auto-generated method stub
 
 	}
 
 	@Override
-	public void onPresenceChanged(PresenceAdapter presence)
-		throws RemoteException {
-	    if (mContact.getJID().equals(
-		    StringUtils.parseBareAddress(presence.getFrom()))) {
-		mContact.setStatus(mRoster.getPresence(StringUtils
-			.parseBareAddress(presence.getFrom())));
+	public void onEntriesUpdated(List<String> addresses) throws RemoteException {
+	    // TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
+	    if (mContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
+		mContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom())));
 		mHandler.post(new RunnableChange());
 	    }
 	}
@@ -434,8 +413,7 @@
 	}
 
 	@Override
-	public void onEntryDeleteFromGroup(String group, String jid)
-		throws RemoteException {
+	public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
 	    // TODO Auto-generated method stub
 
 	}
@@ -452,8 +430,7 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void processMessage(IChat chat, Message msg)
-		throws RemoteException {
+	public void processMessage(IChat chat, Message msg) throws RemoteException {
 
 	    if (chat != mChat)
 		return;
@@ -465,21 +442,12 @@
 		public void run() {
 		    if (m.getBody() != null) {
 			if (m.getType() == Message.MSG_TYPE_ERROR) {
-			    mText.append(String.format(
-				    getString(R.string.SendIMErrorMsg), m
-					    .getBody()));
+			    mText.append(getString(R.string.SendIMErrorMsg, m.getBody()));
 			    mSpeak = 0;
 			} else if (mSpeak == 2)
-			    mText.append(String.format(
-				    getString(R.string.SendIMSameSpeaker), m
-					    .getBody()));
-			else {
-
-			    String str = String.format(
-				    getString(R.string.SendIMSays),
-				    mContactName, m.getBody());
-			    mText.append(str);
-			}
+			    mText.append(getString(R.string.SendIMSameSpeaker, m.getBody()));
+			else
+			    mText.append(getString(R.string.SendIMSays, mContactName, m.getBody()));
 			mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
 			mToSend.requestFocus();
 			mSpeak = 2;
@@ -496,8 +464,7 @@
 	    if (chat != mChat)
 		return;
 	    final String state = chat.getState();
-	    Log.d("ChatState", "Action du correspondant : <--- "
-		    + chat.getState() + " --->");
+	    Log.d("ChatState", "Action du correspondant : <--- " + chat.getState() + " --->");
 	    mHandler.post(new Runnable() {
 
 		@Override
--- a/src/com/beem/project/beem/utils/PresenceType.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/utils/PresenceType.java	Sun Aug 09 23:42:22 2009 +0200
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package com.beem.project.beem.utils;
 
@@ -13,28 +13,28 @@
     /**
      * The user is available to receive messages (default).
      */
-    public static final int AVAILABLE    = 100;
+    public static final int AVAILABLE = 100;
 
     /**
      * The user is unavailable to receive messages.
      */
-    public static final int UNAVAILABLE  = 200;
+    public static final int UNAVAILABLE = 200;
 
     /**
      * Request subscription to recipient's presence.
      */
 
-    public static final int SUBSCRIBE    = 300;
+    public static final int SUBSCRIBE = 300;
 
     /**
      * Grant subscription to sender's presence.
      */
-    public static final int SUBSCRIBED   = 400;
+    public static final int SUBSCRIBED = 400;
 
     /**
      * Request removal of subscription to sender's presence.
      */
-    public static final int UNSUBSCRIBE  = 500;
+    public static final int UNSUBSCRIBE = 500;
 
     /**
      * Grant removal of subscription to sender's presence.
@@ -44,77 +44,79 @@
     /**
      * The presence packet contains an error message.
      */
-    public static final int ERROR        = 701;
+    public static final int ERROR = 701;
 
     /**
      * Get the presence type from a presence packet.
-     * 
-     * @param presence
-     *            the presence type
+     * @param presence the presence type
+     * @return an int representing the presence type
      */
     public static int getPresenceType(Presence presence) {
 	int res = PresenceType.ERROR;
 	switch (presence.getType()) {
-	case available:
-	    res = PresenceType.AVAILABLE;
-	    break;
-	case unavailable:
-	    res = PresenceType.UNAVAILABLE;
-	    break;
-	case subscribe:
-	    res = PresenceType.SUBSCRIBE;
-	    break;
-	case subscribed:
-	    res = PresenceType.SUBSCRIBED;
-	    break;
-	case unsubscribe:
-	    res = PresenceType.UNSUBSCRIBE;
-	    break;
-	case unsubscribed:
-	    res = PresenceType.UNSUBSCRIBED;
-	    break;
-	case error:
-	default:
-	    res = PresenceType.ERROR;
+	    case available:
+		res = PresenceType.AVAILABLE;
+		break;
+	    case unavailable:
+		res = PresenceType.UNAVAILABLE;
+		break;
+	    case subscribe:
+		res = PresenceType.SUBSCRIBE;
+		break;
+	    case subscribed:
+		res = PresenceType.SUBSCRIBED;
+		break;
+	    case unsubscribe:
+		res = PresenceType.UNSUBSCRIBE;
+		break;
+	    case unsubscribed:
+		res = PresenceType.UNSUBSCRIBED;
+		break;
+	    case error:
+	    default:
+		res = PresenceType.ERROR;
 	}
-	;
 	return res;
     }
 
     /**
-     * Get the smack presence mode for a status
-     * 
-     * @param status
-     *            the status in beem
+     * Get the smack presence mode for a status.
+     * @param type the status type in beem
      * @return the presence mode to use in presence packet or null if there is no mode to use
      */
     public static Presence.Type getPresenceTypeFrom(int type) {
 	Presence.Type res;
 	switch (type) {
-	case AVAILABLE:
-	    res = Presence.Type.available;
-	    break;
-	case UNAVAILABLE:
-	    res = Presence.Type.unavailable;
-	    break;
-	case SUBSCRIBE:
-	    res = Presence.Type.subscribe;
-	    break;
-	case SUBSCRIBED:
-	    res = Presence.Type.subscribed;
-	    break;
-	case UNSUBSCRIBE:
-	    res = Presence.Type.unsubscribe;
-	    break;
-	case UNSUBSCRIBED:
-	    res = Presence.Type.unsubscribed;
-	    break;
-	case ERROR:
-	    res = Presence.Type.error;
-	    break;
-	default:
-	    return null;
+	    case AVAILABLE:
+		res = Presence.Type.available;
+		break;
+	    case UNAVAILABLE:
+		res = Presence.Type.unavailable;
+		break;
+	    case SUBSCRIBE:
+		res = Presence.Type.subscribe;
+		break;
+	    case SUBSCRIBED:
+		res = Presence.Type.subscribed;
+		break;
+	    case UNSUBSCRIBE:
+		res = Presence.Type.unsubscribe;
+		break;
+	    case UNSUBSCRIBED:
+		res = Presence.Type.unsubscribed;
+		break;
+	    case ERROR:
+		res = Presence.Type.error;
+		break;
+	    default:
+		return null;
 	}
 	return res;
     }
+
+    /**
+     * Private default constructor
+     */
+    private PresenceType() {
+    }
 }
--- a/src/com/beem/project/beem/utils/Status.java	Sun Aug 09 23:23:28 2009 +0200
+++ b/src/com/beem/project/beem/utils/Status.java	Sun Aug 09 23:42:22 2009 +0200
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package com.beem.project.beem.utils;
 
@@ -7,34 +7,34 @@
 import org.jivesoftware.smack.packet.Presence.Mode;
 
 /**
- * @author caribou
+ * @author marseille
  */
 public class Status {
 
     /**
      * Status of a disconnected contact.
      */
-    public static final int CONTACT_STATUS_DISCONNECT         = 100;
+    public static final int CONTACT_STATUS_DISCONNECT = 100;
 
     /**
      * Status of a unavailable (long away) contact.
      */
-    public static final int CONTACT_STATUS_UNAVAILABLE        = 200;
+    public static final int CONTACT_STATUS_UNAVAILABLE = 200;
 
     /**
      * Status of a away contact.
      */
-    public static final int CONTACT_STATUS_AWAY               = 300;
+    public static final int CONTACT_STATUS_AWAY = 300;
 
     /**
      * Status of a busy contact.
      */
-    public static final int CONTACT_STATUS_BUSY               = 400;
+    public static final int CONTACT_STATUS_BUSY = 400;
 
     /**
      * Status of a available contact.
      */
-    public static final int CONTACT_STATUS_AVAILABLE          = 500;
+    public static final int CONTACT_STATUS_AVAILABLE = 500;
 
     /**
      * Status of a available for chat contact.
@@ -42,41 +42,38 @@
     public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600;
 
     /**
-     * Get the smack presence mode for a status
-     * 
-     * @param status
-     *            the status in beem
+     * Get the smack presence mode for a status.
+     * @param status the status in beem
      * @return the presence mode to use in presence packet or null if there is no mode to use
      */
     public static Presence.Mode getPresenceModeFromStatus(int status) {
 	Presence.Mode res;
 	switch (status) {
-	case CONTACT_STATUS_AVAILABLE:
-	    res = Presence.Mode.available;
-	    break;
-	case CONTACT_STATUS_AVAILABLE_FOR_CHAT:
-	    res = Presence.Mode.chat;
-	    break;
-	case CONTACT_STATUS_AWAY:
-	    res = Presence.Mode.away;
-	    break;
-	case CONTACT_STATUS_BUSY:
-	    res = Presence.Mode.dnd;
-	    break;
-	case CONTACT_STATUS_UNAVAILABLE:
-	    res = Presence.Mode.xa;
-	    break;
-	default:
-	    return null;
+	    case CONTACT_STATUS_AVAILABLE:
+		res = Presence.Mode.available;
+		break;
+	    case CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+		res = Presence.Mode.chat;
+		break;
+	    case CONTACT_STATUS_AWAY:
+		res = Presence.Mode.away;
+		break;
+	    case CONTACT_STATUS_BUSY:
+		res = Presence.Mode.dnd;
+		break;
+	    case CONTACT_STATUS_UNAVAILABLE:
+		res = Presence.Mode.xa;
+		break;
+	    default:
+		return null;
 	}
 	return res;
     }
 
     /**
      * Get the status of from a presence packet.
-     * 
-     * @param presence
-     *            the presence containing status
+     * @param presence the presence containing status
+     * @return an int representing the status
      */
     public static int getStatusFromPresence(Presence presence) {
 	int res = Status.CONTACT_STATUS_DISCONNECT;
@@ -88,28 +85,34 @@
 		res = Status.CONTACT_STATUS_AVAILABLE;
 	    } else {
 		switch (mode) {
-		case available:
-		    res = Status.CONTACT_STATUS_AVAILABLE;
-		    break;
-		case away:
-		    res = Status.CONTACT_STATUS_AWAY;
-		    break;
-		case chat:
-		    res = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
-		    break;
-		case dnd:
-		    res = Status.CONTACT_STATUS_BUSY;
-		    break;
-		case xa:
-		    res = Status.CONTACT_STATUS_UNAVAILABLE;
-		    break;
-		default:
-		    res = Status.CONTACT_STATUS_DISCONNECT;
-		    break;
+		    case available:
+			res = Status.CONTACT_STATUS_AVAILABLE;
+			break;
+		    case away:
+			res = Status.CONTACT_STATUS_AWAY;
+			break;
+		    case chat:
+			res = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+			break;
+		    case dnd:
+			res = Status.CONTACT_STATUS_BUSY;
+			break;
+		    case xa:
+			res = Status.CONTACT_STATUS_UNAVAILABLE;
+			break;
+		    default:
+			res = Status.CONTACT_STATUS_DISCONNECT;
+			break;
 		}
 	    }
 	}
 	return res;
     }
 
+    /**
+     * Default constructor masked
+     */
+    private Status() {
+    }
+
 }