public bool SendRoomMessage(ActTimeDelegate 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);
                }

                return(false);
            }

            return(InternalSendRoomMessage(roomId, mtype, message, attrs, callback, timeout));
        }
        //======================[ string message version ]================================//
        private bool InternalSendMessage(long uid, byte mtype, string message, string attrs, ActTimeDelegate callback, int timeout = 0)
        {
            TCPClient client = GetCoreClient();

            if (client == null)
            {
                return(false);
            }

            Quest quest = new Quest("sendmsg");

            quest.Param("to", uid);
            quest.Param("mid", MidGenerator.Gen());
            quest.Param("mtype", mtype);
            quest.Param("msg", message);
            quest.Param("attrs", attrs);

            return(client.SendQuest(quest, (Answer answer, int errorCode) => {
                long mtime = 0;
                if (errorCode == fpnn.ErrorCode.FPNN_EC_OK)
                {
                    mtime = answer.Want <long>("mtime");
                }

                callback(mtime, errorCode);
            }, timeout));
        }
Ejemplo n.º 3
0
 public bool SendRoomAudio(ActTimeDelegate callback, long roomId, byte[] message, string attrs = "", int timeout = 0)
 {
     return(InternalSendRoomMessage(roomId, MessageMType_Audio, message, attrs, callback, timeout));
 }
Ejemplo n.º 4
0
 public bool SendGroupCmd(ActTimeDelegate callback, long groupId, string message, string attrs = "", int timeout = 0)
 {
     return(InternalSendGroupMessage(groupId, MessageMType_Cmd, message, attrs, callback, timeout));
 }
Ejemplo n.º 5
0
 public bool SendRoomChat(ActTimeDelegate callback, long roomId, string message, string attrs = "", int timeout = 0)
 {
     return(InternalSendRoomMessage(roomId, MessageMType_Chat, message, attrs, callback, timeout));
 }