hyphenate_SDK3.0  3.8.6.1
hyphenate java IM SDK
Public Member Functions | List of all members
com.hyphenate.chat.EMChatRoomManager Class Reference

Public Member Functions

 EMChatRoomManager (EMClient client, EMAChatRoomManager manager)
 
void addChatRoomChangeListener (EMChatRoomChangeListener listener)
 
void removeChatRoomChangeListener (EMChatRoomChangeListener listener)
 
void removeChatRoomListener (EMChatRoomChangeListener listener)
 
void joinChatRoom (final String roomId, final EMValueCallBack< EMChatRoom > callback)
 
void leaveChatRoom (final String roomId)
 
EMPageResult< EMChatRoomfetchPublicChatRoomsFromServer (int pageNum, int pageSize) throws HyphenateException
 
EMCursorResult< EMChatRoomfetchPublicChatRoomsFromServer (int pageSize, String cursor) throws HyphenateException
 
void asyncFetchPublicChatRoomsFromServer (final int pageSize, final String cursor, final EMValueCallBack< EMCursorResult< EMChatRoom >> callback)
 
void asyncFetchPublicChatRoomsFromServer (final int pageNum, final int pageSize, final EMValueCallBack< EMPageResult< EMChatRoom >> callback)
 
EMChatRoom fetchChatRoomFromServer (String roomId) throws HyphenateException
 
EMChatRoom fetchChatRoomFromServer (String roomId, boolean fetchMembers) throws HyphenateException
 
void asyncFetchChatRoomFromServer (final String roomId, final EMValueCallBack< EMChatRoom > callback)
 
EMChatRoom getChatRoom (String roomId)
 
List< EMChatRoomgetAllChatRooms ()
 
EMChatRoom createChatRoom (String subject, String description, String welcomeMessage, int maxUserCount, List< String > members) throws HyphenateException
 
