public bool SendRoomMessage(MessageIdDelegate callback, long roomId, byte mtype, string message, string attrs = "", int timeout = 0) { if (mtype <= 50) { if (errorRecorder != null) { errorRecorder.RecordError("SendRoomMessage interface require mtype large than 50, current mtype is " + mtype); } if (RTMConfig.triggerCallbackIfAsyncMethodReturnFalse) { ClientEngine.RunTask(() => { callback(0, ErrorCode.RTM_EC_INVALID_MTYPE); }); } return(false); } return(InternalSendRoomMessage(roomId, mtype, message, attrs, callback, timeout)); }
private bool InternalSendGroupMessage(long groupId, byte mtype, string message, string attrs, MessageIdDelegate callback, int timeout = 0) { TCPClient client = GetCoreClient(); if (client == null) { if (RTMConfig.triggerCallbackIfAsyncMethodReturnFalse) { ClientEngine.RunTask(() => { callback(0, fpnn.ErrorCode.FPNN_EC_CORE_INVALID_CONNECTION); }); } return(false); } long mid = MidGenerator.Gen(); Quest quest = new Quest("sendgroupmsg"); quest.Param("gid", groupId); quest.Param("mid", mid); quest.Param("mtype", mtype); quest.Param("msg", message); quest.Param("attrs", attrs); bool asyncStarted = client.SendQuest(quest, (Answer answer, int errorCode) => { //long mtime = 0; //if (errorCode == fpnn.ErrorCode.FPNN_EC_OK) // mtime = answer.Want<long>("mtime"); callback(mid, errorCode); }, timeout); if (!asyncStarted && RTMConfig.triggerCallbackIfAsyncMethodReturnFalse) { ClientEngine.RunTask(() => { callback(0, fpnn.ErrorCode.FPNN_EC_CORE_INVALID_CONNECTION); }); } return(asyncStarted); }
//===========================[ Sned Sned RTM-Audio Room File ]=========================// public bool SendRoomFile(MessageIdDelegate callback, long roomId, RTMAudioData audioData, string attrs = "", int timeout = 120) { return(RealSendFile(callback, FileTokenType.Room, roomId, (byte)MessageType.AudioFile, audioData.Audio, "", "", attrs, BuildAudioMessageAttrs(audioData), timeout)); }