# HG changeset patch # User nikita@localhost # Date 1245868067 -7200 # Node ID ab161e8a58f5da1b7194c21f25b90c244f549245 # Parent ee4c051de429dae4f166d44b8465e489d7f32c60 erge diff -r ee4c051de429 -r ab161e8a58f5 src/com/beem/project/beem/service/PrivacyListManagerAdapter.java --- a/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Wed Jun 24 19:31:30 2009 +0200 +++ b/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Wed Jun 24 20:27:47 2009 +0200 @@ -20,7 +20,7 @@ /** * @author nikita - * + * A finir */ public class PrivacyListManagerAdapter extends IPrivacyListManager.Stub { public static final String TAG = "PrivacyListManagerAdapter"; diff -r ee4c051de429 -r ab161e8a58f5 src/com/beem/project/beem/service/RosterAdapter.java --- a/src/com/beem/project/beem/service/RosterAdapter.java Wed Jun 24 19:31:30 2009 +0200 +++ b/src/com/beem/project/beem/service/RosterAdapter.java Wed Jun 24 20:27:47 2009 +0200 @@ -71,51 +71,31 @@ RosterEntry contact = mAdaptee.getEntry(user); if (contact != null) { res = mContacts.get(user); - if (groups != null) { - for (String groupStr : groups) { - boolean found = false; - for (RosterGroup group : mAdaptee.getGroups()) { - if (group.getName().equals(groupStr) && !group.contains(contact)) { - try { - group.addEntry(contact); - res.addGroup(groupStr); - found = true; - } catch (XMPPException e) { - Log.e(TAG, "add new contact", e); - } - } - } - if (!found) { - try { - mAdaptee.createGroup(groupStr).addEntry(contact); - } catch (XMPPException e) { - e.printStackTrace(); - } catch (IllegalArgumentException e) { - } - res.addGroup(groupStr); - } - } - } } else { try { mAdaptee.createEntry(user, name, groups); + contact = mAdaptee.getEntry(user); res = new Contact(user); mContacts.put(user, res); - if (groups != null) { - for (String groupStr : groups) { - try { - mAdaptee.createGroup(groupStr); - } catch (IllegalArgumentException e) { - // e.printStackTrace(); - } - res.addGroup(groupStr); - } - } } catch (XMPPException e) { 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(); + } + res.addGroup(groupStr); + } + } return res; }