示例#1
0
        public uint ChatSendMsg(ChatMessage msg)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestSendMessage,
                false
                );

            RequestSendMessage request = new RequestSendMessage();

            request.msg = msg;
            return(Send <RequestSendMessage>(request, msgID));
        }
        /// <summary>
        /// Does the send message.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="sessionID">The session identifier.</param>
        /// <param name="messageText">The message text.</param>
        /// <param name="chatProtocol">The chat protocol.</param>
        /// <returns></returns>
        public OutputValues DoSendMessage(string sessionID, string messageText)
        {
            OutputValues output = OutputValues.GetInstance();

            try
            {
                output = RequestSendMessage.SendChatMessage(sessionID, messageText);
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Do Send Message " + generalException.ToString());
            }
            return(output);
        }
        public ResponseSendMessage SendMessage(RequestSendMessage r)
        {
            try
            {
                var sender = _userRepository.GetById(r.UserId);
                _channelRepository.SendMessage(sender, r.ChannelId, r.message);


                return(new ResponseSendMessage()
                {
                    message = $"Message sent from  \"{r.UserId}\"",
                    status = ResponseStatus.Success,
                });
            }
            catch (Exception ex)
            {
                return(new ResponseSendMessage()
                {
                    message = $"Cannot send message for user  \"{r.UserId}\".",
                    exception = ex,
                    status = ResponseStatus.Error
                });
            }
        }
示例#4
0
 public ActionResult SendSms(RequestSendMessage message)
 {
     BulutfonApi.SendSms((Token)Session[Token.Key], message);
     return(RedirectToAction("Messages"));
 }