--- a/src/com/beem/project/beem/service/Contact.java Fri Apr 24 20:30:19 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Fri Apr 24 20:55:26 2009 +0200
@@ -4,8 +4,10 @@
package com.beem.project.beem.service;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
+import org.jivesoftware.smack.RosterGroup;
import org.jivesoftware.smack.packet.Presence;
import com.beem.project.beem.utils.Status;
@@ -27,6 +29,7 @@
private String mJID;
private String mMsgState;
private List<String> mRes;
+ private List<String> mGroups;
/**
* Parcelable.Creator needs by Android.
@@ -60,6 +63,7 @@
mStatus = Status.CONTACT_STATUS_DISCONNECT;
mRes = new ArrayList<String>();
mRes.add("none");
+ setGroups(new ArrayList<String>());
}
/**
@@ -73,6 +77,7 @@
mMsgState = in.readString();
mRes = new ArrayList<String>();
in.readStringList(mRes);
+ in.readStringList(getGroups());
}
/**
@@ -85,6 +90,7 @@
dest.writeString(mJID);
dest.writeString(mMsgState);
dest.writeStringList(getMRes());
+ dest.writeStringList(getGroups());
}
/**
@@ -206,4 +212,24 @@
return mJID;
return super.toString();
}
+
+ public void setGroups(Collection<RosterGroup> groups) {
+ for (RosterGroup rosterGroup : groups) {
+ mGroups.add(rosterGroup.getName());
+ }
+ }
+
+ /**
+ * @param mGroups the mGroups to set
+ */
+ public void setGroups(List<String> mGroups) {
+ this.mGroups = mGroups;
+ }
+
+ /**
+ * @return the mGroups
+ */
+ public List<String> getGroups() {
+ return mGroups;
+ }
}
--- a/src/com/beem/project/beem/service/RosterAdapter.java Fri Apr 24 20:30:19 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Fri Apr 24 20:55:26 2009 +0200
@@ -31,8 +31,7 @@
private static final String TAG = "RosterAdapter";
private Roster mAdaptee;
- private RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners =
- new RemoteCallbackList<IBeemRosterListener>();
+ private RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners = new RemoteCallbackList<IBeemRosterListener>();
private Map<String, Contact> mContacts = new HashMap<String, Contact>();
private RosterListenerAdapter mRosterListener = new RosterListenerAdapter();
@@ -49,7 +48,8 @@
if (!mContacts.containsKey(user)) {
Contact c = new Contact(user);
c.setStatus(roster.getPresence(user));
- mContacts.put(user, c);
+ c.addGroups(entry.getGroups());
+ mContacts.put(user, c);
}
}
}
@@ -123,10 +123,8 @@
}
/**
- * Listener for the roster events.
- * It will call the remote listeners registered.
+ * Listener for the roster events. It will call the remote listeners registered.
* @author darisk
- *
*/
private class RosterListenerAdapter implements RosterListener {