<No Comment Entered>

cusax-fix
Emil Ivov 20 years ago
parent 327a355ab2
commit 8e5c356885

@ -131,10 +131,12 @@
<include name="**/*.au"/> <include name="**/*.au"/>
<include name="**/*.gif"/> <include name="**/*.gif"/>
<include name="**/*.png"/> <include name="**/*.png"/>
<include name="**/*.PNG"/>
<include name="**/*.jpg"/> <include name="**/*.jpg"/>
<include name="**/*.properties"/> <include name="**/*.properties"/>
<include name="**/*.xml"/> <include name="**/*.xml"/>
<include name="**/*"/> <include name="**/*.themerc"/>
<include name="**/gtkrc"/>
</fileset> </fileset>
<fileset dir="${src2}"> <fileset dir="${src2}">
<include name="**/*.jpeg"/> <include name="**/*.jpeg"/>
@ -625,5 +627,18 @@ javax.swing.event, javax.swing.border"/>
</jar> </jar>
</target> </target>
<target name="dupe">
<copy todir="/tmp/dupe1"><fileset dir="${src}">
<include name="**/*.jpeg"/>
<include name="**/*.wav"/>
<include name="**/*.au"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/gtkrc"/>
</fileset></copy>
</target>
</project> </project>

@ -28,9 +28,11 @@ public class MetaContactGroupImpl
private final List dummySubgroupsList = new LinkedList(); private final List dummySubgroupsList = new LinkedList();
/** /**
* The protocol specific group that this groups encapsulates. * All protocol specific contact groups encapsulated by this
* <tt>MetaContactGoup</tt>.
*/ */
private Vector protoGroups = new Vector(); private Hashtable protoGroups = new Hashtable();
private String groupName = null; private String groupName = null;
@ -168,17 +170,19 @@ public Iterator getSubgroups()
} }
/** /**
* Returns an <tt>Iterator</tt> over all protocol specific groups that * Adds the specified <tt>group</tt> to the list of protocol specific
* this group encapsulates. * groups merged by this MetaContactGroup.
* @return Iterator * @param owner the ProtocolProviderService where the specified group came
* from.
* @param group the <tt>ContactGroup</tt> to add merge into this
* MetaContactGroup.
*/ */
Iterator getProtoGroups() public void addProtoGroup(ProtocolProviderService owner,
ContactGroup group)
{ {
return protoGroups.iterator(); this.protoGroups.put(owner, group);
} }
// public void addProtoGroup(ContactGroup group)
/** /**
* Verifies whether a protocol specific ContactGroup with the specified * Verifies whether a protocol specific ContactGroup with the specified
* name and originating from the specified provider is encapsulated by this * name and originating from the specified provider is encapsulated by this

@ -26,6 +26,9 @@
* properly if the underlying service providers have already been loaded at the * properly if the underlying service providers have already been loaded at the
* time this one gets started. * time this one gets started.
* *
* @todo might be a good idea to say that the implementation does not support
* subgroups.
*
* @author Emil Ivov * @author Emil Ivov
*/ */
public class MetaContactListServiceImpl public class MetaContactListServiceImpl
@ -332,17 +335,39 @@ public MetaContact findMetaContactByID(String metaContactID)
* sure they are all present in the local contact list. * sure they are all present in the local contact list.
* @param presenceOpSet the presence operation set whose contact list we'd * @param presenceOpSet the presence operation set whose contact list we'd
* like to synchronize with the local contact list. * like to synchronize with the local contact list.
* @param provider the provider that the operation set belongs to.
*/ */
private void synchronizeOpSetWithServerContactList( private void synchronizeOpSetWithServerContactList(
ProtocolProviderService provider,
OperationSetPersistentPresence presenceOpSet) OperationSetPersistentPresence presenceOpSet)
{ {
ContactGroup rootProtoGroup ContactGroup rootProtoGroup
= presenceOpSet.getServerStoredContactListRoot(); = presenceOpSet.getServerStoredContactListRoot();
logger.trace("subgroups: " + rootProtoGroup.countSubGroups());
//first register the root group
rootMetaGroup.registerProtocolSpecificRoot(
provider,
presenceOpSet.getServerStoredContactListRoot());
// rootMetaGroup.addSubgroup(); //register subgroups and contacts
//this implementation only supports one level of groups apart from
//the root group - so let's keep this simple and do it in a nested loop
Iterator subgroupsIter = rootMetaGroup.getSubgroups();
logger.trace("subgroups: " + rootProtoGroup.countSubGroups()); while(subgroupsIter.hasNext())
{
ContactGroup group = (ContactGroup)subgroupsIter.next();
//right now we simply map this group to an existing one
//without being cautious and verify whether we already have it
//registered
MetaContactGroupImpl newMetaGroup
= new MetaContactGroupImpl(group.getGroupName());
newMetaGroup.addProtoGroup(provider, group);
}
} }
/** /**
@ -367,7 +392,7 @@ private void handleProviderAdded(ProtocolProviderService provider)
//If we have a persistent presence op set - then retrieve its contat //If we have a persistent presence op set - then retrieve its contat
//list and merge it with the local one. //list and merge it with the local one.
if( opSetPersPresence != null ){ if( opSetPersPresence != null ){
synchronizeOpSetWithServerContactList(opSetPersPresence); synchronizeOpSetWithServerContactList(provider, opSetPersPresence);
} }
/** @todo implement handling non persistent presence operation sets */ /** @todo implement handling non persistent presence operation sets */

