--- a/src/com/beem/project/beem/ui/ContactList.java Thu Sep 17 20:39:09 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Sep 24 14:06:24 2009 +0200
@@ -40,6 +40,7 @@
import com.beem.project.beem.service.aidl.IBeemRosterListener;
import com.beem.project.beem.service.aidl.IRoster;
import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.PresenceType;
import com.beem.project.beem.utils.Status;
/**
@@ -425,20 +426,43 @@
public void onEntriesUpdated(List<String> addresses) throws RemoteException {
mHandler.post(new RunnableChange());
}
-
+
+ @Override
+ public void onEntryDeleteFromGroup(String group, String jid)
+ throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
/**
* {@inheritDoc}
*/
@Override
public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
+ //TODO gerer la presence au niveau de chaque ressources ?
+ String from = presence.getFrom();
+ boolean resfound = false;
for (Contact curContact : mListContact) {
- if (curContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
+ if (curContact.getJID().equals(StringUtils.parseBareAddress(from))) {
+ String pres = StringUtils.parseResource(from);
+ for (String res : curContact.getMRes()) {
+ if (res.equals(pres)) {
+ resfound = true;
+ break;
+ }
+ }
curContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom())));
+ int status = presence.getStatus();
+ if (!resfound && (status != Status.CONTACT_STATUS_DISCONNECT && status != Status.CONTACT_STATUS_UNAVAILABLE))
+ curContact.addRes(pres);
+ else if (resfound && (status == Status.CONTACT_STATUS_DISCONNECT && status == Status.CONTACT_STATUS_UNAVAILABLE))
+ curContact.delRes(pres);
mHandler.post(new RunnableChange());
return;
}
}
}
+
+
}
/**