Example #1
0
    private MessageObject ProcessMessageObject(JsonReader jsonReader, ChatMessageTypes type)
    {
        Debug.Log("ProcessMessageObject");

        MessageObject messageObject = new MessageObject();

        try
        {
            switch (type)
            {
            case ChatMessageTypes.Text:
                messageObject = ProcessTextMessage(jsonReader);
                break;

            case ChatMessageTypes.Emoticon:
                messageObject = ProcessEmoticonMessage(jsonReader);
                break;

            case ChatMessageTypes.Link:
                messageObject = ProcessLinkMessage(jsonReader);
                break;

            default:
                // No-op
                break;
            }
            ;
        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
        }

        return(messageObject);
    }
Example #2
0
 public void Notify(string text, ChatMessageTypes type, User user = null, byte[] binaryData = null)
 {
     this.Messages.Add(new ChatMessage()
     {
         Text = text, User = user, Type = type, BinaryData = binaryData
     });
 }
Example #3
0
        public SNMessageData GetMessageData(short type)
        {
            ChatMessageTypes header  = (ChatMessageTypes)type;
            SNMessageData    message = null;

            switch (header)
            {
            default:
                loggingService.Log($"Cannot build chat message {header.ToString()}", LogMessageType.WARNING);
                break;
            }

            return(message);
        }
Example #4
0
 private void PostMessage(string text, ChatMessageTypes type)
 {
     try
     {
         this.ChatClient.PostMessage(new ChatMessage()
         {
             Text = text, Type = type
         });
         this.Invoke(new Action(() => this.textBoxMessage.Text = String.Empty));
     }
     catch (Exception ex)
     {
         this.MessageBoxMarshall(ex.Message);
     }
 }
Example #5
0
    private MessageObject ParseMessageObject(JsonReader jsonReader)
    {
        Debug.Log("ParseMessageObject");

        MessageObject    messageObject = new MessageObject();
        ChatMessageTypes type          = ChatMessageTypes.Unknown;

        while (jsonReader.Read())
        {
            if (jsonReader.Value != null)
            {
                // Look for data section
                if (jsonReader.Value.ToString() == "type")
                {
                    jsonReader.Read();
                    if (jsonReader.Value != null)
                    {
                        switch (jsonReader.Value.ToString())
                        {
                        case "text":
                            type = ChatMessageTypes.Text;
                            break;

                        case "emoticon":
                            type = ChatMessageTypes.Emoticon;
                            Debug.Log("type:emoticon");
                            break;

                        case "link":
                            type = ChatMessageTypes.Link;
                            break;

                        default:
                            // No-op
                            break;
                        }
                        ;
                        messageObject = ProcessMessageObject(jsonReader, type);
                    }
                }
            }
        }
        return(messageObject);
    }
 public ChatMessage(string message, ChatMessageTypes messageType)
 {
     this.Message     = message;
     this.MessageType = messageType;
 }
Example #7
0
        public async Task <bool> WriteChatMessage(Guid appealId, string nickName, string messageString, ChatMessageTypes messageType)
        {
            var chatMessage = new ChatMessage()
            {
                AppealId          = appealId,
                ChatMessageTypeId = messageType,
                CreateDate        = DateTime.Now,
                NickName          = nickName,
                MessageString     = messageString
            };

            return(await WriteChatMessage(chatMessage));
        }
Example #8
0
 public async Task <bool> AddStatusMessage(Guid appealId, string nickName, ChatMessageTypes messageType)
 {
     return(await WriteChatMessage(appealId, nickName, null, messageType));
 }