[sip-comm-dev] Duplicated groups and contacts


#1

Hi Emil,

after Damian committed the implementation of Jabber two problems occurred in the GUI. One of them was that some contacts were shown two times and others not at all. This was a problem of indexing the contact list in the case when we have contacts that are contained directly in the root group. I've fixed this problem.

Another problem was that some groups were duplicated. I've debugged the problem and I found that it comes from the MclStorageManager in the method processGroupXmlNode. This method should load all contacts and groups for an account. The problem is that the meta contact group is created in the beginning before checking if it contains a proto group for the given account, thus if there are no proto groups for the given account an empty meta group is created and added in the contact list. I have fixed that in the following way:

The code was:

*//create the meta group
                        currentMetaGroup = mclServiceImpl
                            .loadStoredMetaContactGroup(parentGroup
                                                        , groupMetaUID

···

, groupDisplayName);*

//extract and load one by one all proto groups in this meta group.
            Node protoGroupsNode = XMLUtils.findChild(
                groupNode, PROTO_GROUPS_NODE_NAME);

            NodeList protoGroups = protoGroupsNode.getChildNodes();

            for (int i = 0; i < protoGroups.getLength(); i++)
            {
                Node currentProtoGroupNode = protoGroups.item(i);

                if (currentProtoGroupNode.getNodeType() != Node.ELEMENT_NODE)
                    continue;

                String groupAccountID = XMLUtils.getAttribute(
                    currentProtoGroupNode, ACCOUNT_ID_ATTR_NAME);

                *if (!accountID.equals(groupAccountID))
                    continue;*
.....................

And now is:

//extract and load one by one all proto groups in this meta group.
            Node protoGroupsNode = XMLUtils.findChild(
                groupNode, PROTO_GROUPS_NODE_NAME);

            NodeList protoGroups = protoGroupsNode.getChildNodes();

            for (int i = 0; i < protoGroups.getLength(); i++)
            {
                Node currentProtoGroupNode = protoGroups.item(i);

                if (currentProtoGroupNode.getNodeType() != Node.ELEMENT_NODE)
                    continue;

                String groupAccountID = XMLUtils.getAttribute(
                    currentProtoGroupNode, ACCOUNT_ID_ATTR_NAME);

                *if (!accountID.equals(groupAccountID)) {
                    continue;
                }
                else {
                  ** if(currentMetaGroup == null) {
                        //create the meta group
                        currentMetaGroup = mclServiceImpl
                            .loadStoredMetaContactGroup(parentGroup
                                                        , groupMetaUID
                                                        , groupDisplayName);
                    }
                }
*
Do you want me to commit changes I've made or you prefer handling the issue yourself?

Regards,
Yana


#2

Hello Yana,

Yana Stamcheva wrote:

Hi Emil,

after Damian committed the implementation of Jabber two problems occurred in the GUI. One of them was that some contacts were shown two times and others not at all. This was a problem of indexing the contact list in the case when we have contacts that are contained directly in the root group. I've fixed this problem.

Great! That was bothering me a bit, so thanks for acting so quickly on it.

Another problem was that some groups were duplicated. I've debugged the problem and I found that it comes from the MclStorageManager in the method processGroupXmlNode. This method should load all contacts and groups for an account. The problem is that the meta contact group is created in the beginning before checking if it contains a proto group for the given account, thus if there are no proto groups for the given account an empty meta group is created and added in the contact list. I have fixed that in the following way:

I don't really understand how this was causing the duplicate groups problem.

As for empty groups being loaded, I believe this is how things should happen. If for example I create a "friends" in my contact list but don't add contacts to it and then restart the application (e.g. because I ran out of battery power), I would still like to see the group being loaded next time I start the SIP Communicator. Or imagine that I had this friends group only filled with jabber contacts, then I remove my jabber account. I'd still like to see the group so that I am able to fill it with, ICQ contacts, or contacts coming from another jabber account.

In other words - meta groups should only disappear after they have been manually removed by the user.

Does this make sense?

Emil

···

The code was:

*//create the meta group
                        currentMetaGroup = mclServiceImpl
                            .loadStoredMetaContactGroup(parentGroup
                                                        , groupMetaUID
                                                        , groupDisplayName);*

//extract and load one by one all proto groups in this meta group.
            Node protoGroupsNode = XMLUtils.findChild(
                groupNode, PROTO_GROUPS_NODE_NAME);

            NodeList protoGroups = protoGroupsNode.getChildNodes();

            for (int i = 0; i < protoGroups.getLength(); i++)
            {
                Node currentProtoGroupNode = protoGroups.item(i);

                if (currentProtoGroupNode.getNodeType() != Node.ELEMENT_NODE)
                    continue;

                String groupAccountID = XMLUtils.getAttribute(
                    currentProtoGroupNode, ACCOUNT_ID_ATTR_NAME);

                *if (!accountID.equals(groupAccountID))
                    continue;*
.....................

And now is:

//extract and load one by one all proto groups in this meta group.
            Node protoGroupsNode = XMLUtils.findChild(
                groupNode, PROTO_GROUPS_NODE_NAME);

            NodeList protoGroups = protoGroupsNode.getChildNodes();

            for (int i = 0; i < protoGroups.getLength(); i++)
            {
                Node currentProtoGroupNode = protoGroups.item(i);

                if (currentProtoGroupNode.getNodeType() != Node.ELEMENT_NODE)
                    continue;

                String groupAccountID = XMLUtils.getAttribute(
                    currentProtoGroupNode, ACCOUNT_ID_ATTR_NAME);

                *if (!accountID.equals(groupAccountID)) {
                    continue;
                }
                else {
                  ** if(currentMetaGroup == null) {
                        //create the meta group
                        currentMetaGroup = mclServiceImpl
                            .loadStoredMetaContactGroup(parentGroup
                                                        , groupMetaUID
                                                        , groupDisplayName);
                    }
                }
*
Do you want me to commit changes I've made or you prefer handling the issue yourself?

Regards,
Yana


#3

Hi Emil,

Emil Ivov wrote:

I don't really understand how this was causing the duplicate groups problem.

As for empty groups being loaded, I believe this is how things should happen. If for example I create a "friends" in my contact list but don't add contacts to it and then restart the application (e.g. because I ran out of battery power), I would still like to see the group being loaded next time I start the SIP Communicator. Or imagine that I had this friends group only filled with jabber contacts, then I remove my jabber account. I'd still like to see the group so that I am able to fill it with, ICQ contacts, or contacts coming from another jabber account.

In other words - meta groups should only disappear after they have been manually removed by the user.

Does this make sense?

Emil

Yes this make sense, but the problem is still there. The problem is in fact that this method is meant to load groups and meta contacts for AN ACCOUNT, thus for each account this method is invoked and when going through the contact list xml each time all meta group nodes are loaded. And after all you have all meta groups duplicated. Because a meta group is not corresponding to a particular account may be you should create all meta groups before loading all particular account contacts and protogroups. You should better have a look yourself.

Regards,
Yana

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Yana Stamcheva wrote:

Yes this makes sense, but the problem is still there. The problem is in fact that this method is meant to load groups and meta contacts for AN ACCOUNT, thus for each account this method is invoked and when going through the contact list xml each time all meta group nodes are loaded.

OK I understand now. Good catch! Then I guess, we could fix that in the

loadStoredMetaContactGroup( ... )

and make it verify whether a group with the specified uid has already been created.

I'll do that right away.

Cheers
Emil

···

And after all you have all meta groups duplicated. Because a meta group is not corresponding to a particular account may be you should create all meta groups before loading all particular account contacts and protogroups. You should better have a look yourself.

Regards,
Yana

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net