src/com/beem/project/beem/service/XmppConnectionAdapter.java
author jibe@jibe-desktop
Thu, 09 Apr 2009 20:02:26 +0200
changeset 98 4d6ff785605d
parent 97 58622a0f9485
child 99 8de21ac527ce
permissions -rwxr-xr-x
toto
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     1
/**
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
     2
 *
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     3
 */
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     4
package com.beem.project.beem.service;
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     5
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     6
import org.jivesoftware.smack.ConnectionConfiguration;
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
     7
import org.jivesoftware.smack.ConnectionListener;
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
     8
import org.jivesoftware.smack.Roster;
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     9
import org.jivesoftware.smack.XMPPConnection;
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    10
import org.jivesoftware.smack.XMPPException;
35
8006e9ee734e ajout d'une fonction de SeviceDiscovery
nikita@nikita-rack
parents: 31
diff changeset
    11
import org.jivesoftware.smackx.ServiceDiscoveryManager;
8006e9ee734e ajout d'une fonction de SeviceDiscovery
nikita@nikita-rack
parents: 31
diff changeset
    12
import org.jivesoftware.smackx.jingle.JingleManager;
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
    13
import android.os.RemoteCallbackList;
30
7057a9d3657a Add some adapter for smack classes
Da Risk <darisk972@gmail.com>
parents: 29
diff changeset
    14
import android.os.RemoteException;
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    15
import android.util.Log;
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    16
import com.beem.project.beem.BeemException;
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
    17
import com.beem.project.beem.service.aidl.IBeemConnectionListener;
57
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
    18
import com.beem.project.beem.service.aidl.IChatManager;
30
7057a9d3657a Add some adapter for smack classes
Da Risk <darisk972@gmail.com>
parents: 29
diff changeset
    19
import com.beem.project.beem.service.aidl.IRoster;
55
66732dd2cb77 Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents: 38
diff changeset
    20
import com.beem.project.beem.service.aidl.IXmppConnection;
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    21
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    22
/**
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    23
 * This class implements an adapter for XMPPConnection.
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    24
 * @author darisk
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    25
 */
67
8c3870db8e31 Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents: 57
diff changeset
    26