@ -3,6 +3,7 @@
import java.util.*; import java.util.*;
import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*;
/** /**
* An implementation of the meta contact group that would only be used for the * An implementation of the meta contact group that would only be used for the
@ -23,8 +24,17 @@ public class RootMetaContactGroupImpl
*/ */
private List dummyContacts = new LinkedList(); private List dummyContacts = new LinkedList();
/**
* The name of the group (fixed for root groups since it won't show).
*/
private static final String groupName = "RootMetaContactGroup"; private static final String groupName = "RootMetaContactGroup";
/**
* The root groups for all protocol contact lists that we've detected so
* far, mapped against their owner protocol providers.
*/
private Hashtable protoGroups = new Hashtable();
/** /**
* Creates an instance of the root meta contact group. * Creates an instance of the root meta contact group.
*/ */
@ -158,11 +168,17 @@ public String getGroupName()
return groupName; return groupName;
} }
/**
* Addes the specified group to the list of protocol specific roots
void addProtocolSpecificGroup() * that we're encapsulating in this meta contact list.
* @param protoRoot the root to add to the groups merged in this meta contact
* group.
* @param ownerProtocol the protocol that the specified group came from.
*/
void registerProtocolSpecificRoot(
ProtocolProviderService ownerProtocol, ContactGroup protoRoot)
{ {
protoGroups.put(ownerProtocol, protoRoot);
} }
/** /**
@ -177,7 +193,7 @@ void addSubgroup(MetaContactGroup subgroup)
/** /**
* Removes the meta contact group with the specified index. * Removes the meta contact group with the specified index.
* @param the <tt>index</tt> index of the group to remove. * @param index the index of the group to remove.
* @return the <tt>MetaContactGroup</tt> that has just been removed. * @return the <tt>MetaContactGroup</tt> that has just been removed.
*/ */
MetaContactGroupImpl removeSubgroup(int index) MetaContactGroupImpl removeSubgroup(int index)

@ -73,4 +73,10 @@ public interface MetaContact
* @return a human readable String that represents this meta contact. * @return a human readable String that represents this meta contact.
*/ */
public String getDisplayName(); public String getDisplayName();
/**
* Returns a String representation of this <tt>MetaContact</tt>.
* @return a String representation of this <tt>MetaContact</tt>.
*/
public String toString();
} }

@ -112,4 +112,11 @@ public MetaContact getMetaContact(int index)
public MetaContactGroup getMetaContactSubgroup(int index) public MetaContactGroup getMetaContactSubgroup(int index)
throws IndexOutOfBoundsException; throws IndexOutOfBoundsException;
/**
* Returns a String representation of this group and the contacts it
* contains (may turn out to be a relatively long string).
* @return a String representing this group and its child contacts.
*/
public String toString();
} }

@ -99,4 +99,11 @@ public void removeRegistrationStateChangeListener(
* collection. * collection.
*/ */
public void shutdown(); public void shutdown();
/**
* A hashcode allowing usage of protocol providers as keys in Hashtables.
* @return an int that may be used when storing protocol providers as
* hashtable keys.
*/
public int hashCode();
} }

Loading…
Cancel
Save