--- 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";
--- 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;
}