Methods Summary |
---|
public abstract void | acceptInvitationAsync(Invitation invitation)Accepts an invitation. The user will join the group automatically after
accept the invitation.
|
public void | acceptInvitationAsync(java.lang.String inviteId)Accepts an invitation. The user can only accept or reject the same
invitation only once.
Invitation invitation = mInvitations.remove(inviteId);
if (invitation != null) {
acceptInvitationAsync(invitation);
}
|
public void | addGroupListener(GroupListener listener)Adds a GroupListener to this manager so that it will be notified when a
certain group changes.
mGroupListeners.add(listener);
|
protected abstract void | addGroupMemberAsync(ChatGroup group, Contact contact)Adds a member to a certain ChatGroup. This method returns immediately and
the GroupGroupListeners registered on the group will be notified when the
member is added or any error occurs. Only the administrator of the
ChatGroup can add member to it.
|
public abstract void | createChatGroupAsync(java.lang.String name)Creates a new ChatGroup with specified name. This method returns
immediately and the registered GroupListeners will be notified when the
group is created or any error occurs. The newly created group is a
temporary group and will be automatically deleted when all joined users
have left.
|
public abstract void | deleteChatGroupAsync(ChatGroup group)Deletes a certain ChatGroup. This method returns immediately and the
registered GroupListeners will be notified when the group is deleted or
any error occurs. Only the administrator of the ChatGroup can delete it.
|
public ChatGroup | getChatGroup(Address address)Gets a ChatGroup by address.
return mGroups.get(address);
|
public abstract void | inviteUserAsync(ChatGroup group, Contact invitee)Invites a user to join a certain ChatGroup. If success, the invitee will
receive an invitation with information of the group. Otherwise, the
registered GroupListeners will be notified if any error occurs.
|
public abstract void | joinChatGroupAsync(Address address)Joins into a certain ChatGroup. This method returns immediately and the
registered GroupListeners will be notified when the user joined into the
group or any error occurs.
|
public abstract void | leaveChatGroupAsync(ChatGroup group)Leaves a certain ChatGroup.This method returns immediately and the
registered GroupListeners will be notified when the the user left the
group or any error occurs.
|
protected void | notifyGroupChanged(Address groupAddress, java.util.ArrayList joined, java.util.ArrayList left)Notifies the GroupListeners that a ChatGroup has changed.
ChatGroup group = mGroups.get(groupAddress);
if (group == null) {
group = new ChatGroup(groupAddress, groupAddress.getScreenName(), this);
mGroups.put(groupAddress, group);
}
if (joined != null) {
for (Contact contact : joined) {
notifyMemberJoined(group, contact);
}
}
if (left != null) {
for (Contact contact : left) {
notifyMemberLeft(group, contact);
}
}
|
protected synchronized void | notifyGroupCreated(ChatGroup group)
mGroups.put(group.getAddress(), group);
for (GroupListener listener : mGroupListeners) {
listener.onGroupCreated(group);
}
|
protected synchronized void | notifyGroupDeleted(ChatGroup group)
mGroups.remove(group.getAddress());
for (GroupListener listener : mGroupListeners) {
listener.onGroupDeleted(group);
}
|
protected synchronized void | notifyGroupError(int errorType, java.lang.String groupName, ImErrorInfo error)
for (GroupListener listener : mGroupListeners) {
listener.onGroupError(errorType, groupName, error);
}
|
protected synchronized void | notifyGroupInvitation(Invitation invitation)Notifies the InvitationListener that another user invited the current
logged user to join a group chat.
mInvitations.put(invitation.getInviteID(), invitation);
if (mInvitationListener != null) {
mInvitationListener.onGroupInvitation(invitation);
}
|
protected void | notifyGroupMemberError(ChatGroup group, ImErrorInfo error)Notifies that previous operation on this group has failed.
group.notifyGroupMemberError(error);
|
protected synchronized void | notifyJoinedGroup(ChatGroup group)
mGroups.put(group.getAddress(), group);
for (GroupListener listener : mGroupListeners) {
listener.onJoinedGroup(group);
}
|
protected synchronized void | notifyLeftGroup(ChatGroup group)Notifies the GroupListeners that the user has left a certain group.
mGroups.remove(group.getAddress());
for (GroupListener listener : mGroupListeners) {
listener.onLeftGroup(group);
}
|
protected void | notifyMemberJoined(ChatGroup group, Contact contact)Notifies that a contact has joined into this group.
group.notifyMemberJoined(contact);
|
protected void | notifyMemberLeft(ChatGroup group, Contact contact)Notifies that a contact has left this group.
group.notifyMemberLeft(contact);
|
public void | rejectInvitationAsync(java.lang.String inviteId)Rejects an invitation.
Invitation invitation = mInvitations.remove(inviteId);
if (invitation != null) {
rejectInvitationAsync(invitation);
}
|
public abstract void | rejectInvitationAsync(Invitation invitation)Rejects an invitation.
|
public void | removeGroupListener(GroupListener listener)Removes a GroupListener from this manager so that it won't be notified
any more.
mGroupListeners.remove(listener);
|
protected abstract void | removeGroupMemberAsync(ChatGroup group, Contact contact)Removes a member from certain ChatGroup. This method returns immediately
and the GroupGroupListeners registered on the group will be notified when
the member is added or any error occurs. Only the administrator of the
ChatGroup can remove its members.
|
public synchronized void | setInvitationListener(InvitationListener listener)Sets the InvitationListener to the manager so that it will be notified
when an invitation from another users received.
mInvitationListener = listener;
|