Merge avec Nikita
authorDa Risk <darisk972@gmail.com>
Sat, 04 Apr 2009 19:02:11 +0200
changeset 68 0c76c67a2b99
parent 67 8c3870db8e31 (current diff)
parent 66 661aa8634e98 (diff)
child 69 cc06de2dfff0
child 72 cdedc3a25d39
Merge avec Nikita
res/layout/beem.xml
res/layout/beemdialogsettings.xml
res/menu/beemmenu.xml
src/com/beem/project/beem/BeemApplication.java
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/service/XmppFacade.java
src/com/beem/project/beem/ui/Beem.java
src/com/beem/project/beem/ui/BeemDialogSettings.java
src/com/beem/project/beem/ui/ContactList.java
--- a/AndroidManifest.xml	Fri Apr 03 14:18:10 2009 +0200
+++ b/AndroidManifest.xml	Sat Apr 04 19:02:11 2009 +0200
@@ -3,13 +3,12 @@
 	package="com.beem.project.beem" android:versionCode="1"
 	android:versionName="1.0">
 	<application android:label="@string/app_name" android:name="BeemApplication">
-		<activity android:name=".ui.Beem" android:label="@string/app_name">
+		<activity android:name=".ui.ContactList" android:label="@string/app_name">
 			<intent-filter>
 				<action android:name="android.intent.action.MAIN" />
 				<category android:name="android.intent.category.LAUNCHER" />
 			</intent-filter>
 		</activity>
-		<activity android:name=".ui.ContactList" android:label="@string/app_name" />
 		<activity android:name=".ui.SendIM" android:label="@string/app_name" />
 		<service android:name="BeemService" android:enabled="true"
 			android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
@@ -24,5 +23,5 @@
 	<uses-permission android:name="android.permission.INTERNET"></uses-permission>
 	<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-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"></uses-permission>
 </manifest> 
--- a/project.aidl	Fri Apr 03 14:18:10 2009 +0200
+++ b/project.aidl	Sat Apr 04 19:02:11 2009 +0200
@@ -3,5 +3,6 @@
 // action. Do not modify!
 
 parcelable com.beem.project.beem.BeemException
+parcelable com.beem.project.beem.service.Message
 parcelable com.beem.project.beem.service.Contact
-parcelable com.beem.project.beem.service.Message
+parcelable com.beem.project.beem.service.PresenceAdapter
Binary file res/drawable/away.png has changed
Binary file res/drawable/chat.png has changed
Binary file res/drawable/closed.png has changed
Binary file res/drawable/connecting.png has changed
Binary file res/drawable/dnd.png has changed
Binary file res/drawable/error.png has changed
Binary file res/drawable/invisible.png has changed
Binary file res/drawable/message.png has changed
Binary file res/drawable/not_in_the_roster.png has changed
Binary file res/drawable/offline.png has changed
Binary file res/drawable/online.png has changed
Binary file res/drawable/requested.png has changed
--- a/res/layout/beem.xml	Fri Apr 03 14:18:10 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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">
-
-	<ImageView android:id="@+id/logo"
-		android:src="@drawable/logo"
-		android:adjustViewBounds="true"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"/>
-		
-	<TextView android:text="@string/BeemJabberID"
-		android:textSize="25sp"
-		android:paddingLeft="100sp"
-		android:paddingTop="50sp"
-		android:paddingBottom="15sp"
-		android:layout_width="fill_parent"
-		android:layout_height="wrap_content" />
-		
-	<ImageView android:id="@+id/avatar"
-		android:src="@drawable/bart"
-		android:paddingTop="10sp"
-		android:paddingBottom="10sp"		
-		android:adjustViewBounds="true"
-		android:layout_width="fill_parent"
-		android:layout_height="wrap_content"/>
-		
-	<Button android:id="@+id/connection"
-		android:textSize="20sp"
-		android:singleLine="true"
-		android:layout_width="fill_parent"
-		android:layout_height="wrap_content"/>
-
-</LinearLayout>
--- a/res/layout/beemdialogsettings.xml	Fri Apr 03 14:18:10 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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"
-        >
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  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="Host/Port:"
-                android:minWidth="70dp"
-                />
-                
-        <EditText android:id="@+id/host"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:capitalize="none"
-                  android:minWidth="150dp"
-                  android:scrollHorizontally="true"/>
-        <EditText android:id="@+id/port"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:minWidth="80dp"
-                  android:capitalize="none"
-                  android:scrollHorizontally="true"/>
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  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="Userid:"
-                android:minWidth="70dp"
-                />
-        <EditText android:id="@+id/userid"
-                  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 xmlns:android="http://schemas.android.com/apk/res/android"
-                  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="Password:"
-                android:minWidth="70dp"
-                />
-        <EditText android:id="@+id/password"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:password="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:minWidth="250dp"
-                  android:capitalize="none"
-                  android:scrollHorizontally="true"/>
-    </LinearLayout>
-
-    <Button android:id="@+id/ok"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:text="OK">
-        <requestFocus/>
-    </Button>
-</LinearLayout>
\ No newline at end of file
--- a/res/layout/contactlistcontact.xml	Fri Apr 03 14:18:10 2009 +0200
+++ b/res/layout/contactlistcontact.xml	Sat Apr 04 19:02:11 2009 +0200
@@ -2,25 +2,34 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="horizontal"
         android:layout_width="fill_parent"
-        android:layout_height="50sp" 
+        android:layout_height="wrap_content" 
         android:gravity="center_vertical" >
 
-        <ImageView android:id="@+id/avatar"
-        	android:layout_width="70px"
-            android:layout_height="40sp" />
+        <ImageView android:id="@+id/contactliststatus"
+        android:layout_weight="5"
+        	android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical" />
+
 		<LinearLayout
 			android:orientation="vertical"
+			android:layout_weight="1"
         	android:layout_width="fill_parent"
-        	android:layout_height="40sp">
-        		
-        	<TextView android:id="@+id/textchild1"
+        	android:layout_height="wrap_content" >
+        	<TextView android:id="@+id/contactlistpseudo"
+				android:layout_width="fill_parent"
+            	android:layout_height="wrap_content"            	
+            	android:paddingLeft="20sp" />
+			<TextView android:id="@+id/contactlistmsgperso"
 				android:layout_width="fill_parent"
             	android:layout_height="wrap_content"
             	android:paddingLeft="20sp" />
-
-        	<TextView android:id="@+id/textchild2"
-				android:layout_width="fill_parent"
-            	android:layout_height="wrap_content" />
 		</LinearLayout>
 
+        <ImageView android:id="@+id/contactlistavatar"
+        	android:layout_weight="5"
+        	android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical" />
+            
 </LinearLayout> 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlistdialogsettings.xml	Sat Apr 04 19:02:11 2009 +0200
@@ -0,0 +1,89 @@
+<?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"
+        >
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  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="Host/Port:"
+                android:minWidth="70dp"
+                />
+                
+        <EditText android:id="@+id/host"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:capitalize="none"
+                  android:minWidth="150dp"
+                  android:scrollHorizontally="true"/>
+        <EditText android:id="@+id/port"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:minWidth="80dp"
+                  android:capitalize="none"
+                  android:scrollHorizontally="true"/>
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  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="Userid:"
+                android:minWidth="70dp"
+                />
+        <EditText android:id="@+id/userid"
+                  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 xmlns:android="http://schemas.android.com/apk/res/android"
+                  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="Password:"
+                android:minWidth="70dp"
+                />
+        <EditText android:id="@+id/password"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:password="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:minWidth="250dp"
+                  android:capitalize="none"
+                  android:scrollHorizontally="true"/>
+    </LinearLayout>
+
+    <Button android:id="@+id/ok"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:text="OK">
+        <requestFocus/>
+    </Button>
+</LinearLayout>
\ No newline at end of file
--- a/res/menu/beemmenu.xml	Fri Apr 03 14:18:10 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-	<item android:title="Creer ou Editer un compte" android:id="@+id/account_edit"/>
-	<item android:title="L'equipe Beem" android:id="@+id/account_about"/>
-</menu>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/menu/contactlistmenu.xml	Sat Apr 04 19:02:11 2009 +0200
@@ -0,0 +1,4 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+	<item android:title="Creer ou Editer un compte" android:id="@+id/account_edit"/>
+	<item android:title="L'equipe Beem" android:id="@+id/account_about"/>
+</menu>
--- a/res/values/strings.xml	Fri Apr 03 14:18:10 2009 +0200
+++ b/res/values/strings.xml	Sat Apr 04 19:02:11 2009 +0200
@@ -3,7 +3,7 @@
 	<string name="app_name">Beem</string>
 
 	<!--  Beem class -->
