FileDocCategorySizeDatePackage
ChatGroup.javaAPI DocAndroid 1.5 API3937Wed May 06 22:42:46 BST 2009com.android.im.engine

ChatGroup

public class ChatGroup extends ImEntity

Fields Summary
private ChatGroupManager
mManager
private Address
mAddress
private String
mName
private Vector
mMembers
private CopyOnWriteArrayList
mMemberListeners
Constructors Summary
public ChatGroup(Address address, String name, ChatGroupManager manager)

        this(address, name, null, manager);
    
public ChatGroup(Address address, String name, Collection members, ChatGroupManager manager)

        mAddress = address;
        mName = name;
        mManager = manager;
        mMembers = new Vector<Contact>();

        if(members != null) {
            mMembers.addAll(members);
        }
        mMemberListeners = new CopyOnWriteArrayList<GroupMemberListener>();
    
Methods Summary
public synchronized voidaddMemberAsync(Contact contact)
Adds a member to this group. TODO: more docs on async callbacks.

param
contact the member to add.

        mManager.addGroupMemberAsync(this, contact);
    
public voidaddMemberListener(GroupMemberListener listener)

        mMemberListeners.add(listener);
    
public AddressgetAddress()

        return mAddress;
    
public java.util.ListgetMembers()
Gets an unmodifiable collection of the members of the group.

return
an unmodifiable collection of the members of the group.

        return Collections.unmodifiableList(mMembers);
    
public java.lang.StringgetName()
Gets the name of the group.

return
the name of the group.

        return mName;
    
voidnotifyGroupMemberError(ImErrorInfo error)
Notifies that previous operation on this group has failed.

param
error the error information.

        for(GroupMemberListener listener : mMemberListeners) {
            listener.onError(this, error);
        }
    
voidnotifyMemberJoined(Contact contact)
Notifies that a contact has joined into this group.

param
contact the contact who has joined into the group.

        mMembers.add(contact);
        for(GroupMemberListener listener : mMemberListeners) {
            listener.onMemberJoined(this, contact);
        }
    
voidnotifyMemberLeft(Contact contact)
Notifies that a contact has left this group.

param
contact the contact who has left this group.

        if(mMembers.remove(contact)) {
            for(GroupMemberListener listener : mMemberListeners) {
                listener.onMemberLeft(this, contact);
            }
        }
    
public synchronized voidremoveMemberAsync(Contact contact)
Removes a member from this group. TODO: more docs on async callbacks.

param
contact the member to remove.

        mManager.removeGroupMemberAsync(this, contact);
    
public voidremoveMemberListener(GroupMemberListener listener)

        mMemberListeners.remove(listener);