IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMMessageListGetOption

Public Member Functions

void setGetType (int getType)
 
void setUserID (String userID)
 
void setGroupID (String groupID)
 
void setCount (int count)
 
void setLastMsg (V2TIMMessage lastMsg)
 
void setLastMsgSeq (long lastMsgSeq)
 
void setGetTimeBegin (long getTimeBegin)
 
void setGetTimePeriod (long getTimePeriod)
 
int getGetType ()
 
String getUserID ()
 
String getGroupID ()
 
int getCount ()
 
V2TIMMessage getLastMsg ()
 
long getLastMsgSeq ()
 
long getGetTimeBegin ()
 
long getGetTimePeriod ()
 
void setMessageTypeList (List< Integer > messageTypeList)
 
List< Integer > getMessageTypeList ()
 
void setMessageSeqList (List< Long > messageSeqList)
 
List< Long > getMessageSeqList ()
 

Static Public Attributes

static final int V2TIM_GET_CLOUD_OLDER_MSG = 1
 
static final int V2TIM_GET_CLOUD_NEWER_MSG = 2
 
static final int V2TIM_GET_LOCAL_OLDER_MSG = 3
 
static final int V2TIM_GET_LOCAL_NEWER_MSG = 4
 

Member Function Documentation

◆ setGetType()

void setGetType ( int  getType)
inline

Message pulling type, which can be set to pull older or newer messages from local storage or the cloud

Attention
Notes:

For pulling messages from the cloud, the locally stored and cloud stored message lists are combined and returned. If no network connection is available, only the locally stored message list is returned.

The following are the instructions for getType and the start message and time range for message pulling:

  • getType indicates the pulling direction: whether to pull older or newer messages.
  • lastMsg and lastMsgSeq indicate the start point for message pulling. For first time pulling, they can be left empty or set to 0.
  • getTimeBegin and getTimePeriod indicate the time range for message pulling. The start point of the time range is related to the pulling direction (getType).
  • If both the start message and time range exist, the result set can be considered as the intersection of "result of pulling by start message alone" and "result of pulling by time range alone".
  • If both the start message and time range do not exist, the result set can be considered as the result of pulling from the latest message of the current conversation in the pulling direction and mode specified by getType.
Parameters
getTypePulling type. Valid values: V2TIM_GET_CLOUD_OLDER_MSG, V2TIM_GET_CLOUD_NEWER_MSG, V2TIM_GET_LOCAL_OLDER_MSG, V2TIM_GET_LOCAL_NEWER_MSG

◆ setUserID()

void setUserID ( String  userID)
inline

Pull historical one-to-one chat messages

◆ setGroupID()

void setGroupID ( String  groupID)
inline

Pull historical group messages

◆ setCount()

void setCount ( int  count)
inline

Number of messages to be pulled

◆ setLastMsg()

void setLastMsg ( V2TIMMessage  lastMsg)
inline

Start message for message pulling

Attention
Notes:

When one-to-one messages are pulled, only lastMsg can be used to specify the start point for message pulling. If lastMsg is not specified, the IM SDK uses the newest message of the conversation as the start point for message pulling.

When group messages are pulled, lastMsg or lastMsgSeq can be used to specify the start point for message pulling:

  • If lastMsg is used to specify the start point for message pulling, the returned message list does not include the message specified by lastMsg.
  • If lastMsgSeq is used to specify the start point for message pulling, the returned message list does not include the message specified by lastMsgSeq.
Attention
When group messages are pulled:

If both lastMsg and lastMsgSeq are specified, the IM SDK uses lastMsg to determine the start point for message pulling.

If both lastMsg and lastMsgSeq are not specified, there are two cases for the start point for message pulling:

  • If the time range for message pulling is specified, the IM SDK uses the point in time specified by @getTimeBegin as the start point for message pulling.
  • If the time range for message pulling is not specified, the IM SDK uses the newest message of the conversation as the start point for message pulling.