-	<string name="BeemCreateAccount">Creer un compte</string>
+	
 	<string name="BeemJabberID">Jabber ID</string>
 	
 	<!--  BeemService class -->
@@ -13,9 +13,9 @@
 
 	<!--  Preferences informations -->
 	<string name="PreferenceFileName">Beem</string>
-	<string name="PreferenceLoginKey">login</string>
+	
 	<string name="PreferenceHostKey">host</string>
-	<string name="PreferencePasswordKey">password</string>
+	<string name="PreferenceJID">Jabber ID</string><string name="PreferenceLoginKey">login</string><string name="PreferencePasswordKey">password</string>
 	<string name="PreferencePortKey">port</string>
 
 	<!--  SendIM class -->
@@ -24,4 +24,5 @@
 	<string name="SendIMState">Is : </string>
 	<string name="SendIMFrom">and is speaking from : </string>
 	<string name="SendIMSmiley">Insert a smiley</string>
+
 </resources>
--- a/src/com/beem/project/beem/BeemApplication.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java	Sat Apr 04 19:02:11 2009 +0200
@@ -132,9 +132,14 @@
      * Stop the Beem service.
      */
     public synchronized void stopBeemService() {
-	Intent intent = new Intent(this, BeemService.class);
-	mApplicationContext.unbindService(mServConn);
-	mApplicationContext.stopService(intent);
+	if (mIsConnected) {
+	    Intent intent = new Intent();
+	    intent.setComponent(new ComponentName("com.beem.project.beem",
+		    "com.beem.project.beem.BeemService"));
+	    mApplicationContext.unbindService(mServConn);
+	    mApplicationContext.stopService(intent);
+	    mIsConnected = false;
+	}
     }
 
     /**
@@ -145,6 +150,7 @@
 	return mFacade;
     }
 
+
     /**
      * Add a methode to execute when the application is connected to the Beem service.
      * @param target	the handler which will execute the callback
@@ -161,4 +167,12 @@
 	    }
 	}
     }
+
+    /**
+     * Indique si on est connecte au service.
+     */
+    public boolean isConnected() {
+	return mIsConnected;
+    }
+
 }
--- a/src/com/beem/project/beem/jingle/RTPReceiver.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/jingle/RTPReceiver.java	Sat Apr 04 19:02:11 2009 +0200
@@ -56,7 +56,7 @@
 
 	@Override
 	public void receiveData(DataFrame frame, Participant participant) {
-		byte[] data = frame.getConcatenatedData();		
+		//byte[] data = frame.getConcatenatedData();		
 	}
 
 	@Override
--- a/src/com/beem/project/beem/jingle/Receiver.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/jingle/Receiver.java	Sat Apr 04 19:02:11 2009 +0200
@@ -2,10 +2,8 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import org.jivesoftware.smack.ConnectionConfiguration;
 import org.jivesoftware.smack.XMPPConnection;
@@ -53,8 +51,8 @@
 	    // Le client demande les services dispo en face a son roster
 	    // il doit en suite fournir lui meme une liste de feature
 	    
