|
|
|
@ -1085,9 +1085,9 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkIncrUnread; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkInviteUserToGroupTip; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkJoinGroupTip; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkKickGroupMemberTip; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkKickOnlineTip; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkLocation; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkLoginFailed; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkLoginInit; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkLoginSuccess; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkLogining; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkLogoutCmd; |
|
|
|
@ -1128,6 +1128,9 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkSysMsgType; |
|
|
|
|
*/ |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkText; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkTimeOffset; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkTokenFailedExpired; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkTokenFailedInvalid; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkTokenFailedKickedOffline; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkTotalUnreadMessageChanged; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkTransferGroupOwnerTip; |
|
|
|
|
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkTransferGroupTip; |
|
|
|
@ -1144,6 +1147,7 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkVideo; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkVoice; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkWSDataError; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkWSGetNewestSeq; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkWSKickOnlineMsg; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsg; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkWSPullMsgBySeqList; |
|
|
|
|
FOUNDATION_EXPORT const int64_t Open_im_sdkWSPushMsg; |
|
|
|
@ -1174,6 +1178,172 @@ FOUNDATION_EXPORT void Open_im_sdkAddToBlackList(id<Open_im_sdkBase> _Nullable c |
|
|
|
|
|
|
|
|
|
FOUNDATION_EXPORT void Open_im_sdkCheckFriend(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable uidList); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* func (u *UserRelated) pullOldMsgAndMergeNewMsgByWs(beginSeq int64, endSeq int64) (err error) { |
|
|
|
|
LogBegin(beginSeq, endSeq) |
|
|
|
|
if beginSeq > endSeq { |
|
|
|
|
LogSReturn(nil) |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
LogBegin("AddCh") |
|
|
|
|
msgIncr, ch := u.AddCh() |
|
|
|
|
|
|
|
|
|
var wsReq GeneralWsReq |
|
|
|
|
wsReq.ReqIdentifier = WSPullMsgBySeqList |
|
|
|
|
wsReq.OperationID = operationIDGenerator() |
|
|
|
|
wsReq.SendID = u.LoginUid |
|
|
|
|
//wsReq.Token = u.token
|
|
|
|
|
wsReq.MsgIncr = msgIncr |
|
|
|
|
|
|
|
|
|
var pullMsgReq PullMessageBySeqListReq |
|
|
|
|
LogBegin("getNoInSeq ", beginSeq, endSeq) |
|
|
|
|
pullMsgReq.SeqList = u.getNotInSeq(beginSeq, endSeq) |
|
|
|
|
LogEnd("getNoInSeq ", pullMsgReq.SeqList) |
|
|
|
|
|
|
|
|
|
wsReq.Data, err = proto.Marshal(&pullMsgReq) |
|
|
|
|
if err != nil { |
|
|
|
|
sdkLog("Marshl failed ") |
|
|
|
|
LogFReturn(err.Error()) |
|
|
|
|
u.DelCh(msgIncr) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
LogBegin("WriteMsg ", wsReq.OperationID) |
|
|
|
|
err, _ = u.WriteMsg(wsReq) |
|
|
|
|
LogEnd("WriteMsg ", wsReq.OperationID, err) |
|
|
|
|
if err != nil { |
|
|
|
|
sdkLog("close conn, WriteMsg failed ", err.Error()) |
|
|
|
|
u.DelCh(msgIncr) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
timeout := 10 |
|
|
|
|
select { |
|
|
|
|
case r := <-ch: |
|
|
|
|
sdkLog("ws ch recvMsg success: ", wsReq.OperationID) |
|
|
|
|
if r.ErrCode != 0 { |
|
|
|
|
sdkLog("pull msg failed ", r.ErrCode, r.ErrMsg, wsReq.OperationID) |
|
|
|
|
u.DelCh(msgIncr) |
|
|
|
|
return errors.New(r.ErrMsg) |
|
|
|
|
} else { |
|
|
|
|
sdkLog("pull msg success ", wsReq.OperationID) |
|
|
|
|
var pullMsg PullUserMsgResp |
|
|
|
|
|
|
|
|
|
pullMsg.ErrCode = 0 |
|
|
|
|
|
|
|
|
|
var pullMsgResp PullMessageBySeqListResp |
|
|
|
|
err := proto.Unmarshal(r.Data, &pullMsgResp) |
|
|
|
|
if err != nil { |
|
|
|
|
sdkLog("Unmarshal failed ", err.Error()) |
|
|
|
|
LogFReturn(err.Error()) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
pullMsg.Data.Group = pullMsgResp.GroupUserMsg |
|
|
|
|
pullMsg.Data.Single = pullMsgResp.SingleUserMsg |
|
|
|
|
pullMsg.Data.MaxSeq = pullMsgResp.MaxSeq |
|
|
|
|
pullMsg.Data.MinSeq = pullMsgResp.MinSeq |
|
|
|
|
|
|
|
|
|
u.seqMsgMutex.Lock() |
|
|
|
|
|
|
|
|
|
arrMsg := ArrMsg{} |
|
|
|
|
isInmap := false |
|
|
|
|
for i := 0; i < len(pullMsg.Data.Single); i++ { |
|
|
|
|
for j := 0; j < len(pullMsg.Data.Single[i].List); j++ { |
|
|
|
|
sdkLog("open_im pull one msg: |", pullMsg.Data.Single[i].List[j].ClientMsgID, "|") |
|
|
|
|
singleMsg := MsgData{ |
|
|
|
|
SendID: pullMsg.Data.Single[i].List[j].SendID, |
|
|
|
|
RecvID: pullMsg.Data.Single[i].List[j].RecvID, |
|
|
|
|
SessionType: SingleChatType, |
|
|
|
|
MsgFrom: pullMsg.Data.Single[i].List[j].MsgFrom, |
|
|
|
|
ContentType: pullMsg.Data.Single[i].List[j].ContentType, |
|
|
|
|
ServerMsgID: pullMsg.Data.Single[i].List[j].ServerMsgID, |
|
|
|
|
Content: pullMsg.Data.Single[i].List[j].Content, |
|
|
|
|
SendTime: pullMsg.Data.Single[i].List[j].SendTime, |
|
|
|
|
Seq: pullMsg.Data.Single[i].List[j].Seq, |
|
|
|
|
SenderNickName: pullMsg.Data.Single[i].List[j].SenderNickName, |
|
|
|
|
SenderFaceURL: pullMsg.Data.Single[i].List[j].SenderFaceURL, |
|
|
|
|
ClientMsgID: pullMsg.Data.Single[i].List[j].ClientMsgID, |
|
|
|
|
SenderPlatformID: pullMsg.Data.Single[i].List[j].SenderPlatformID, |
|
|
|
|
} |
|
|
|
|
// arrMsg.SingleData = append(arrMsg.SingleData, singleMsg)
|
|
|
|
|
u.seqMsg[pullMsg.Data.Single[i].List[j].Seq] = singleMsg |
|
|
|
|
sdkLog("into map, seq: ", pullMsg.Data.Single[i].List[j].Seq, pullMsg.Data.Single[i].List[j].ClientMsgID, pullMsg.Data.Single[i].List[j].ServerMsgID) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for i := 0; i < len(pullMsg.Data.Group); i++ { |
|
|
|
|
for j := 0; j < len(pullMsg.Data.Group[i].List); j++ { |
|
|
|
|
groupMsg := MsgData{ |
|
|
|
|
SendID: pullMsg.Data.Group[i].List[j].SendID, |
|
|
|
|
RecvID: pullMsg.Data.Group[i].List[j].RecvID, |
|
|
|
|
SessionType: GroupChatType, |
|
|
|
|
MsgFrom: pullMsg.Data.Group[i].List[j].MsgFrom, |
|
|
|
|
ContentType: pullMsg.Data.Group[i].List[j].ContentType, |
|
|
|
|
ServerMsgID: pullMsg.Data.Group[i].List[j].ServerMsgID, |
|
|
|
|
Content: pullMsg.Data.Group[i].List[j].Content, |
|
|
|
|
SendTime: pullMsg.Data.Group[i].List[j].SendTime, |
|
|
|
|
Seq: pullMsg.Data.Group[i].List[j].Seq, |
|
|
|
|
SenderNickName: pullMsg.Data.Group[i].List[j].SenderNickName, |
|
|
|
|
SenderFaceURL: pullMsg.Data.Group[i].List[j].SenderFaceURL, |
|
|
|
|
ClientMsgID: pullMsg.Data.Group[i].List[j].ClientMsgID, |
|
|
|
|
SenderPlatformID: pullMsg.Data.Group[i].List[j].SenderPlatformID, |
|
|
|
|
} |
|
|
|
|
// arrMsg.GroupData = append(arrMsg.GroupData, groupMsg)
|
|
|
|
|
u.seqMsg[pullMsg.Data.Group[i].List[j].Seq] = groupMsg |
|
|
|
|
sdkLog("into map, seq: ", pullMsg.Data.Group[i].List[j].Seq, pullMsg.Data.Group[i].List[j].ClientMsgID, pullMsg.Data.Group[i].List[j].ServerMsgID) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
u.seqMsgMutex.Unlock() |
|
|
|
|
|
|
|
|
|
u.seqMsgMutex.RLock() |
|
|
|
|
for i := beginSeq; i <= endSeq; i++ { |
|
|
|
|
v, ok := u.seqMsg[i] |
|
|
|
|
if ok { |
|
|
|
|
if v.SessionType == SingleChatType { |
|
|
|
|
arrMsg.SingleData = append(arrMsg.SingleData, v) |
|
|
|
|
sdkLog("pull seq: ", v.Seq, v) |
|
|
|
|
if v.ContentType > SingleTipBegin && v.ContentType < SingleTipEnd { |
|
|
|
|
var msgRecv MsgData |
|
|
|
|
msgRecv.ContentType = v.ContentType |
|
|
|
|
msgRecv.Content = v.Content |
|
|
|
|
msgRecv.SendID = v.SendID |
|
|
|
|
msgRecv.RecvID = v.RecvID |
|
|
|
|
LogBegin("doFriendMsg ", msgRecv) |
|
|
|
|
u.doFriendMsg(msgRecv) |
|
|
|
|
LogEnd("doFriendMsg ", msgRecv) |
|
|
|
|
} |
|
|
|
|
} else if v.SessionType == GroupChatType { |
|
|
|
|
sdkLog("pull seq: ", v.Seq, v) |
|
|
|
|
arrMsg.GroupData = append(arrMsg.GroupData, v) |
|
|
|
|
if v.ContentType > GroupTipBegin && v.ContentType < GroupTipEnd { |
|
|
|
|
LogBegin("doGroupMsg ", v) |
|
|
|
|
u.doGroupMsg(v) |
|
|
|
|
LogEnd("doGroupMsg ", v) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
sdkLog("type failed, ", v.SessionType, v) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
sdkLog("seq no in map, failed, seq: ", i) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
u.seqMsgMutex.RUnlock() |
|
|
|
|
|
|
|
|
|
sdkLog("triggerCmdNewMsgCome len: ", len(arrMsg.SingleData), len(arrMsg.GroupData)) |
|
|
|
|
err = u.triggerCmdNewMsgCome(arrMsg) |
|
|
|
|
if err != nil { |
|
|
|
|
sdkLog("triggerCmdNewMsgCome failed, ", err.Error()) |
|
|
|
|
} |
|
|
|
|
u.DelCh(msgIncr) |
|
|
|
|
} |
|
|
|
|
case <-time.After(time.Second * time.Duration(timeout)): |
|
|
|
|
sdkLog("ws ch recvMsg timeout,", wsReq.OperationID) |
|
|
|
|
u.DelCh(msgIncr) |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
FOUNDATION_EXPORT long Open_im_sdkCheckToken(NSString* _Nullable uId, NSString* _Nullable token); |
|
|
|
|
|
|
|
|
|
FOUNDATION_EXPORT void Open_im_sdkClearC2CHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable userID); |
|
|
|
|
|
|
|
|
|
FOUNDATION_EXPORT void Open_im_sdkClearGroupHistoryMessage(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable groupID); |
|
|
|
|