◆ setLastMsgSeq()

void setLastMsgSeq ( long  lastMsgSeq)
inline

Start sequence for group message pulling

◆ setGetTimeBegin()

void setGetTimeBegin ( long  getTimeBegin)
inline

Time range for message pulling

getTimeBegin: indicates the start point of the time range. The default value is 0, indicating to start pulling now. The value can also be the UTC timestamp, in seconds.

getTimePeriod: indicates the length of the time range, in seconds. The default value is 0, indicating that the time range is not limited.

Attention

The direction of the time range is determined by the getType parameter:

If getType is V2TIM_GET_CLOUD_OLDER_MSG/V2TIM_GET_LOCAL_OLDER_MSG, the time range is a period of time in the past, starting from getTimeBegin and with a length determined by getTimePeriod.

If getType is V2TIM_GET_CLOUD_NEWER_MSG/V2TIM_GET_LOCAL_NEWER_MSG, the time range is a period of time in the future, starting from getTimeBegin and with a length determined by getTimePeriod.

The value range is a closed range, including the start and end points in time. The relationship between the two is as follows:

  • If getType specifies to pull older messages, the time range is [getTimeBegin-getTimePeriod, getTimeBegin].
  • If getType specifies to pull newer messages, the time range is [getTimeBegin, getTimeBegin+getTimePeriod].

◆ setGetTimePeriod()

void setGetTimePeriod ( long  getTimePeriod)
inline

Time range for message pulling

◆ getGetType()

int getGetType ( )
inline

◆ getUserID()

String getUserID ( )
inline

◆ getGroupID()

String getGroupID ( )
inline

◆ getCount()

int getCount ( )
inline

◆ getLastMsg()

V2TIMMessage getLastMsg ( )
inline

◆ getLastMsgSeq()

long getLastMsgSeq ( )
inline

◆ getGetTimeBegin()

long getGetTimeBegin ( )
inline

◆ getGetTimePeriod()

long getGetTimePeriod ( )
inline

◆ setMessageTypeList()

void setMessageTypeList ( List< Integer >  messageTypeList)
inline

Set the message types to pull, valid only when getType is V2TIM_GET_LOCAL_OLDER_MSG and V2TIM_GET_LOCAL_NEWER_MSG. If null is passed in, all message types supported are pulled.

◆ getMessageTypeList()

List<Integer> getMessageTypeList ( )
inline

◆ setMessageSeqList()

void setMessageSeqList ( List< Long >  messageSeqList)
inline

Pulling group history messages according to the specific message sequence list (Supported only in imsdk 7.1 and later versions)

Attention
  • Valid only when pulling group history messages;
  • The message sequence comes from the seq field of V2TIMMessage;
  • When getType is set to pull from the cloud, it will merge the local storage message list with the cloud storage message list and return; if there is no network, it will directly return the local message list;
  • When getType is set to pull from local storage, it will directly return the local message list;
  • When getType is set to pull older messages, the message list is in reverse order of time, that is, the messages are sorted in descending order of timestamp;
  • When getType is set to pull newer messages, the message list is in chronological order, that is, the messages are sorted in ascending order of timestamp.

◆ getMessageSeqList()

List<Long> getMessageSeqList ( )
inline

Field Documentation

◆ V2TIM_GET_CLOUD_OLDER_MSG

final int V2TIM_GET_CLOUD_OLDER_MSG = 1
static

Get older messages from the cloud

◆ V2TIM_GET_CLOUD_NEWER_MSG

final int V2TIM_GET_CLOUD_NEWER_MSG = 2
static

Get newer messages from the cloud

◆ V2TIM_GET_LOCAL_OLDER_MSG

final int V2TIM_GET_LOCAL_OLDER_MSG = 3
static

Get older messages from local storage

◆ V2TIM_GET_LOCAL_NEWER_MSG

final int V2TIM_GET_LOCAL_NEWER_MSG = 4
static

Get newer messages from local storage