-	    DiscoverInfo di = sdm.discoverInfo("test@nikita-rack/pidgin");
-	    DiscoverInfo di2 = sdm.discoverInfo("nikita@nikita-rack/Telepathy");
+	    //DiscoverInfo di = sdm.discoverInfo("test@nikita-rack/pidgin");
+	    //DiscoverInfo di2 = sdm.discoverInfo("nikita@nikita-rack/Telepathy");
 
 	} catch (XMPPException e) {
 	    // TODO Auto-generated catch block
@@ -76,20 +74,16 @@
 		System.out.println("Jingle Session request from "+request.getFrom());
 		try {
 		    in = request.accept();
-		    // TODO configure in
 		    in.addListener(new JingleSessionListener() {
 
 			@Override
 			public void sessionRedirected(String redirection,
 			    JingleSession jingleSession) {
-			    // TODO Auto-generated method stub
-
 			}
 
 			@Override
 			public void sessionMediaReceived(JingleSession jingleSession,
 			    String participant) {
-			    // TODO Auto-generated method stub
 			    System.out.println("Session Media received from " + participant);
 			}
 
@@ -97,7 +91,6 @@
 			public void sessionEstablished(PayloadType pt,
 			    TransportCandidate remoteCandidate,
 			    TransportCandidate localCandidate, JingleSession jingleSession) {
-			    // TODO Auto-generated method stub
 			    System.out.println("Session established");
 			    try{
 				System.out.println("Je recois sur " + remoteCandidate.getIp() + ":" + remoteCandidate.getPort() );
@@ -123,13 +116,11 @@
 
 			@Override
 			public void sessionClosed(String reason, JingleSession jingleSession) {
-			    // TODO Auto-generated method stub
 			    System.out.println("Session "+ jingleSession.getResponder() +"closedd because "+ reason);
 			}
 		    });
 		    in.startIncoming();
 		} catch (XMPPException e) {
-		    // TODO Auto-generated catch block
 		    e.printStackTrace();
 		}
 	    }
@@ -161,7 +152,6 @@
      * @throws InterruptedException 
      */
     public static void main(String[] args) throws InterruptedException {
-	// TODO Auto-generated method stub
 	Receiver rec = new Receiver("test2", "test2");
 	System.out.println("Receiver initialized");
 
--- a/src/com/beem/project/beem/provider/BeemDatabaseHelper.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/provider/BeemDatabaseHelper.java	Sat Apr 04 19:02:11 2009 +0200
@@ -23,6 +23,7 @@
 	public void onCreate(SQLiteDatabase db) {
 		db.execSQL(this.creationQuery);
 	}
+	
 
 	@Override
 	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
--- a/src/com/beem/project/beem/provider/ContactProvider.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/provider/ContactProvider.java	Sat Apr 04 19:02:11 2009 +0200
@@ -9,7 +9,6 @@
 import android.content.ContentUris;
 import android.content.ContentValues;
 import android.content.UriMatcher;
-import android.content.res.Resources;
 import android.database.Cursor;
 import android.database.SQLException;
 import android.database.sqlite.SQLiteDatabase;
--- a/src/com/beem/project/beem/service/Contact.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java	Sat Apr 04 19:02:11 2009 +0200
@@ -3,8 +3,13 @@
  */
 package com.beem.project.beem.service;
 
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Mode;
+
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.util.Log;
 
 /**
  * This class contains informations on a jabber contact.
@@ -12,140 +17,179 @@
  */
 public class Contact implements Parcelable {
 
-    public static final int CONTACT_STATUS_DISCONNECT = 100;
-    public static final int CONTACT_STATUS_UNAVAILABLE = 200;
-    public static final int CONTACT_STATUS_AWAY = 300;
-    public static final int CONTACT_STATUS_BUSY = 400;
-    public static final int CONTACT_STATUS_AVAILABLE = 500;
-    public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600;
-    
-    
-    /**
-     * Parcelable.Creator needs by Android.
-     */
-    public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
+	public static final int CONTACT_STATUS_DISCONNECT = 100;
+	public static final int CONTACT_STATUS_UNAVAILABLE = 200;
+	public static final int CONTACT_STATUS_AWAY = 300;
+	public static final int CONTACT_STATUS_BUSY = 400;
+	public static final int CONTACT_STATUS_AVAILABLE = 500;
+	public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600;
+
+
+	/**
+	 * Parcelable.Creator needs by Android.
+	 */
+	public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
+
+		@Override
+		public Contact createFromParcel(Parcel source) {
+			return new Contact(source);
+		}
+
+		@Override
+		public Contact[] newArray(int size) {
+			return new Contact[size];
+		}
+	};
+	private static final String TAG = "Contact";
+
+	private String mJID;
+	private int mID;
+	private int mStatus;
+
+	/**
+	 * @return the mID
+	 */
+	public int getID() {
+		return mID;
+	}
 
-	@Override
-	public Contact createFromParcel(Parcel source) {
-	    return new Contact(source);
+	/**
+	 * @param mid the mID to set
+	 */
+	public void setID(int mid) {
+		mID = mid;
+	}
+
+	/**
+	 * @return the mStatus
+	 */
+	public int getStatus() {
+		return mStatus;
+	}
+
+	/**
+	 * @param status the mStatus to set
+	 */
+	public void setStatus(int status) {
+		mStatus = status;
+	}
+
+	/**
+	 * @return the mMsgState
+	 */
+	public String getMMsgState() {
+		return mMsgState;
+	}
+
+	/**
+	 * @param msgState the mMsgState to set
+	 */
+	public void setMMsgState(String msgState) {
+		mMsgState = msgState;
+	}
+
+	private String mMsgState;
+
+	/**
+	 * Constructor.
+	 */
+	public Contact() {
+		// TODO Auto-generated constructor stub
 	}
 
-	@Override
-	public Contact[] newArray(int size) {
-	    return new Contact[size];
+	/**
+	 * Constructor.
+	 * @param jid JID of the contact
+	 */
+	public Contact(final String jid) {
+		mJID = jid;
 	}
-    };
-
-    private String mJID;
-    private int mID;
-    private int mStatus;
 
-    /**
-     * @return the mID
-     */
-    public int getID() {
-        return mID;
-    }
-
-    /**
-     * @param mid the mID to set
-     */
-    public void setID(int mid) {
-        mID = mid;
-    }
+	public Contact(RosterEntry entry, Presence presence) {
+		mJID = entry.getUser();
+		Log.w(TAG, "Contact Name: " + entry.getUser());
+		if (presence.getType().equals(Presence.Type.unavailable)) {
+			mStatus = Contact.CONTACT_STATUS_DISCONNECT;
+			Log.w(TAG, "Error while creating Contact");
+		} else {
+			setStatus(presence.getMode());
+		}
+	}
 
-    /**
-     * @return the mStatus
-     */
-    public int getStatus() {
-        return mStatus;
-    }
-
-    /**
-     * @param status the mStatus to set
-     */
-    public void setStatus(int status) {
-        mStatus = status;
-    }
-
-    /**
-     * @return the mMsgState
-     */
-    public String getMMsgState() {
-        return mMsgState;
-    }
-
-    /**
-     * @param msgState the mMsgState to set
-     */
-    public void setMMsgState(String msgState) {
-        mMsgState = msgState;
-    }
-
-    private String mMsgState;
+	/**
+	 * @param status the XMPP presence mode
+	 */
+	public void setStatus(Mode mode) {	
+		switch (mode) {
+		case available:
+			mStatus = Contact.CONTACT_STATUS_AVAILABLE;
+			break;
+		case away:
+			mStatus = Contact.CONTACT_STATUS_AWAY;
+			break;
+		case chat:
+			mStatus = Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+			break;
+		case dnd:
+			mStatus = Contact.CONTACT_STATUS_BUSY;
+			break;
+		case xa:
+			mStatus = Contact.CONTACT_STATUS_UNAVAILABLE;
+			break;
+		default:
+			Log.e("RosterAdapter", "Status mode non gere");
+		mStatus = Contact.CONTACT_STATUS_DISCONNECT;
+		break;
+		}
+	}
 
-    /**
-     * Constructor.
-     */
-    public Contact() {
-	// TODO Auto-generated constructor stub
-    }
+	/**
+	 * Construct a contact from a parcel.
+	 * @param in parcel to use for construction
+	 */
+	private Contact(final Parcel in) {
+		mID = in.readInt();
+		mStatus = in.readInt();
+		mJID = in.readString();
+		mMsgState = in.readString();
+	}
 
-    /**
-     * Constructor.
-     * @param jid JID of the contact
-     */
-    public Contact(final String jid) {
-	mJID = jid;
-    }
-
-    /**
-     * Construct a contact from a parcel.
-     * @param in parcel to use for construction
-     */
-    private Contact(final Parcel in) {
-	mID = in.readInt();
-	mStatus = in.readInt();
-	mJID = in.readString();
-	mMsgState = in.readString();
-    }
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public void writeToParcel(Parcel dest, int flags) {
+		// TODO Auto-generated method stub
+		dest.writeInt(mID);
+		dest.writeInt(mStatus);
+		dest.writeString(mJID);
+		dest.writeString(mMsgState);
+	}
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-	// TODO Auto-generated method stub
-	dest.writeInt(mID);
-	dest.writeInt(mStatus);
-	dest.writeString(mJID);
-	dest.writeString(mMsgState);
-    }
+	/**
+	 * Get the Jabber ID of the contact.
+	 * @return the Jabber ID
+	 */
+	public String getJID() {
+		return mJID;
+	}
 
-    /**
-     * Get the Jabber ID of the contact.
-     * @return the Jabber ID
-     */
-    public String getJID() {
-	return mJID;
-    }
+	/**
+	 * Set the Jabber ID of the contact.
+	 * @param mjid	the jabber ID to set
+	 */
+	public void setJID(String mjid) {
+		mJID = mjid;
+	}
 
-    /**
-     * Set the Jabber ID of the contact.
-     * @param mjid	the jabber ID to set
-     */
-    public void setJID(String mjid) {
-	mJID = mjid;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int describeContents() {
-	// TODO Auto-generated method stub
-	return 0;
-    }
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public int describeContents() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
 
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/PresenceAdapter.java	Sat Apr 04 19:02:11 2009 +0200
@@ -0,0 +1,54 @@
+package com.beem.project.beem.service;
+
+import org.jivesoftware.smack.packet.Presence;
+
+import android.os.IBinder;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class PresenceAdapter implements  Parcelable {
+	
+	private Presence mPresence;
+	
+	/**
+	 * Parcelable.Creator needs by Android.
+	 */
+	public static final Parcelable.Creator<PresenceAdapter> CREATOR = new Parcelable.Creator<PresenceAdapter>() {
+
+		@Override
+		public PresenceAdapter createFromParcel(Parcel source) {
+			return new PresenceAdapter(source);
+		}
+
+		@Override
+		public PresenceAdapter[] newArray(int size) {
+			return new PresenceAdapter[size];
+		}
+	};
+	
+	public PresenceAdapter(Presence presence) {
+		mPresence = presence;
+	}
+	
+	
+	public PresenceAdapter(Parcel source) {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public int describeContents() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public void writeToParcel(Parcel dest, int flags) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public IBinder asBinder() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Sat Apr 04 19:02:11 2009 +0200
@@ -16,6 +16,9 @@
 import org.jivesoftware.smack.XMPPException;
 import org.jivesoftware.smack.packet.Presence;
 
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
+
+import android.os.RemoteCallbackList;
 import android.os.RemoteException;
 import android.util.Log;
 
@@ -25,143 +28,208 @@
  */
 public class RosterAdapter extends com.beem.project.beem.service.aidl.IRoster.Stub {
 
-    private Roster mAdaptee;
-    private Map<String, Contact> mContacts = new HashMap<String, Contact>();
-    private RosterListener mRosterListener = new RosterListener() {
+	private static final String TAG = "RosterAdapter";
+	private Roster mAdaptee;
+	private RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners = 
+		new RemoteCallbackList<IBeemRosterListener>();
+	private Map<String, Contact> mContacts = new HashMap<String, Contact>();
+	
+	private RosterListenerAdapter mRosterListener = new RosterListenerAdapter();
+	
+	/**
+	 * Constructor.
+	 * @param roster the roster to adapt
+	 */
+	public RosterAdapter(final Roster roster) {
+		mAdaptee = roster;
+		roster.addRosterListener(mRosterListener);
+		for (RosterEntry entry : roster.getEntries()) {
+			String user = entry.getUser();
+			if ( !mContacts.containsKey(user))
+				mContacts.put(user, new Contact(entry, roster.getPresence(user)));
+		}
+	}
 
 	@Override
-	public void presenceChanged(Presence presence) {
-	    String user = presence.getFrom();
-	    Presence bestPresence = mAdaptee.getPresence(user);
-	    Contact c = mContacts.get(user);
-	    if (c == null) {
-		c = new Contact(user);
-		mContacts.put(user, c);
-	    }
-	    int status;
-	    if (bestPresence.getType().equals(Presence.Type.unavailable))
-		status = Contact.CONTACT_STATUS_DISCONNECT;
-	    else {
-		switch (bestPresence.getMode()) {
-		    case available:
-			status = Contact.CONTACT_STATUS_AVAILABLE;
-			break;
-		    case away:
-			status = Contact.CONTACT_STATUS_AWAY;
-			break;
-		    case chat:
-			status = Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
-			break;
-		    case dnd:
-			status = Contact.CONTACT_STATUS_BUSY;
-			break;
-		    case xa:
-			status = Contact.CONTACT_STATUS_UNAVAILABLE;
-			break;
-		    default:
-			Log.e("RosterAdapter", "Status mode non gere");
-			status = Contact.CONTACT_STATUS_DISCONNECT;
-			break;
-		}
-	    }
-	    c.setStatus(status);
+	public void createGroup(String groupname) throws RemoteException {
+		mAdaptee.createGroup(groupname);
 	}
 
 	@Override
-	public void entriesUpdated(Collection<String> arg0) {
-	    // TODO Auto-generated method stub
+	public Contact addContact(String user, String name, String[] groups) throws RemoteException {
+		try {
+			mAdaptee.createEntry(user, name, groups);
+			Contact res = new Contact(user);
+			mContacts.put(user, res);
+			return res;
+		} catch (XMPPException e) {
+			return null;
+		}
+	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public void deleteContact(Contact contact) throws RemoteException {
+		mContacts.remove(contact.getJID());
+	}
+	
+	@Override
+	public void addConnectionListener(IBeemRosterListener listen) throws RemoteException {
+		if (listen != null)
+			mRemoteRosListeners.register(listen);
 	}
 
 	@Override
-	public void entriesDeleted(Collection<String> arg0) {
-	    // TODO Auto-generated method stub
-
+	public void removeConnectionListener(IBeemRosterListener listen) throws RemoteException {
+		if (listen != null)
+			mRemoteRosListeners.unregister(listen);
 	}
 
 	@Override
-	public void entriesAdded(Collection<String> arg0) {
-	    // TODO Auto-generated method stub
+	public Contact getContact(String jid) throws RemoteException {
+		return mContacts.get(jid);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public List<Contact> getContactList() throws RemoteException {
+		List<Contact> res = new ArrayList<Contact>();
+		res.addAll(mContacts.values());
+		return res;
+	}
+
+	private class RosterListenerAdapter implements RosterListener {
+
+		@Override
+		public void entriesAdded(Collection<String> addresses) {
+			final int n = mRemoteRosListeners.beginBroadcast();
+
+			List<String> tab = new ArrayList<String>();
+			for (int i = 0; i < n; i++) {
+				IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+				try {
+					tab.addAll(addresses);
+					listener.onEntriesAdded(tab);
+				} catch (RemoteException e) {
+					// The RemoteCallbackList will take care of removing the
+					// dead listeners.
+					Log.w(TAG, "Error while adding roster entries", e);
+				}
+			}
+			mRemoteRosListeners.finishBroadcast();
+
+		}
+
+		@Override
+		public void entriesDeleted(Collection<String> addresses) {
+			final int n = mRemoteRosListeners.beginBroadcast();
+
+			List<String> tab = new ArrayList<String>();
+			for (int i = 0; i < n; i++) {
+				IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+				try {
+					tab.addAll(addresses);
+					listener.onEntriesDeleted(tab);
+				} catch (RemoteException e) {
+					// The RemoteCallbackList will take care of removing the
+					// dead listeners.
+					Log.w(TAG, "Error while deleting roster entries", e);
+				}
+			}
+			mRemoteRosListeners.finishBroadcast();			
+		}
+
+		@Override
+		public void entriesUpdated(Collection<String> addresses) {
+			final int n = mRemoteRosListeners.beginBroadcast();
+
+			List<String> tab = new ArrayList<String>();
+			for (int i = 0; i < n; i++) {
+				IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+				try {
+					tab.addAll(addresses);
+					listener.onEntriesUpdated(tab);
+				} catch (RemoteException e) {
+					// The RemoteCallbackList will take care of removing the
+					// dead listeners.
+					Log.w(TAG, "Error while updating roster entries", e);
+				}
+			}
+			mRemoteRosListeners.finishBroadcast();			
+		}
+
+		@Override
+		public void presenceChanged(Presence presence) {
+			Log.w(TAG, "Changement de Presence");
+			/* gestion du roster coter service */
+			String user = presence.getFrom();
+			//Presence bestPresence = mAdaptee.getPresence(user);
+			Contact c = mContacts.get(user);
+			if (c == null) {
+				c = new Contact(user);
+				mContacts.put(user, c);
+			}
+			int status;
+			if (presence.getType().equals(Presence.Type.unavailable))
+				status = Contact.CONTACT_STATUS_DISCONNECT;
+			else {
+				switch (presence.getMode()) {
+				case available:
+					status = Contact.CONTACT_STATUS_AVAILABLE;
+					break;
+				case away:
+					status = Contact.CONTACT_STATUS_AWAY;
+					break;
+				case chat:
+					status = Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+					break;
+				case dnd:
+					status = Contact.CONTACT_STATUS_BUSY;
+					break;
+				case xa:
+					status = Contact.CONTACT_STATUS_UNAVAILABLE;
+					break;
+				default:
+					Log.e("RosterAdapter", "Status mode non gere");
+				status = Contact.CONTACT_STATUS_DISCONNECT;
+				break;
+				}
+			}
+			c.setStatus(status);			
+			
+			/* redispatch vers les IBeemRosterListener */
+			final int n = mRemoteRosListeners.beginBroadcast();
+			
+			for (int i = 0; i < n; i++) {
+				IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+				try {
+					listener.onPresenceChanged(new PresenceAdapter(presence));
+				} catch (RemoteException e) {
+					// The RemoteCallbackList will take care of removing the
+					// dead listeners.
+					Log.w(TAG, "Error while updating roster entries", e);
+				}
+			}
+			mRemoteRosListeners.finishBroadcast();			
+		}    	
 
 	}
-    };
 
-    /**
-     * Constructor.
-     * @param roster the roster to adapt
-     */
-    public RosterAdapter(final Roster roster) {
-	mAdaptee = roster;
-	roster.addRosterListener(mRosterListener);
-	for (RosterEntry entry : roster.getEntries()) {
-	    String user = entry.getUser();
-	    if ( !mContacts.containsKey(user))
-		mContacts.put(user, new Contact(user));
-	}
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void createGroup(String groupname) throws RemoteException {
-	// TODO Auto-generated method stub
-	mAdaptee.createGroup(groupname);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Contact addContact(String user, String name, String[] groups) throws RemoteException {
-	try {
-	    mAdaptee.createEntry(user, name, groups);
-	    Contact res = new Contact(user);
-	    mContacts.put(user, res);
-	    return res;
-	} catch (XMPPException e) {
-	    return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public List<String> getGroupsNames() throws RemoteException {
+		Collection<RosterGroup> groups = mAdaptee.getGroups();
+		ArrayList<String> result = new ArrayList<String>(groups.size());
+		for (RosterGroup rosterGroup : groups) {
+			result.add(rosterGroup.getName());
+		}
+		return result;
 	}
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void deleteContact(Contact contact) throws RemoteException {
-	// TODO Auto-generated method stub
-
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Contact getContact(String jid) throws RemoteException {
-	return mContacts.get(jid);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<Contact> getContactList() throws RemoteException {
-	List<Contact> res = new ArrayList<Contact>();
-	res.addAll(mContacts.values());
-	return res;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<String> getGroupsNames() throws RemoteException {
-	Collection<RosterGroup> groups = mAdaptee.getGroups();
-	ArrayList<String> result = new ArrayList<String>(groups.size());
-	for (RosterGroup rosterGroup : groups) {
-	    result.add(rosterGroup.getName());
-	}
-	return result;
-    }
 
 }
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Sat Apr 04 19:02:11 2009 +0200
@@ -28,13 +28,12 @@
     private static final String TAG = "XMPPConnectionAdapter";
     private XMPPConnection mAdaptee;
     private IChatManager mChatManager;
-    private BeemException mLastException;
     private String mLogin;
     private String mPassword;
     private RosterAdapter mRoster;
+    private Object mLastException;
 
-    private RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners =
-	new RemoteCallbackList<IBeemConnectionListener>();
+    private RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners = new RemoteCallbackList<IBeemConnectionListener>();
     private ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
 
     /**
@@ -150,7 +149,7 @@
 	if (listen != null)
 	    mRemoteConnListeners.unregister(listen);
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -167,8 +166,18 @@
     }
 
     /**
-     * Listener for XMPP connection events.
-     * It will calls the remote listeners for connexion events.
+     * enregistre les features dispo dans notre version Liste de features que Telepathy supporte.
+     */
+    private void initFeatures() {
+	JingleManager.setJingleServiceEnabled();
+	ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
+	sdm.addFeature("http://jabber.org/protocol/disco#info");
+	// sdm.addFeature("http://jabber.org/protocol/nick");
+
+    }
+
+    /**
+     * Listener for XMPP connection events. It will calls the remote listeners for connexion events.
      * @author darisk
      */
     private class ConnexionListenerAdapter implements ConnectionListener {
@@ -300,33 +309,8 @@
 
     }
 
-    /**
-     * enregistre les features dispo dans notre version Liste de features que Telepathy supporte.
-     * "http://www.google.com/xmpp/protocol/session" "http://www.google.com/transport/p2p"
-     * "http://jabber.org/protocol/jingle" "http://jabber.org/protocol/chatstates" "http://jabber.org/protocol/nick"
-     * "http://jabber.org/protocol/nick+notify" "http://jabber.org/protocol/si" "ttp://jabber.org/protocol/ibb"
-     * "ttp://telepathy.freedesktop.org/xmpp/tubes" "http://www.google.com/xmpp/protocol/voice/v1"
-     * "http://jabber.org/protocol/jingle/description/audio" "http://jabber.org/protocol/jingle/description/video" Liste
-     * de features que pidgin `supporte' (on notera la cradence de l'annonce): "jabber:iq:last" "jabber:iq:oob"
-     * "jabber:iq:time" "jabber:iq:version" "jabber:x:conference" "urn:xmpp:attention:0" "urn:xmpp:bob" "urn:xmpp:ping"
-     * "xmpp:urn:time" "http://jabber.org/protocol/bytestreams" "http://jabber.org/protocol/disco#info"
-     * "http://jabber.org/protocol/disco#items" "http://jabber.org/protocol/ibb" "http://jabber.org/protocol/muc"
-     * "http://jabber.org/protocol/muc#user" "http://jabber.org/protocol/si"
-     * "http://jabber.org/protocol/si/profile/file-transfer" "http://jabber.org/protocol/xhtml-im"
-     * "http://www.xmpp.org/extensions/xep-0199.html#ns" "http://jabber.org/protocol/mood"
-     * "http://jabber.org/protocol/mood+notify" "http://jabber.org/protocol/nick"
-     * "http://jabber.org/protocol/nick+notify" "http://jabber.org/protocol/tune"
-     * "http://jabber.org/protocol/tune+notify" "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata"
-     * "http://www.xmpp.org/extensions/xep-0084.html#ns-data"
-     * "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata+notify"
-     * "http://www.xmpp.org/extensions/xep-0167.html#ns" << Jingle RTP Sessions
-     */
-    private void initFeatures() {
-	JingleManager.setJingleServiceEnabled();
-	ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
-	sdm.addFeature("http://jabber.org/protocol/disco#info");
-	// sdm.addFeature("http://jabber.org/protocol/nick");
-
+    public boolean isAuthentificated() throws RemoteException {
+	return mAdaptee.isAuthenticated();
     }
 
 }
--- a/src/com/beem/project/beem/service/XmppFacade.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java	Sat Apr 04 19:02:11 2009 +0200
@@ -27,7 +27,6 @@
      */
     @Override
     public void connectAsync() throws RemoteException {
-	// TODO Auto-generated method stub
 	mConnexion.connectAsync();
     }
 
@@ -36,7 +35,6 @@
      */
     @Override
     public void connectSync() throws RemoteException {
-	// TODO Auto-generated method stub
 	mConnexion.connectSync();
     }
 
@@ -45,7 +43,6 @@
      */
     @Override
     public IXmppConnection createConnection() throws RemoteException {
-	// TODO Auto-generated method stub
 	return mConnexion;
     }
 
@@ -54,7 +51,6 @@
      */
     @Override
     public void disconnect() throws RemoteException {
-	// TODO Auto-generated method stub
 	mConnexion.disconnect();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl	Sat Apr 04 19:02:11 2009 +0200
@@ -0,0 +1,10 @@
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.PresenceAdapter;
+
+interface IBeemRosterListener {
+    void onEntriesAdded(in List<String> addresses);
+    void onEntriesUpdated(in List<String> addresses);
+    void onEntriesDeleted(in List<String> addresses);
+    void onPresenceChanged(in PresenceAdapter presence);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IContact.aidl	Sat Apr 04 19:02:11 2009 +0200
@@ -0,0 +1,9 @@
+package com.beem.project.beem.service.aidl;
+
+interface IContact {
+
+	String getJID();
+	
+	void setJID(String mjid);
+
+}
\ No newline at end of file
--- a/src/com/beem/project/beem/service/aidl/IRoster.aidl	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IRoster.aidl	Sat Apr 04 19:02:11 2009 +0200
@@ -1,5 +1,6 @@
 package com.beem.project.beem.service.aidl;
 
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
 import com.beem.project.beem.service.Contact;
 
 interface IRoster {
@@ -15,5 +16,8 @@
     List<Contact> getContactList(); 
     
     List<String> getGroupsNames();
+    
+    void addConnectionListener(in IBeemRosterListener listen);
+    void removeConnectionListener(in IBeemRosterListener listen);
 
 }
\ No newline at end of file
--- a/src/com/beem/project/beem/service/aidl/IXmppConnection.aidl	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IXmppConnection.aidl	Sat Apr 04 19:02:11 2009 +0200
@@ -17,5 +17,7 @@
     void addConnectionListener(in IBeemConnectionListener listen);
     void removeConnectionListener(in IBeemConnectionListener listen);
     
+    boolean isAuthentificated();
+    
     IChatManager getChatManager();
 }
\ No newline at end of file
--- a/src/com/beem/project/beem/ui/Beem.java	Fri Apr 03 14:18:10 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-package com.beem.project.beem.ui;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-
-/**
- * La principale activite to be continuous.
- */
-public class Beem extends Activity {
-
-    private SharedPreferences mSettings;
-    private BeemDialogSettings mDialog;
-    private Button mButton;
-    private Handler mHandler;
-    private BeemApplication mBeemApplication;
-
-    /**
-     * Default constructor.
-     */
-    public Beem() {
-	super();
-	mHandler = new Handler();
-    }
-
-    /**
-     * Called when the activity is first created.
-     * @param savedInstanceState
-     *            previous state.
-     */
-    @Override
-    public final void onCreate(Bundle savedInstanceState) {
-	super.onCreate(savedInstanceState);
-	mBeemApplication = BeemApplication.getApplication(this);
-	setContentView(R.layout.beem);
-	mSettings = getSharedPreferences(
-		getString(R.string.PreferenceFileName), MODE_PRIVATE);
-	mDialog = new BeemDialogSettings(this, mSettings);
-
-	mButton = (Button) findViewById(R.id.connection);
-	mButton.setOnClickListener(new OnClickListener() {
-	    @Override
-	    public void onClick(View v) {
-		if (mButton.getText() == getString(R.string.BeemCreateAccount))
-		    mDialog.show();
-		else
-		    startActivity(new Intent(Beem.this, ContactList.class));	    
-	    }
-	});
-	showJID();
-    }
-
-    /**
-     * Callback for menu creation.
-     * @param menu
-     *            the menu created
-     * @return true on success, false otherwise
-     */
-    @Override
-    public final boolean onCreateOptionsMenu(Menu menu) {
-	super.onCreateOptionsMenu(menu);
-	MenuInflater inflater = getMenuInflater();
-	inflater.inflate(R.menu.beemmenu, menu);
-	return true;
-    }
-
-    /**
-     * Callback for menu item selected.
-     * @param item
-     *            the item selected
-     * @return true on success, false otherwise
-     */
-    @Override
-    public final boolean onOptionsItemSelected(MenuItem item) {
-	switch (item.getItemId()) {
-	    case R.id.account_edit:
-		mDialog.show();
-		return true;
-	    case R.id.account_about:
-		return true;
-	    default:
-		return false;
-	}
-    }
-
-    /**
-     * Show jabber id in button.
-     */
-    public final void showJID() {
-	String jid = mSettings.getString(
-		getString(R.string.PreferenceLoginKey), "")
-		+ "@"
-		+ mSettings
-			.getString(getString(R.string.PreferenceHostKey), "");
-	if (jid.length() == 1)
-	    jid = getString(R.string.BeemCreateAccount);
-	mButton.setText(jid);
-    }
-
-}
--- a/src/com/beem/project/beem/ui/BeemDialogSettings.java	Fri Apr 03 14:18:10 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-package com.beem.project.beem.ui;
-
-import android.app.Dialog;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-import com.beem.project.beem.R;
-
-/**
- *
- */
-public class BeemDialogSettings extends Dialog implements
-        android.view.View.OnClickListener {
-
-    private Beem mbeem;
-
-    private SharedPreferences mSettings;
-
-    public BeemDialogSettings(Beem beem, SharedPreferences settings) {
-        super(beem);
-        this.mbeem = beem;
-        this.mSettings = settings;
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-        setContentView(R.layout.beemdialogsettings);
-        getWindow().setFlags(4, 4);
-        setTitle("Jabber Account Settings");
-        showSettings();
-        Button ok = (Button) findViewById(R.id.ok);
-        ok.setOnClickListener(this);
-    }
-
-    @Override
-    public void onClick(View v) {
-        SharedPreferences.Editor editor = mSettings.edit();
-        Context ctx = getContext();
-        editor.putString(ctx.getString(R.string.PreferenceHostKey),
-                getWidgetText(R.id.host));
-        editor.putString(ctx.getString(R.string.PreferencePortKey),
-                getWidgetText(R.id.port));
-        editor.putString(ctx.getString(R.string.PreferenceLoginKey),
-                getWidgetText(R.id.userid));
-        editor.putString(ctx.getString(R.string.PreferencePasswordKey),
-                getWidgetText(R.id.password));
-        editor.commit();
-        this.mbeem.showJID();
-        dismiss();
-    }
-
-    private void showSettings() {
-        String tmp;
-        EditText eHost = (EditText) findViewById(R.id.host);
-        if ((tmp = mSettings.getString("host", "")) != "")
-            eHost.setText(tmp);
-        EditText ePort = (EditText) findViewById(R.id.port);
-        if ((tmp = mSettings.getString("port", "")) != "")
-            ePort.setText(tmp);
-        EditText eLogin = (EditText) findViewById(R.id.userid);
-        if ((tmp = mSettings.getString("login", "")) != "")
-            eLogin.setText(tmp);
-        EditText ePwd = (EditText) findViewById(R.id.password);
-        if ((tmp = mSettings.getString("password", "")) != "")
-            ePwd.setText(tmp);
-    }
-
-    private String getWidgetText(int id) {
-        EditText widget = (EditText) this.findViewById(id);
-        return widget.getText().toString();
-    }
-}
--- a/src/com/beem/project/beem/ui/ContactList.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Apr 04 19:02:11 2009 +0200
@@ -4,14 +4,20 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import android.app.ExpandableListActivity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.RemoteException;
 import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ExpandableListAdapter;
@@ -19,95 +25,196 @@
 import android.widget.ImageView;
 import android.widget.SimpleExpandableListAdapter;
 import android.widget.TextView;
+
 import com.beem.project.beem.BeemApplication;
 import com.beem.project.beem.R;
 import com.beem.project.beem.service.Contact;
 import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.aidl.IRoster;
 
 public class ContactList extends ExpandableListActivity {
 
     private static final String TAG = "CONTACTLIST_ACT";
     private IXmppFacade mService = null;
+    private SharedPreferences mSettings;
     private Handler mHandler;
     private BeemApplication mBeemApplication;
+    private ContactListDialogSettings mDialog;
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean onChildClick(ExpandableListView parent, View v,
+	    int groupPosition, int childPosition, long id) {
+	Intent i = new Intent(this, SendIM.class);
+	Map<String, Contact> child = (HashMap<String, Contact>) parent
+		.getExpandableListAdapter().getChild(groupPosition,
+			childPosition);
+	i.putExtra("contact", child.get("CHILD"));
+	startActivity(i);
+	return true;
+    }
 
     @Override
-    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
-	startActivity(new Intent(this, SendIM.class));
-	return true;
-
-    };
-
-    @Override
-    public void onCreate(Bundle saveBundle) {
+    protected void onCreate(Bundle saveBundle) {
 	super.onCreate(saveBundle);
 	mHandler = new Handler();
 	mBeemApplication = BeemApplication.getApplication(this);
+	mSettings = getSharedPreferences(
+		getString(R.string.PreferenceFileName), MODE_PRIVATE);
+	mDialog = new ContactListDialogSettings(this, mSettings);
+
+	mSettings
+		.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
+		    @Override
+		    public void onSharedPreferenceChanged(
+			    SharedPreferences sharedPreferences, String key) {
+			/*
+			 * TODO : A faire apres listener nikita
+			 * 
+			 * mBeemApplication.stopBeemService();
+			 * mBeemApplication.startBeemService();
+			 * mBeemApplication.callWhenServiceConnected(mHandler,
+			 * new Runnable() {
+			 * 
+			 * @Override public void run() {
+			 * callbackShowContactList(); } });
+			 */
+		    }
+		});
 
     }
 
     @Override
-    public void onStart() {
+    protected void onStart() {
 	super.onStart();
-	mBeemApplication.startBeemService();
+	Log.i(TAG, "onStart");
+    }
+
+    @Override
+    protected void onResume() {
+	super.onResume();
+	/*
+	 * @TODO: A ameliorer apres listener de nikita
+	 */
+	Log.i(TAG, "onResume");
+	if (!mBeemApplication.isConnected())
+	    mBeemApplication.startBeemService();
+	else {
+	    callbackShowContactList();
+	}
 	mBeemApplication.callWhenServiceConnected(mHandler, new Runnable() {
 	    @Override
 	    public void run() {
-		mService = mBeemApplication.getXmppFacade();
-		try {
-		    showContactList(mService.getRoster().getContactList(), mService.getRoster().getContactList());
-		} catch (RemoteException e) {
-		    // TODO Auto-generated catch block
-		    e.printStackTrace();
-		}
-
+		callbackShowContactList();
 	    }
 	});
     }
 
-    private void showContactList(List<Contact> listGroup, List<Contact> listContact) {
+    private void callbackShowContactList() {
+	/*
+	 * @TODO: A ameliorer apres listener de nikita
+	 */
+	mService = mBeemApplication.getXmppFacade();
+	if (mService != null) {
+	    try {
+		IRoster r = mService.getRoster();
+		if (r != null)
+		    showContactList(r.getGroupsNames(), r.getContactList());
+	    } catch (RemoteException e) {
+		// TODO Auto-generated catch block
+		e.printStackTrace();
+	    }
+	}
+    }
+
+    /**
+     * Callback for menu creation.
+     * 
+     * @param menu
+     *            the menu created
+     * @return true on success, false otherwise
+     */
+    @Override
+    public final boolean onCreateOptionsMenu(Menu menu) {
+	super.onCreateOptionsMenu(menu);
+	MenuInflater inflater = getMenuInflater();
+	inflater.inflate(R.menu.contactlistmenu, menu);
+	return true;
+    }
+
+    /**
+     * Callback for menu item selected.
+     * 
+     * @param item
+     *            the item selected
+     * @return true on success, false otherwise
+     */
+    @Override
+    public final boolean onOptionsItemSelected(MenuItem item) {
+	switch (item.getItemId()) {
+	    case R.id.account_edit:
+		mDialog.show();
+		return true;
+	    case R.id.account_about:
+		return true;
+	    default:
+		return false;
+	}
+    }
+
+    private void showContactList(List<String> listGroup,
+	    List<Contact> listContact) {
 	ExpandableListAdapter Adapter;
 	List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
-	List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
+	List<List<Map<String, Contact>>> childData = new ArrayList<List<Map<String, Contact>>>();
 
 	if (listGroup.size() == 0)
-	    listGroup.add(new Contact());
+	    listGroup.add("Default");
 	for (int i = 0; i < listGroup.size(); i++) {
 	    Map<String, String> curGroupMap = new HashMap<String, String>();
 
 	    groupData.add(curGroupMap);
-	    curGroupMap.put("NAME", "Default");
+	    curGroupMap.put("GROUP", listGroup.get(i));
 
-	    List<Map<String, String>> children = new ArrayList<Map<String, String>>();
+	    List<Map<String, Contact>> children = new ArrayList<Map<String, Contact>>();
 	    for (int j = 0; j < listContact.size(); ++j) {
-		Map<String, String> curChildMap = new HashMap<String, String>();
+		Map<String, Contact> curChildMap = new HashMap<String, Contact>();
 		children.add(curChildMap);
-		curChildMap.put("NAME_CHILD", listContact.get(j).getJID());
-		curChildMap.put("MSG", "Taper votre message perso");
+		Contact c = listContact.get(j);
+		Log.i(TAG, c.getID() + " " +c.getJID());
+		curChildMap.put("CHILD", c);
 	    }
 	    childData.add(children);
 	}
 
-	Adapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, new String[] { "NAME" },
-	    new int[] { R.id.textgroup }, childData, R.layout.contactlistcontact, new String[] { "NAME_CHILD", "MSG" },
-	    new int[] { R.id.textchild1, R.id.textchild2, R.id.avatar });
+	Adapter = new ContactExpandableListAdapter(this, groupData,
+		R.layout.contactlistgroup, new String[] { "GROUP" },
+		new int[] { R.id.textgroup }, childData,
+		R.layout.contactlistcontact, new String[] { "CHILD" },
+		new int[] { R.id.contactliststatus, R.id.contactlistpseudo,
+			R.id.contactlistmsgperso, R.id.contactlistavatar });
 	setListAdapter(Adapter);
     }
 
     /**
-     * A simple adapter which allows you to bind data to specific Views defined within the layout of an Expandable Lists
-     * children (Implement getGroupView() to define the layout of parents)
+     * A simple adapter which allows you to bind data to specific Views defined
+     * within the layout of an Expandable Lists children (Implement
+     * getGroupView() to define the layout of parents)
      */
-    public class ContactExpandableListAdapter extends SimpleExpandableListAdapter {
+    private class ContactExpandableListAdapter extends
+	    SimpleExpandableListAdapter {
 
 	private List<? extends List<? extends Map<String, ?>>> mChildData;
 	private String[] mChildFrom;
 	private int[] mChildTo;
 
-	public ContactExpandableListAdapter(Context context, List<? extends Map<String, ?>> groupData, int groupLayout,
-	    String[] groupFrom, int[] groupTo, List<? extends List<? extends Map<String, ?>>> childData,
-	    int childLayout, String[] childFrom, int[] childTo) {
-	    super(context, groupData, groupLayout, groupFrom, groupTo, childData, childLayout, childFrom, childTo);
+	public ContactExpandableListAdapter(Context context,
+		List<? extends Map<String, ?>> groupData, int groupLayout,
+		String[] groupFrom, int[] groupTo,
+		List<? extends List<? extends Map<String, ?>>> childData,
+		int childLayout, String[] childFrom, int[] childTo) {
+	    super(context, groupData, groupLayout, groupFrom, groupTo,
+		    childData, childLayout, childFrom, childTo);
 
 	    mChildData = childData;
 	    mChildFrom = childFrom;
@@ -116,8 +223,8 @@
 	}
 
 	@Override
-	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
-	    ViewGroup parent) {
+	public View getChildView(int groupPosition, int childPosition,
+		boolean isLastChild, View convertView, ViewGroup parent) {
 
 	    View v;
 	    if (convertView == null) {
@@ -125,33 +232,67 @@
 	    } else {
 		v = convertView;
 	    }
-	    bindView(v, mChildData.get(groupPosition).get(childPosition), mChildFrom, mChildTo, groupPosition,
-		childPosition);
+	    bindView(v, mChildData.get(groupPosition).get(childPosition),
+		    mChildFrom, mChildTo, groupPosition, childPosition);
 	    return v;
 	}
 
-	// This method binds my data to the Views specified in the child
-	// xmllayout
-	private void bindView(View view, Map<String, ?> data, String[] from, int[] to, int groupPosition,
-	    int childPosition) {
-	    // Apply TextViews
-	    TextView v1 = (TextView) view.findViewById(to[0]);
-	    if (v1 != null) {
-		Log.i("CONTACT LIST 1", (String) data.get(from[0]) + " " + to[0]);
-		v1.setText((String) data.get(from[0]));
-	    }
-	    TextView v2 = (TextView) view.findViewById(to[1]);
-	    if (v2 != null) {
-		Log.i("CONTACT LIST 2", (String) data.get(from[1]) + " " + to[1]);
-		v2.setText((String) data.get(from[1]));
-	    }
-	    // Apply ImageView
-	    ImageView imgV = (ImageView) view.findViewById(to[2]);
-	    if (imgV != null) {
-		Drawable avatar = (Drawable) getResources().getDrawable(R.drawable.avatar);
-		imgV.setImageDrawable(avatar);
+	private void bindView(View view, Map<String, ?> data, String[] from,
+		int[] to, int groupPosition, int childPosition) {
+	    Contact c = (Contact) data.get(from[0]);
+
+	    if (c != null) {
+
+		ImageView imgV = (ImageView) view.findViewById(to[0]);
+		Drawable imageDrawable = null;
+		switch (c.getStatus()) {
+		    case Contact.CONTACT_STATUS_AVAILABLE:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.avatar);
+		    case Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.chat);
+		    case Contact.CONTACT_STATUS_AWAY:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.away);
+		    case Contact.CONTACT_STATUS_BUSY:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.dnd);
+		    case Contact.CONTACT_STATUS_DISCONNECT:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.offline);
+		    case Contact.CONTACT_STATUS_UNAVAILABLE:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.requested);
+		    default:
+			imageDrawable = (Drawable) getResources().getDrawable(
+				R.drawable.error);
+		}
+		imgV.setImageDrawable(imageDrawable);
+
+		TextView v = (TextView) view.findViewById(to[1]);
+		if (v != null) {
+		    v.setText(c.getJID());
+		}
+		/*
+		 * @TODO: Rajouter le message perso du contact v = (TextView)
+		 */
+		v = (TextView) view.findViewById(to[2]);
+		if (v != null) {
+		    v.setText(c.getMMsgState());
+		}
+
+		/*
+		 * @TODO: Rajouter l'avatar du contact getAvatar() dans la
+		 * classe
+		 */
+		imgV = (ImageView) view.findViewById(to[3]);
+		if (imgV != null) {
+		    imageDrawable = (Drawable) getResources().getDrawable(
+			    R.drawable.avatar);
+		    imgV.setImageDrawable(imageDrawable);
+		}
 	    }
 	}
     }
-
-}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/ContactListDialogSettings.java	Sat Apr 04 19:02:11 2009 +0200
@@ -0,0 +1,81 @@
+package com.beem.project.beem.ui;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+
+/**
+ *
+ */
+public class ContactListDialogSettings extends Dialog implements
+	android.view.View.OnClickListener {
+
+    private SharedPreferences mSettings;
+    private ContactList mContactList;
+
+    public ContactListDialogSettings(ContactList contactList,
+	    SharedPreferences settings) {
+	super(contactList);
+	this.mContactList = contactList;
+	this.mSettings = settings;
+    }
+
+    @Override
+    protected void onStart() {
+	super.onStart();
+	setContentView(R.layout.contactlistdialogsettings);
+	getWindow().setFlags(4, 4);
+	setTitle("Jabber Account Settings");
+	showSettings();
+	Button ok = (Button) findViewById(R.id.ok);
+	ok.setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View v) {
+	SharedPreferences.Editor editor = mSettings.edit();
+	Context ctx = getContext();
+	editor.putString(ctx.getString(R.string.PreferenceHostKey),
+		getWidgetText(R.id.host));
+	editor.putString(ctx.getString(R.string.PreferencePortKey),
+		getWidgetText(R.id.port));
+	editor.putString(ctx.getString(R.string.PreferenceLoginKey),
+		getWidgetText(R.id.userid));
+	editor.putString(ctx.getString(R.string.PreferencePasswordKey),
+		getWidgetText(R.id.password));
+	String JID = ctx.getString(R.string.PreferenceLoginKey) + "@"
+		+ ctx.getString(R.string.PreferenceHostKey);
+	editor.putString(ctx.getString(R.string.PreferenceJID), JID);
+	editor.commit();
+	dismiss();
+    }
+
+    private void showSettings() {
+	Context ctx = getContext();
+	EditText e = (EditText) findViewById(R.id.host);
+	e.setText(mSettings.getString(
+		ctx.getString(R.string.PreferenceHostKey), ""));
+	e = (EditText) findViewById(R.id.port);
+	e.setText(mSettings.getString(
+		ctx.getString(R.string.PreferencePortKey), ""));
+	e = (EditText) findViewById(R.id.userid);
+	e.setText(mSettings.getString(ctx
+		.getString(R.string.PreferenceLoginKey), ""));
+	e = (EditText) findViewById(R.id.password);
+	e.setText(mSettings.getString(ctx
+		.getString(R.string.PreferencePasswordKey), ""));
+    }
+
+    private String getWidgetText(int id) {
+	EditText widget = (EditText) this.findViewById(id);
+	return widget.getText().toString();
+    }
+}
--- a/src/com/beem/project/beem/ui/SendIM.java	Fri Apr 03 14:18:10 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java	Sat Apr 04 19:02:11 2009 +0200
@@ -5,6 +5,7 @@
 import android.app.ListActivity;
 import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -16,19 +17,21 @@
 import android.widget.EditText;
 
 import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
 
 /**
- * @author barbu
- * This activity class provide the view for instant messaging
- * after selecting a correspondant.
+ * @author barbu This activity class provide the view for instant messaging
+ *         after selecting a correspondant.
  */
 
-public class SendIM extends ListActivity implements OnClickListener, OnKeyListener {
-    private EditText			mToSend;
-    private ArrayList<String>		mMessages = new ArrayList<String>();
-    private ArrayAdapter<String>	mAdapter;
-    private SendIMDialogSmiley		mSmyDialog;
+public class SendIM extends ListActivity implements OnClickListener,
+	OnKeyListener {
+    private EditText mToSend;
+    private ArrayList<String> mMessages = new ArrayList<String>();
+    private ArrayAdapter<String> mAdapter;
+    private SendIMDialogSmiley mSmyDialog;
     private SharedPreferences mSet;
+    private Contact mContact;
 
     /**
      * Constructor.
@@ -43,16 +46,26 @@
     @Override
     public void onCreate(Bundle saveBundle) {
 	super.onCreate(saveBundle);
+
 	setContentView(R.layout.sendim);
 	mToSend = (EditText) findViewById(R.id.userText);
 	mSet = getSharedPreferences("lol", MODE_PRIVATE);
 	mSmyDialog = new SendIMDialogSmiley(this, mSet);
 
-	mAdapter = new ArrayAdapter<String>(this, R.layout.messagelist, mMessages);
+	mAdapter = new ArrayAdapter<String>(this, R.layout.messagelist,
+		mMessages);
 	setListAdapter(mAdapter);
 
 	mToSend.setOnClickListener(this);
 	mToSend.setOnKeyListener(this);
+
+	mContact = getIntent().getParcelableExtra("contact");
+    }
+
+    @Override
+    public void onStart() {
+	super.onStart();
+
     }
 
     /**
@@ -63,19 +76,25 @@
     }
 
     /**
-     * This method send a message to the server over the XMPP
-     * connection and display it on activity view
-     * TODO : Exception si la connexion se coupe pendant la conversation
+     * This method send a message to the server over the XMPP connection and
+     * display it on activity view TODO : Exception si la connexion se coupe
+     * pendant la conversation
      */
     private void sendText() {
 	String text = mToSend.getText().toString();
 	if (!text.equals("")) {
 	    /*
-	     * Prepare the message to be send 
-	     * */
-	    /*Message msg = new Message("barbu", Message.Type.chat);*/
-	    /*msg.setBody(text);*/
-	    mAdapter.add("Barbu " + getString(R.string.SendIMSays) + text);
+	     * Prepare the message to be send
+	     */
+	    /* Message msg = new Message("barbu", Message.Type.chat); */
+	    /* msg.setBody(text); */
+	    /*
+	     * Rien a voir il faut changer le mContact.getJID() et remplacer
+	     * avec son pseudo cetait juste un test pour savoir qu'on recupere
+	     * bien le contact a qui envoyer les infos
+	     */
+	    mAdapter.add(mContact.getJID() + " "
+		    + getString(R.string.SendIMSays) + text);
 	    mToSend.setText(null);
 	}
     }
@@ -94,9 +113,10 @@
 	}
 	return false;
     }
-    
+
     /**
      * Callback for menu creation.
+     * 
      * @param menu
      *            the menu created
      * @return true on success, false otherwise
@@ -108,7 +128,7 @@
 	inflater.inflate(R.menu.sendimmenu, menu);
 	return true;
     }
-    
+
     @Override
     public final boolean onOptionsItemSelected(MenuItem item) {
 	switch (item.getItemId()) {