void asyncCreateChatRoom (final String subject, final String description, final String welcomeMessage, final int maxUserCount, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
void destroyChatRoom (String chatRoomId) throws HyphenateException
 
void asyncDestroyChatRoom (final String chatRoomId, final EMCallBack callBack)
 
EMChatRoom changeChatRoomSubject (String chatRoomId, String newSubject) throws HyphenateException
 
void asyncChangeChatRoomSubject (final String chatRoomId, final String newSubject, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom changeChatroomDescription (String chatRoomId, String newDescription) throws HyphenateException
 
void asyncChangeChatroomDescription (final String chatRoomId, final String newDescription, final EMValueCallBack< EMChatRoom > callBack)
 
EMCursorResult< String > fetchChatRoomMembers (String chatRoomId, String cursor, int pageSize) throws HyphenateException
 
void asyncFetchChatRoomMembers (final String chatRoomId, final String cursor, final int pageSize, final EMValueCallBack< EMCursorResult< String >> callBack)
 
EMChatRoom muteChatRoomMembers (String chatRoomId, List< String > muteMembers, long duration) throws HyphenateException
 
void asyncMuteChatRoomMembers (final String chatRoomId, final List< String > muteMembers, final long duration, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom unMuteChatRoomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncUnMuteChatRoomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom changeOwner (String chatRoomId, String newOwner) throws HyphenateException
 
void asyncChangeOwner (final String chatRoomId, final String newOwner, final EMValueCallBack< EMChatRoom > callBack) throws HyphenateException
 
EMChatRoom addChatRoomAdmin (String chatRoomId, String admin) throws HyphenateException
 
void asyncAddChatRoomAdmin (final String chatRoomId, final String admin, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom removeChatRoomAdmin (String chatRoomId, String admin) throws HyphenateException
 
void asyncRemoveChatRoomAdmin (final String chatRoomId, final String admin, final EMValueCallBack< EMChatRoom > callBack)
 
Map< String, Long > fetchChatRoomMuteList (String chatRoomId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchChatRoomMuteList (final String chatRoomId, final int pageNum, final int pageSize, final EMValueCallBack< Map< String, Long >> callBack)
 
EMChatRoom removeChatRoomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncRemoveChatRoomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom blockChatroomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncBlockChatroomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom unblockChatRoomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncUnBlockChatRoomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
List< String > fetchChatRoomBlackList (String chatRoomId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchChatRoomBlackList (final String chatRoomId, final int pageNum, final int pageSize, final EMValueCallBack< List< String >> callBack)
 
void addToChatRoomWhiteList (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
void removeFromChatRoomWhiteList (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
void checkIfInChatRoomWhiteList (final String chatRoomId, EMValueCallBack< Boolean > callBack)
 
void fetchChatRoomWhiteList (final String chatRoomId, final EMValueCallBack< List< String >> callBack)
 
void muteAllMembers (final String chatRoomId, final EMValueCallBack< EMChatRoom > callBack)
 
void unmuteAllMembers (final String chatRoomId, final EMValueCallBack< EMChatRoom > callBack)
 
void updateChatRoomAnnouncement (String chatRoomId, String announcement) throws HyphenateException
 
void asyncUpdateChatRoomAnnouncement (final String chatRoomId, final String announcement, final EMCallBack callBack)
 
String fetchChatRoomAnnouncement (String chatRoomId) throws HyphenateException
 
void asyncFetchChatRoomAnnouncement (final String chatRoomId, final EMValueCallBack< String > callBack)
 

Detailed Description

Chat room manager, responsible for chat room join, exit, list access and member rights management and so on Such as, join a chat room:

  EMClient.getInstance().chatroomManager().joinChatRoom(conversationId, new EMValueCallBack<EMChatRoom>() {
    public void onSuccess(EMChatRoom value) {
        //Do something after successfully joined the chat room
       }
    public void onError(int error, String errorMsg) {
        //Do something after fail to join the chat room
       }
    });

Member Function Documentation

◆ addChatRoomAdmin()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.addChatRoomAdmin ( String  chatRoomId,
String  admin 
) throws HyphenateException

Add chat room administrator Owner‘s authority is required Asynchronously method see asyncAddChatRoomAdmin(String, String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
adminAdmin id to set
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ addChatRoomChangeListener()

void com.hyphenate.chat.EMChatRoomManager.addChatRoomChangeListener ( EMChatRoomChangeListener  listener)

Register chat room change listener Chat room destruction, member entry and exit, silence, whitelisting and so on can be listened by setting EMChatRoomChangeListener

After calling this method need to call removeChatRoomListener(EMChatRoomChangeListener) at the appropriate time to remove the listener

Parameters
listenerChat room listener, see EMChatRoomChangeListener

◆ addToChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.addToChatRoomWhiteList ( final String  chatRoomId,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Add members to whitelist Owner or administrator‘s authority is required The whitelisted user is not affected when muteAllMembers(String, EMValueCallBack) is executed by owner or admins

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe member list to add
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncAddChatRoomAdmin()

void com.hyphenate.chat.EMChatRoomManager.asyncAddChatRoomAdmin ( final String  chatRoomId,
final String  admin,
final EMValueCallBack< EMChatRoom callBack 
)

Add chat room administrator Owner‘s authority is required Synchronization method see addChatRoomAdmin(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
adminAdmin id to set
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncBlockChatroomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncBlockChatroomMembers ( final String  chatRoomId,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Add members to chat room's black list Owner or administrator‘s authority is required As member is added to blacklist, have the following behaviors:

1.As member is added to blacklist, will be removed from chat room
2.Call the method EMChatRoomChangeListener#onRemovedFromChatRoom(int, String, String, String) to notice,
  the first parameter is the reason, which is EMAChatRoomManagerListener#BE_KICKED
3.The members have been added to blacklist are barred from rejoining

Synchronization method see blockChatroomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe member list to be added to blacklist
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncChangeChatroomDescription()

void com.hyphenate.chat.EMChatRoomManager.asyncChangeChatroomDescription ( final String  chatRoomId,
final String  newDescription,
final EMValueCallBack< EMChatRoom callBack 
)

Change chat room description Owner‘s authority is required Synchronization method see changeChatroomDescription(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
newDescriptionNew description of chat room
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncChangeChatRoomSubject()

void com.hyphenate.chat.EMChatRoomManager.asyncChangeChatRoomSubject ( final String  chatRoomId,
final String  newSubject,
final EMValueCallBack< EMChatRoom callBack 
)

Change chat room subject Owner‘s authority is required Synchronization method see changeChatRoomSubject(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
newSubjectNew name of chat room
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncChangeOwner()

void com.hyphenate.chat.EMChatRoomManager.asyncChangeOwner ( final String  chatRoomId,
final String  newOwner,
final EMValueCallBack< EMChatRoom callBack 
) throws HyphenateException

Transfer chat room ownership to others Owner‘s authority is required Synchronization method see changeOwner(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
newOwnerNew owner id
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncCreateChatRoom()

void com.hyphenate.chat.EMChatRoomManager.asyncCreateChatRoom ( final String  subject,
final String  description,
final String  welcomeMessage,
final int  maxUserCount,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Create chat room Synchronization method see createChatRoom(String, String, String, int, List)

Asynchronously method

Parameters
subjectName of chat room
descriptionDescription of chat room
welcomeMessageWelcome message inviting members to join the chat room
maxUserCountMaximum number of members allowed to join
membersMembers inviting to join
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncDestroyChatRoom()

void com.hyphenate.chat.EMChatRoomManager.asyncDestroyChatRoom ( final String  chatRoomId,
final EMCallBack  callBack 
)

Destroy chat room Owner‘s authority is required Synchronization method see destroyChatRoom(String)

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call EMCallBack#onSuccess(), failure call EMCallBack#onError(int, String)

◆ asyncFetchChatRoomAnnouncement()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomAnnouncement ( final String  chatRoomId,
final EMValueCallBack< String >  callBack 
)

Get the chat room announcement from server

Parameters
chatRoomIdChat room id
callBackResult callback, success call EMValueCallBack#onSuccess(Object), return the chat room announcement; failure call EMValueCallBack#onError(int, String)

◆ asyncFetchChatRoomBlackList()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomBlackList ( final String  chatRoomId,
final int  pageNum,
final int  pageSize,
final EMValueCallBack< List< String >>  callBack 
)

Fetch chat room black list members in pages Owner or administrator‘s authority is required Synchronization method see fetchChatRoomBlackList(String, int, int)

Asynchronously method

Parameters
chatRoomIdChat room id
pageNumPage number, start from 1
pageSizeSize to be fetched per page
callBackResult callback, success call EMValueCallBack#onSuccess(Object), return the blacklist in chat room; failure call EMValueCallBack#onError(int, String)

◆ asyncFetchChatRoomFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomFromServer ( final String  roomId,
final EMValueCallBack< EMChatRoom callback 
)

Fetch the chat room from server by room id, default not to fetch members Synchronization method see fetchChatRoomFromServer(String)

Asynchronously method

Parameters
roomIdChat room id
callbackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncFetchChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomMembers ( final String  chatRoomId,
final String  cursor,
final int  pageSize,
final EMValueCallBack< EMCursorResult< String >>  callBack 
)

Fetch chat room member list When EMCursorResult.getCursor() is an empty string ("") in the result, there is no more data

Asynchronously method

Parameters
chatRoomIdChat room id
cursorThe cursor position to fetch data
pageSizeThe count fetched a time
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncFetchChatRoomMuteList()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomMuteList ( final String  chatRoomId,
final int  pageNum,
final int  pageSize,
final EMValueCallBack< Map< String, Long >>  callBack 
)

Fetch mute list from server, which contains mute members and mute time Owner or administrator‘s authority is required Synchronization method see fetchChatRoomMuteList(String, int, int)

Asynchronously method

Parameters
chatRoomIdChat room id
pageNumThe count fetched a time
pageSizeThe cursor position to fetch data
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncFetchPublicChatRoomsFromServer() [1/2]

void com.hyphenate.chat.EMChatRoomManager.asyncFetchPublicChatRoomsFromServer ( final int  pageNum,
final int  pageSize,
final EMValueCallBack< EMPageResult< EMChatRoom >>  callback 
)

Fetch the chat rooms in page

Asynchronously method

Parameters
pageNumPage number, start from 1
pageSizeSize to be fetched per page
callbackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncFetchPublicChatRoomsFromServer() [2/2]

void com.hyphenate.chat.EMChatRoomManager.asyncFetchPublicChatRoomsFromServer ( final int  pageSize,
final String  cursor,
final EMValueCallBack< EMCursorResult< EMChatRoom >>  callback 
)

Fetch the chat rooms in page When EMCursorResult.getCursor() is an empty string ("") in the result, there is no more data

Asynchronously method

Parameters
pageSizeThe count fetched a time
cursorThe cursor position to fetch data
callbackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)
Deprecated:
Use asyncFetchPublicChatRoomsFromServer(int, int, EMValueCallBack) instead

◆ asyncMuteChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncMuteChatRoomMembers ( final String  chatRoomId,
final List< String >  muteMembers,
final long  duration,
final EMValueCallBack< EMChatRoom callBack 
)

Stop members post message for some time Owner or administrator‘s authority is required Synchronization method see muteChatRoomMembers(String, List, long)

Asynchronously method

Parameters
chatRoomIdChat room id
muteMembersMute members list
durationMute duration, in milli-seconds
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncRemoveChatRoomAdmin()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAdmin ( final String  chatRoomId,
final String  admin,
final EMValueCallBack< EMChatRoom callBack 
)

Remove administrator's authority in chat room Owner‘s authority is required Synchronization method see removeChatRoomAdmin(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
adminAdmin id to remove
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncRemoveChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomMembers ( final String  chatRoomId,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Remove chat room members Owner or administrator‘s authority is required Synchronization method see removeChatRoomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe members list to be removed
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncUnBlockChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncUnBlockChatRoomMembers ( final String  chatRoomId,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Remove members from chat room's black list Owner or administrator‘s authority is required Synchronization method see unblockChatRoomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe members list will be removed from blacklist
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncUnMuteChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncUnMuteChatRoomMembers ( final String  chatRoomId,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Release mute Owner or administrator‘s authority is required Synchronization method see unMuteChatRoomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersRelease mute members list
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ asyncUpdateChatRoomAnnouncement()

void com.hyphenate.chat.EMChatRoomManager.asyncUpdateChatRoomAnnouncement ( final String  chatRoomId,
final String  announcement,
final EMCallBack  callBack 
)

Update chat room announcement Owner or administrator‘s authority is required Synchronization method see updateChatRoomAnnouncement(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
announcementAnnouncement content
callBackResult callback, success call EMCallBack#onSuccess(), failure call EMCallBack#onError(int, String)

◆ blockChatroomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.blockChatroomMembers ( String  chatRoomId,
List< String >  members 
) throws HyphenateException

Add members to chat room's black list Owner or administrator‘s authority is required As member is added to blacklist, have the following behaviors:

1.As member is added to blacklist, will be removed from chat room
2.Call the method EMChatRoomChangeListener#onRemovedFromChatRoom(int, String, String, String) to notice,
  the first parameter is the reason, which is EMAChatRoomManagerListener#BE_KICKED
3.The members have been added to blacklist are barred from rejoining

Asynchronously method see asyncBlockChatroomMembers(String, List, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersThe member list to be added to blacklist
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ changeChatroomDescription()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeChatroomDescription ( String  chatRoomId,
String  newDescription 
) throws HyphenateException

change chat room description Owner‘s authority is required Asynchronously method see asyncChangeChatroomDescription(String, String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
newDescriptionNew description of chat room
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ changeChatRoomSubject()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeChatRoomSubject ( String  chatRoomId,
String  newSubject 
) throws HyphenateException

Change chat room subject Owner‘s authority is required Asynchronously method see asyncChangeChatRoomSubject(String, String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
newSubjectNew name of chat room
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ changeOwner()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeOwner ( String  chatRoomId,
String  newOwner 
) throws HyphenateException

Transfer chat room ownership to others Owner‘s authority is required Asynchronously method see asyncChangeOwner(String, String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
newOwnerNew owner id
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ checkIfInChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.checkIfInChatRoomWhiteList ( final String  chatRoomId,
EMValueCallBack< Boolean >  callBack 
)

Check if in whitelist

Asynchronously method

Parameters
chatRoomIdchat room id
callBackResult callback, success call EMValueCallBack#onSuccess(Object), return the result if in whitelist failure call EMValueCallBack#onError(int, String)

◆ createChatRoom()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.createChatRoom ( String  subject,
String  description,
String  welcomeMessage,
int  maxUserCount,
List< String >  members 
) throws HyphenateException

Create chat room

Synchronization method will block the current thread

Parameters
subjectName of chat room
descriptionDescription of chat room
welcomeMessageWelcome message inviting members to join the chat room
maxUserCountMaximum number of members allowed to join
membersMembers inviting to join
Returns
EMChatRoom EMChatRoom instance created successful
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ destroyChatRoom()

void com.hyphenate.chat.EMChatRoomManager.destroyChatRoom ( String  chatRoomId) throws HyphenateException

Destroy chat room Owner‘s authority is required Asynchronously method see asyncDestroyChatRoom(String, EMCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ fetchChatRoomAnnouncement()

String com.hyphenate.chat.EMChatRoomManager.fetchChatRoomAnnouncement ( String  chatRoomId) throws HyphenateException

Get the chat room announcement from server

Parameters
chatRoomIdChat room id
Returns
Chat room announcement
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ fetchChatRoomBlackList()

List<String> com.hyphenate.chat.EMChatRoomManager.fetchChatRoomBlackList ( String  chatRoomId,
int  pageNum,
int  pageSize 
) throws HyphenateException

Fetch chat room black list members in pages Owner or administrator‘s authority is required Asynchronously method see asyncFetchChatRoomBlackList(String, int, int, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
pageNumPage number, start from 1
pageSizeSize to be fetched per page
Returns
Return the blacklist in chat room
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ fetchChatRoomFromServer() [1/2]

EMChatRoom com.hyphenate.chat.EMChatRoomManager.fetchChatRoomFromServer ( String  roomId) throws HyphenateException

Fetch the chat room from server by room id, default not to fetch members Asynchronous method see asyncFetchChatRoomFromServer(String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
roomIdChat room id
Returns
EMChatRoom Return the EMChatRoom instance
Exceptions
HyphenateExceptionError code, see com.hyphenate.EMError

◆ fetchChatRoomFromServer() [2/2]

EMChatRoom com.hyphenate.chat.EMChatRoomManager.fetchChatRoomFromServer ( String  roomId,
boolean  fetchMembers 
) throws HyphenateException

Fetch the chat room from server by room id. If fetchMembers is true, default maximum of fetched member count is 200, to continue fetch members, call EMChatRoomManager#fetchChatRoomMembers(String, String, int)

Synchronization method will block the current thread

Parameters
roomIdchat room id
fetchMembersWhether you need to get chat room members
Returns
EMChatRoom Return the EMChatRoom instance
Exceptions
HyphenateExceptionError code, see com.hyphenate.EMError

◆ fetchChatRoomMembers()

EMCursorResult<String> com.hyphenate.chat.EMChatRoomManager.fetchChatRoomMembers ( String  chatRoomId,
String  cursor,
int  pageSize 
) throws HyphenateException

Fetch chat room member list When EMCursorResult.getCursor() is an empty string ("") in the result, there is no more data As the synchronization method, can use asynchronous method asyncFetchChatRoomMembers(String, String, int, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
cursorThe cursor position to fetch data
pageSizeThe count fetched a time
Returns
Fetch result, see EMCursorResult
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ fetchChatRoomMuteList()

Map<String, Long> com.hyphenate.chat.EMChatRoomManager.fetchChatRoomMuteList ( String  chatRoomId,
int  pageNum,
int  pageSize 
) throws HyphenateException

Fetch mute list from server, which contains mute members and mute time Owner or administrator‘s authority is required Asynchronously method see asyncFetchChatRoomMuteList(String, int, int, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
pageNumThe count fetched a time
pageSizeThe cursor position to fetch data
Returns
Return a map which contains the mute member id and mute duration, in which the key of each entry is the mute member id and the value is the expired time of banning post action, in milli-seconds
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ fetchChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.fetchChatRoomWhiteList ( final String  chatRoomId,
final EMValueCallBack< List< String >>  callBack 
)

Fetch whitelist from server Owner or administrator‘s authority is required

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ fetchPublicChatRoomsFromServer() [1/2]

EMPageResult<EMChatRoom> com.hyphenate.chat.EMChatRoomManager.fetchPublicChatRoomsFromServer ( int  pageNum,
int  pageSize 
) throws HyphenateException

Fetch the chat room data in page As the synchronization method, can use asynchronous method asyncFetchPublicChatRoomsFromServer(int, int, EMValueCallBack)

Synchronization method will block the current thread

Parameters
pageNumPage number, start from 1
pageSizeSize to be fetched per page
Returns
Fetch result, EMPageResult
Exceptions
HyphenateExceptionError code see com.hyphenate.EMError

◆ fetchPublicChatRoomsFromServer() [2/2]

EMCursorResult<EMChatRoom> com.hyphenate.chat.EMChatRoomManager.fetchPublicChatRoomsFromServer ( int  pageSize,
String  cursor 
) throws HyphenateException

Fetch the chat rooms in page When EMCursorResult.getCursor() is an empty string ("") in the result, there is no more data As the synchronization method, can use asynchronous method asyncFetchPublicChatRoomsFromServer(int, String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
pageSizeThe count fetched a time
cursorThe cursor position to fetch data
Returns
Fetch result, see EMCursorResult
Exceptions
HyphenateExceptionError code, see com.hyphenate.EMError
Deprecated:
Use fetchPublicChatRoomsFromServer(int, int) instead

◆ getAllChatRooms()

List<EMChatRoom> com.hyphenate.chat.EMChatRoomManager.getAllChatRooms ( )

Get all chat rooms in the cache in EMChatRoomManager Note: The method needs to call the following methods: (1) fetchPublicChatRoomsFromServer(int, int) and it's asynchronous method of asyncFetchPublicChatRoomsFromServer(int, int, EMValueCallBack) (2) fetchPublicChatRoomsFromServer(int, String) and it's asynchronous method of asyncFetchPublicChatRoomsFromServer(int, String, EMValueCallBack)

Returns
Return all the chat rooms maintained by EMChatRoomManager
Deprecated:

◆ getChatRoom()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.getChatRoom ( String  roomId)

Get the chat room in the cache

Parameters
roomIdChat room id
Returns
Return the EMChatRoom instance and return null if not find in the cache

◆ joinChatRoom()

void com.hyphenate.chat.EMChatRoomManager.joinChatRoom ( final String  roomId,
final EMValueCallBack< EMChatRoom callback 
)

Join the chat room Leave chat room call leaveChatRoom(String)

Asynchronously method

Parameters
roomIdChat room id to join
callbackCallback for success or fail. If join chat room success calls EMValueCallBack#onSuccess(Object), return the EMChatRoom instance; Failed to join chat room calls EMValueCallBack#onError(int, String), where the first parameter is the error code, the second is the error message

◆ leaveChatRoom()

void com.hyphenate.chat.EMChatRoomManager.leaveChatRoom ( final String  roomId)

Leave the chat room After join chat room joinChatRoom(String, EMValueCallBack), you need to call this method if want to leave chat room

Asynchronously method

Parameters
roomIdChat room id to leave

◆ muteAllMembers()

void com.hyphenate.chat.EMChatRoomManager.muteAllMembers ( final String  chatRoomId,
final EMValueCallBack< EMChatRoom callBack 
)

Mute all members Owner or administrator‘s authority is required Chat room owners, administrators and whitelisted users will not be affected

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ muteChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.muteChatRoomMembers ( String  chatRoomId,
List< String >  muteMembers,
long  duration 
) throws HyphenateException

Stop members post messages for some time Owner or administrator‘s authority is required Asynchronously method see asyncMuteChatRoomMembers(String, List, long, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
muteMembersMute member list
durationMute duration, in milli-seconds
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ removeChatRoomAdmin()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.removeChatRoomAdmin ( String  chatRoomId,
String  admin 
) throws HyphenateException

Remove administrator's authority in chat room Owner‘s authority is required Asynchronously method see asyncRemoveChatRoomAdmin(String, String, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
adminAdmin id to remove
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ removeChatRoomChangeListener()

void com.hyphenate.chat.EMChatRoomManager.removeChatRoomChangeListener ( EMChatRoomChangeListener  listener)

Remove chat room change listener After calling addChatRoomChangeListener(EMChatRoomChangeListener) can call this method to remove listener, now it is recommended to use removeChatRoomListener(EMChatRoomChangeListener) to remove

Parameters
listenerThe chat room listener to be removed
Deprecated:
Use EMChatRoomManager#removeChatRoomListener(EMChatRoomChangeListener) instead

◆ removeChatRoomListener()

void com.hyphenate.chat.EMChatRoomManager.removeChatRoomListener ( EMChatRoomChangeListener  listener)

Remove chat room change listener After calling addChatRoomChangeListener(EMChatRoomChangeListener) need to call this method to remove listener

Parameters
listenerThe chat room listener to be removed

◆ removeChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.removeChatRoomMembers ( String  chatRoomId,
List< String >  members 
) throws HyphenateException

Remove chat room members Owner or administrator‘s authority is required Asynchronously method see asyncRemoveChatRoomMembers(String, List, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersThe members list to be removed
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ removeFromChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.removeFromChatRoomWhiteList ( final String  chatRoomId,
final List< String >  members,
final EMValueCallBack< EMChatRoom callBack 
)

Remove members from whitelist Owner or administrator‘s authority is required When members are removed from whitelist, they are affected by muteAllMembers(String, EMValueCallBack)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe member list to remove from whitelist
callBack

◆ unblockChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.unblockChatRoomMembers ( String  chatRoomId,
List< String >  members 
) throws HyphenateException

Remove members from chat room's black list Owner or administrator‘s authority is required Asynchronously method see asyncBlockChatroomMembers(String, List, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersThe members list will be removed from blacklist
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ unmuteAllMembers()

void com.hyphenate.chat.EMChatRoomManager.unmuteAllMembers ( final String  chatRoomId,
final EMValueCallBack< EMChatRoom callBack 
)

Release the mute status of all members Owner or administrator‘s authority is required

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call EMValueCallBack#onSuccess(Object), failure call EMValueCallBack#onError(int, String)

◆ unMuteChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.unMuteChatRoomMembers ( String  chatRoomId,
List< String >  members 
) throws HyphenateException

Release mute Owner or administrator‘s authority is required Asynchronously method see asyncUnMuteChatRoomMembers(String, List, EMValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersRelease mute members list
Returns
Return the EMChatRoom instance modified
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

◆ updateChatRoomAnnouncement()

void com.hyphenate.chat.EMChatRoomManager.updateChatRoomAnnouncement ( String  chatRoomId,
String  announcement 
) throws HyphenateException

Update chat room announcement Owner or administrator‘s authority is required Asynchronously method see asyncUpdateChatRoomAnnouncement(String, String, EMCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
announcementAnnouncement content
Exceptions
HyphenateExceptionError info, see com.hyphenate.EMError

The documentation for this class was generated from the following file: