public ConversationChatMessageSentEventArgs(string conversationID, string gaiaID, string chatID, long timestamp, string eventType, string eventID, ChatMessage chatMessage)
     : base(conversationID, gaiaID, chatID, timestamp, eventType, eventID)
 {
     this.ChatMessage = chatMessage;
 }
        internal static ChatMessage ParseSingleMessage(string chatMessageJson)
        {
            ChatMessage chatMessage = null;

            try
            {
                if (string.IsNullOrEmpty(chatMessageJson) && !Util.IsValidJsonObjectString(chatMessageJson))
                {
                    throw new Exception("Invalid JSON object string !");
                }

                //If chat message is a proper json object instead of null, it will definitely have a message content which contain segment and Attachment.
                if (Util.IsJsonObject((JObject.Parse(chatMessageJson)).GetValue("message_content")))
                {
                    JObject jObjChatMessageContent = (JObject)((JObject.Parse(chatMessageJson)).GetValue("message_content"));
                    JArray jArraySegment = null;
                    if (Util.IsJsonArray(jObjChatMessageContent.GetValue("segment")))
                    {
                        jArraySegment = (JArray)jObjChatMessageContent.GetValue("segment");
                    }

                    JArray jArrayAttachment = null;
                    if (Util.IsJsonArray(jObjChatMessageContent.GetValue("attachment")))
                    {
                        jArrayAttachment = (JArray)jObjChatMessageContent.GetValue("attachment");
                    }

                    string message = "";
                    if (jArraySegment != null)
                    {
                        foreach (JObject jObj in jArraySegment)
                        {
                            message += jObj.GetValue("text") + Environment.NewLine;
                        }
                    }

                    //Risky part of parsing due to weird JSON structure, i'll just ignore data seemed to be useless.
                    /*
                     { '27639957':
                            [ [ 'https://plus.google.com/photos/albums/p4jmatfi9qm621falthi1lkmblvjmjffi?pid=6218699856246635330&oid=107510317300187854172',
                            ,
                            ,
                            'https://lh3.googleusercontent.com/-HE_B_dR6JdY/Vk1Ckjhae0I/AAAAAAAAAAU/_m1Z9KuVZsA/s0/Desert.jpg',
                            ,
                            ,
                            ,
                            ,
                            ,
                            1024,
                            768 ],
                       '107510317300187854172',
                       '6218699858622478097',
                       '6218699856246635330',
                       ,
                       'https://lh3.googleusercontent.com/-HE_B_dR6JdY/Vk1Ckjhae0I/AAAAAAAAAAU/_m1Z9KuVZsA/s0/Desert.jpg',
                       ,
                       ,
                       ,
                       'https://lh3.googleusercontent.com/Py6fFZ9K0F-Tit2CM2wv6JUfT1Ftqv_7a7vjhi5M_Q',
                       ,
                       ,
                       1,
                       [ 'BABEL_STREAM_ID',
                         'BABEL_UNIQUE_ID_4232c25c-de3a-4750-9c72-f2b2609daec5',
                         'shared_group_6218699839102330066' ] ] }
                     */
                    PhotoAttachment photoAttachment = null;
                    if (jArrayAttachment != null)
                    {
                        foreach (JObject jObj in jArrayAttachment)
                        {
                            JArray jArrayData = (JArray)jObj.SelectToken("embed_item.data[\'" + CHAT_MESSAGE_ATTACHMENT_PHOTO + "\']");
                            photoAttachment = new PhotoAttachment(
                                jArrayData.SelectToken("[9]").ToString(),
                                jArrayData.SelectToken("[0][3]").ToString(),
                                jArrayData.SelectToken("[0][0]").ToString(),
                                int.Parse(jArrayData.SelectToken("[0][9]").ToString()),
                                int.Parse(jArrayData.SelectToken("[0][10]").ToString())
                                );
                        }
                    }
                    chatMessage = new ChatMessage(message, photoAttachment);
                }
                return chatMessage;
            }
            catch (Exception ex)
            {
                throw new HangoutsException("ParseSingleMessage : " + ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
 public HangoutsEvent(string id, Participant.ID sender, long timestamp, ChatMessage chatMessage, RenameEvent renameEvent, MembershipChangeEvent membershipChange)
 {
     this.ID = id;
     this.Sender = sender;
     this.Timestamp = timestamp;
     this.ChatMessage = chatMessage;
     this.Rename = renameEvent;
     this.MembershipChange = membershipChange;
 }