diff options
author | Damian Minkov <damencho@jitsi.org> | 2012-02-10 12:57:09 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2012-02-10 12:57:09 +0000 |
commit | 56aad19663aa352cc42a061977b3a36f92b89b23 (patch) | |
tree | c4f58795d1c79544b0eaf06c47c17aadf92b4424 /src/net/java/sip/communicator/impl | |
parent | a36338984a61c47658bb5c4ee922b7a5776fb3ef (diff) | |
download | jitsi-56aad19663aa352cc42a061977b3a36f92b89b23.zip jitsi-56aad19663aa352cc42a061977b3a36f92b89b23.tar.gz jitsi-56aad19663aa352cc42a061977b3a36f92b89b23.tar.bz2 |
Fixes a problem where adding contacts to newly created group is impossible.
Fixes a problem with moving contacts to group and double contact entry shown.
Renames protocol groups when meta group is renamed and fixed its storing.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
5 files changed, 54 insertions, 14 deletions
diff --git a/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java b/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java index 9b49f85..26c0bbd 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java +++ b/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java @@ -1794,6 +1794,7 @@ public class MclStorageManager switch (evt.getEventID()) { + case MetaContactGroupEvent.CONTACT_GROUP_RENAMED_IN_META_GROUP: case MetaContactGroupEvent.CONTACT_GROUP_REMOVED_FROM_META_GROUP: case MetaContactGroupEvent.CONTACT_GROUP_ADDED_TO_META_GROUP: // the fact that a contact group was added or removed to a @@ -1830,9 +1831,6 @@ public class MclStorageManager mcGroupNode .setAttribute(GROUP_NAME_ATTR_NAME, mcGroup.getGroupName()); break; - case MetaContactGroupEvent.CONTACT_GROUP_RENAMED_IN_META_GROUP: - // proto group names are not stored so ignore. - break; } try diff --git a/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java b/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java index 3879603..54b6d35 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java +++ b/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java @@ -1062,7 +1062,11 @@ public class MetaContactGroupImpl return true; } - return false; + // this is new and empty group, we can store it as user want this + if(countContactGroups() == 0) + return true; + else + return false; } /** diff --git a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java index 387fa90..b4deda0 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java +++ b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java @@ -770,6 +770,34 @@ public class MetaContactListServiceImpl { ( (MetaContactGroupImpl) group).setGroupName(newGroupName); + Iterator<ContactGroup> groups = group.getContactGroups(); + + while (groups.hasNext()) + { + ContactGroup protoGroup = groups.next(); + + //get a persistent presence operation set + OperationSetPersistentPresence opSetPresence + = protoGroup + .getProtocolProvider() + .getOperationSet( + OperationSetPersistentPresence.class); + + if (opSetPresence != null) + { + try + { + opSetPresence.renameServerStoredContactGroup( + protoGroup, newGroupName); + } + catch(Throwable t) + { + logger.error("Error renaming protocol group: " + + protoGroup, t); + } + } + } + fireMetaContactGroupEvent(group, null, null , MetaContactGroupEvent.META_CONTACT_GROUP_RENAMED); } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java index fd7cd84..cea43d1 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java @@ -17,6 +17,8 @@ import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; +import javax.swing.*; + /** * The <tt>MetaContactListSource</tt> is an abstraction of the * <tt>MetaContactListService</tt>, which makes the correspondence between a @@ -601,6 +603,22 @@ public class MetaContactListSource */ public void metaContactMoved(final MetaContactMovedEvent evt) { + // fixes an issue with moving meta contacts where removeContact + // will set data to null in swing thread and it will be after we have + // set the data here, so we also move this set to the swing thread + // to order the calls of setData. + if (!SwingUtilities.isEventDispatchThread()) + { + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + metaContactMoved(evt); + } + }); + return; + } + final MetaContact metaContact = evt.getSourceMetaContact(); final MetaContactGroup oldParent = evt.getOldParent(); final MetaContactGroup newParent = evt.getNewParent(); @@ -628,8 +646,7 @@ public class MetaContactListSource GuiActivator.getContactList().removeContact(uiContact); // Add the contact to the new place. - uiContact = MetaContactListSource.createUIContact( - evt.getSourceMetaContact()); + uiContact = MetaContactListSource.createUIContact(metaContact); UIGroup newUIGroup = null; if (!MetaContactListSource.isRootGroup(newParent)) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java index a328034..1f19dd7 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java @@ -495,19 +495,12 @@ public class ContactGroupJabberImpl } /** - * Change the source group - * change the buddies + * Change the source group, used when renaming groups. * * @param newGroup RosterGroup */ void setSourceGroup(RosterGroup newGroup) { this.id = newGroup.getName(); - - // clear current buddies . new entries will be added - buddies.clear(); - - for (RosterEntry item : newGroup.getEntries()) - addContact( new ContactJabberImpl(item, ssclCallback, true, true) ); } } |