public class XmppConnectionAdapter extends IXmppConnection.Stub {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
    27
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    28
    private static final String TAG = "XMPPConnectionAdapter";
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    29
    private XMPPConnection mAdaptee;
57
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
    30
    private IChatManager mChatManager;
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    31
    private String mLogin;
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    32
    private String mPassword;
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    33
    private RosterAdapter mRoster;
68
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
    34
    private Object mLastException;
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
    35
68
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
    36
    private RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners = new RemoteCallbackList<IBeemConnectionListener>();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
    37
    private ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    39
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    40
     * Constructor.
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    41
     * @param con The connection to adapt
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    42
     * @param login The login to use
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    43
     * @param password The password to use
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    44
     */
67
8c3870db8e31 Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents: 57
diff changeset
    45
    public XmppConnectionAdapter(final XMPPConnection con, final String login, final String password) {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    46
	mAdaptee = con;
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    47
	mLogin = login;
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    48
	mPassword = password;
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    49
    }
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    50
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    51
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    52
     * Constructor.
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    53
     * @param serviceName name of the service to connect to
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    54
     * @param login login to use on connect
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    55
     * @param password password to use on connect
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    56
     */
67
8c3870db8e31 Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents: 57
diff changeset
    57
    public XmppConnectionAdapter(final String serviceName, final String login, final String password) {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    58
	this(new XMPPConnection(serviceName), login, password);
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    59
    }
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    60
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    61
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    62
     * Constructor.
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    63
     * @param config Configuration to use in order to connect
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    64
     * @param login login to use on connect
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    65
     * @param password password to use on connect
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    66
     */
67
8c3870db8e31 Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents: 57
diff changeset
    67
    public XmppConnectionAdapter(final ConnectionConfiguration config, final String login, final String password) {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    68
	this(new XMPPConnection(config), login, password);
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    69
    }
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    70
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    71
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    72
     * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    73
     */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
    74
    @Override
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    75
    public boolean connectSync() throws RemoteException {
80
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    76
	try {
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    77
	    mAdaptee.connect();
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    78
	    mAdaptee.addConnectionListener(mConListener);
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    79
	    mAdaptee.login(mLogin, mPassword, "BEEM");
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    80
	    mChatManager = new BeemChatManager(mAdaptee.getChatManager());
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    81
	    // TODO find why this cause a null pointer exception
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    82
	    // this.initFeatures(); // pour declarer les features xmpp qu'on supporte
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    83
	    mLastException = null;
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    84
	    triggerAsynchronousConnectEvent();
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    85
	    return true;
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    86
	} catch (XMPPException e) {
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    87
	    Log.e(TAG, "Error while connecting", e);
98
jibe@jibe-desktop
parents: 97
diff changeset
    88
	    mLastException = new BeemException(e);
80
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    89
	}
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
    90
	return false;
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    91
    }
30
7057a9d3657a Add some adapter for smack classes
Da Risk <darisk972@gmail.com>
parents: 29
diff changeset
    92
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    93
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    94
     * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    95
     */
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    96
    @Override
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    97
    public boolean disconnect() {
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    98
	mAdaptee.disconnect();
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
    99
	mLastException = null;
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   100
	return true;
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   101
    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   102
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   103
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   104
     * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   105
     */
30
7057a9d3657a Add some adapter for smack classes
Da Risk <darisk972@gmail.com>
parents: 29
diff changeset
   106
    @Override
7057a9d3657a Add some adapter for smack classes
Da Risk <darisk972@gmail.com>
parents: 29
diff changeset
   107
    public IRoster getRoster() throws RemoteException {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   108
	if (mRoster != null)
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   109
	    return mRoster;
80
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   110
	Roster adap = mAdaptee.getRoster();
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   111
	if (adap == null)
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   112
	    return null;
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   113
	mRoster = new RosterAdapter(adap);
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   114
	return mRoster;
30
7057a9d3657a Add some adapter for smack classes
Da Risk <darisk972@gmail.com>
parents: 29
diff changeset
   115
    }
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   116
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   117
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   118
     * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   119
     */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   120
    @Override
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   121
    public final void connectAsync() throws RemoteException {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   122
	Thread t = new Thread(new Runnable() {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   123
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   124
	    @Override
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   125
	    public void run() {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   126
		try {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   127
		    connectSync();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   128
		} catch (RemoteException e) {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   129
		    Log.e(TAG, "Error while connecting", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   130
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   131
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   132
	});
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   133
	t.start();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   134
    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   135
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   136
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   137
     * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   138
     */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   139
    @Override
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   140
    public void addConnectionListener(IBeemConnectionListener listen) throws RemoteException {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   141
	if (listen != null)
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   142
	    mRemoteConnListeners.register(listen);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   143
    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   144
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   145
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   146
     * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   147
     */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   148
    @Override
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   149
    public void removeConnectionListener(IBeemConnectionListener listen) throws RemoteException {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   150
	if (listen != null)
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   151
	    mRemoteConnListeners.unregister(listen);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   152
    }
68
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   153
57
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   154
    /**
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   155
     * {@inheritDoc}
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   156
     */
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   157
    @Override
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   158
    public IChatManager getChatManager() throws RemoteException {
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   159
	return mChatManager;
c91278dda166 La facade et la connexion permette de recuperer une instance de ChatManager
Da Risk <darisk972@gmail.com>
parents: 55
diff changeset
   160
    }
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   161
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   162
    /**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   163
     * Trigger Connection event.
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   164
     */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   165
    private void triggerAsynchronousConnectEvent() {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   166
	mConListener.onConnect();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   167
    }
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   168
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   169
    /**
68
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   170
     * enregistre les features dispo dans notre version Liste de features que Telepathy supporte.
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   171
     */
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   172
    private void initFeatures() {
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   173
	JingleManager.setJingleServiceEnabled();
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   174
	ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   175
	sdm.addFeature("http://jabber.org/protocol/disco#info");
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   176
	// sdm.addFeature("http://jabber.org/protocol/nick");
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   177
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   178
    }
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   179
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   180
    /**
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   181
     * Listener for XMPP connection events. It will calls the remote listeners for connexion events.
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   182
     * @author darisk
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   183
     */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   184
    private class ConnexionListenerAdapter implements ConnectionListener {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   185
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   186
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   187
	 * Defaut constructor.
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   188
	 */
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   189
	public ConnexionListenerAdapter() {
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   190
	    // TODO Auto-generated constructor stub
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   191
	}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   192
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   193
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   194
	 * Method to execute when a connection event occurs.
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   195
	 */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   196
	public void onConnect() {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   197
	    final int n = mRemoteConnListeners.beginBroadcast();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   198
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   199
	    for (int i = 0; i < n; i++) {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   200
		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   201
		try {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   202
		    listener.onConnect();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   203
		} catch (RemoteException e) {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   204
		    // The RemoteCallbackList will take care of removing the
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   205
		    // dead listeners.
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   206
		    Log.w(TAG, "Error while triggering remote connection listeners", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   207
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   208
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   209
	    mRemoteConnListeners.finishBroadcast();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   210
	}
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   211
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   212
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   213
	 * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   214
	 */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   215
	@Override
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   216
	public void connectionClosed() {
76
144e837ee4a6 fix some synchronisation problem with the server
Da Risk <darisk972@gmail.com>
parents: 68
diff changeset
   217
	    mRoster = null;
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   218
	    final int n = mRemoteConnListeners.beginBroadcast();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   219
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   220
	    for (int i = 0; i < n; i++) {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   221
		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   222
		try {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   223
		    listener.connectionClosed();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   224
		} catch (RemoteException e) {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   225
		    // The RemoteCallbackList will take care of removing the
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   226
		    // dead listeners.
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   227
		    Log.w(TAG, "Error while triggering remote connection listeners", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   228
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   229
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   230
	    mRemoteConnListeners.finishBroadcast();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   231
	}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   232
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   233
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   234
	 * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   235
	 */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   236
	@Override
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   237
	public void connectionClosedOnError(Exception arg0) {
76
144e837ee4a6 fix some synchronisation problem with the server
Da Risk <darisk972@gmail.com>
parents: 68
diff changeset
   238
	    mRoster = null;
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   239
	    final int n = mRemoteConnListeners.beginBroadcast();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   240
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   241
	    for (int i = 0; i < n; i++) {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   242
		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   243
		try {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   244
		    listener.connectionClosedOnError();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   245
		} catch (RemoteException e) {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   246
		    // The RemoteCallbackList will take care of removing the
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   247
		    // dead listeners.
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   248
		    Log.w(TAG, "Error while triggering remote connection listeners", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   249
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   250
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   251
	    mRemoteConnListeners.finishBroadcast();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   252
	}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   253
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   254
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   255
	 * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   256
	 */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   257
	@Override
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   258
	public void reconnectingIn(int arg0) {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   259
	    final int n = mRemoteConnListeners.beginBroadcast();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   260
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   261
	    for (int i = 0; i < n; i++) {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   262
		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   263
		try {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   264
		    listener.reconnectingIn(arg0);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   265
		} catch (RemoteException e) {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   266
		    // The RemoteCallbackList will take care of removing the
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   267
		    // dead listeners.
80
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   268
		    Log.w(TAG, "Error while triggering remote connection listeners", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   269
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   270
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   271
	    mRemoteConnListeners.finishBroadcast();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   272
	}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   273
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   274
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   275
	 * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   276
	 */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   277
	@Override
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   278
	public void reconnectionFailed(Exception arg0) {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   279
	    final int r = mRemoteConnListeners.beginBroadcast();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   280
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   281
	    for (int i = 0; i < r; i++) {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   282
		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   283
		try {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   284
		    listener.reconnectionFailed();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   285
		} catch (RemoteException e) {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   286
		    // The RemoteCallbackList will take care of removing the
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   287
		    // dead listeners.
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   288
		    Log.w(TAG, "Error while triggering remote connection listeners", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   289
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   290
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   291
	    mRemoteConnListeners.finishBroadcast();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   292
	}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   293
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   294
	/**
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   295
	 * {@inheritDoc}
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   296
	 */
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   297
	@Override
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   298
	public void reconnectionSuccessful() {
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   299
	    final int n = mRemoteConnListeners.beginBroadcast();
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   300
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   301
	    for (int i = 0; i < n; i++) {
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   302
		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   303
		try {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   304
		    listener.reconnectionSuccessful();
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   305
		} catch (RemoteException e) {
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   306
		    // The RemoteCallbackList will take care of removing the
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   307
		    // dead listeners.
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   308
		    Log.w(TAG, "Error while triggering remote connection listeners", e);
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   309
		}
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   310
	    }
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   311
	    mRemoteConnListeners.finishBroadcast();
35
8006e9ee734e ajout d'une fonction de SeviceDiscovery
nikita@nikita-rack
parents: 31
diff changeset
   312
	}
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   313
36
d97efe278ca1 ajout de la declaration de featue
nikita@nikita-rack
parents: 35
diff changeset
   314
    }
35
8006e9ee734e ajout d'une fonction de SeviceDiscovery
nikita@nikita-rack
parents: 31
diff changeset
   315
80
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   316
    /**
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   317
     * Returns true if currently authenticated by successfully calling the login method.
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   318
     * @return true when successfully authenticated
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   319
     */
29f0d6a23321 Le proxy devrait marcher a peu pres.
Da Risk <darisk972@gmail.com>
parents: 76
diff changeset
   320
    public boolean isAuthentificated() {
68
0c76c67a2b99 Merge avec Nikita
Da Risk <darisk972@gmail.com>
parents: 65 67
diff changeset
   321
	return mAdaptee.isAuthenticated();
38
3e76846c48a9 We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents: 36
diff changeset
   322
    }
31
85faac00d92c Asynchronous service almost perfect.
Da Risk <darisk972@gmail.com>
parents: 30
diff changeset
   323
94
904759c1bd62 Draft de reception d'une demande d'ajout.
Da Risk <darisk972@gmail.com>
parents: 80
diff changeset
   324
    public XMPPConnection getAdaptee() {
904759c1bd62 Draft de reception d'une demande d'ajout.
Da Risk <darisk972@gmail.com>
parents: 80
diff changeset
   325
	return mAdaptee;
904759c1bd62 Draft de reception d'une demande d'ajout.
Da Risk <darisk972@gmail.com>
parents: 80
diff changeset
   326
    }
904759c1bd62 Draft de reception d'une demande d'ajout.
Da Risk <darisk972@gmail.com>
parents: 80
diff changeset
   327
    
29
a49d1556772c Starting work on the Service interface.
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   328
}