--- a/src/com/beem/project/beem/service/RosterAdapter.java Sun May 30 23:18:46 2010 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Mon May 31 00:56:26 2010 +0200
@@ -112,20 +112,6 @@
Log.e(TAG, "Error while adding new contact", e);
return null;
}
- if (groups != null) {
- for (String groupStr : groups) {
- RosterGroup group = mAdaptee.getGroup(groupStr);
- if (group == null) {
- group = mAdaptee.createGroup(groupStr);
- }
- try {
- group.addEntry(contact);
- } catch (XMPPException e) {
- e.printStackTrace();
- return null;
- }
- }
- }
return getContactFromRosterEntry(contact);
}
@@ -147,11 +133,8 @@
*/
@Override
public void createGroup(String groupname) throws RemoteException {
- try {
+ if (mAdaptee.getGroup(groupname) == null)
mAdaptee.createGroup(groupname);
- } catch (IllegalArgumentException e) {
- Log.v(TAG, "Error while creating group", e);
- }
}
/**
@@ -170,17 +153,10 @@
@Override
public List<Contact> getContactList() throws RemoteException {
boolean add = true;
- List<Contact> coList = new ArrayList<Contact>(mAdaptee.getEntries().size());
- for (RosterEntry entry : mAdaptee.getEntries()) {
- for (Contact c : coList) {
- if (c.getJID().equals(entry.getUser())) {
- add = false;
- break;
- }
- }
- // Because getEntries return duplicated user.
- if (add)
- coList.add(getContactFromRosterEntry(entry));
+ Collection<RosterEntry> list = mAdaptee.getEntries();
+ List<Contact> coList = new ArrayList<Contact>(list.size());
+ for (RosterEntry entry : list) {
+ coList.add(getContactFromRosterEntry(entry));
}
return coList;
}