public void LogChatMessage(ChatMessageLog log)
        {
            /*
             *  CREATE TABLE messages (
             *       message_id uuid PRIMARY KEY,
             *       from_agent uuid,
             *       to_agent uuid,
             *       region_id uuid,
             *       chat_type int,
             *       sent_on int,
             *       sent_on_day timestamp,
             *       message text
             *   );
             */


            try
            {
                var prep  = m_session.Prepare(Q_INS_TTL);
                var bound = prep.Bind(new object[] { Guid.NewGuid(), log.FromAgentID.Guid, log.ToAgentID.Guid, log.RegionID.Guid,
                                                     (int)log.ChatType, new DateTimeOffset(DateTime.Now), new DateTimeOffset(DateTime.Today), log.Message });

                var prepQuery = bound.SetConsistencyLevel(CONSISTENCY);

                if (m_debug)
                {
                    m_log.DebugFormat("[CHATLOG.Cassandra]: Executing {0}", prepQuery.ToString());
                }
                m_session.Execute(prepQuery);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[CHATLOG]: Unable to write message to cluster: {0}", e);
            }
        }
Ejemplo n.º 2
0
        void EventManager_OnChatToClient(string message, UUID fromID, UUID toID, UUID regionID,
                                         uint timestamp, ChatToClientType type)
        {
            if (message == "" || toID == fromID)
            {
                return;
            }

            //Create the log, then pass it to the backend
            ChatMessageLog log = new ChatMessageLog()
            {
                Message     = message,
                ChatType    = type,
                ToAgentID   = toID,
                FromAgentID = fromID,
                RegionID    = regionID,
                Timestamp   = timestamp
            };

            m_backend.LogChatMessage(log);
        }
Ejemplo n.º 3
0
 public void LogChatMessage(ChatMessageLog log)
 {
     m_fileWriter.WriteLine(log.ToString());
     m_fileWriter.Flush();
 }
Ejemplo n.º 4
0
        void EventManager_OnChatToClient(string message, UUID fromID, UUID toID, UUID regionID, 
            uint timestamp, ChatToClientType type)
        {
            if (String.IsNullOrEmpty(message) || toID == fromID) return;

            //Create the log, then pass it to the backend
            ChatMessageLog log = new ChatMessageLog()
            {
                Message = message,
                ChatType = type,
                ToAgentID = toID,
                FromAgentID = fromID,
                RegionID = regionID,
                Timestamp = timestamp
            };

            m_backend.LogChatMessage(log);
        }
        public void LogChatMessage(ChatMessageLog log)
        {
            /*
             *  CREATE TABLE messages (
             *       message_id uuid PRIMARY KEY,
             *       from_agent uuid,
             *       to_agent uuid,
             *       region_id uuid,
             *       chat_type int,
             *       sent_on int,
             *       sent_on_day timestamp, 
             *       message text
             *   );
             */
            

            try
            {
                var prep = m_session.Prepare(Q_INS_TTL);
                var bound = prep.Bind(new object[] { Guid.NewGuid(), log.FromAgentID.Guid, log.ToAgentID.Guid, log.RegionID.Guid, 
                        (int)log.ChatType, new DateTimeOffset(DateTime.Now), new DateTimeOffset(DateTime.Today), log.Message});

                var prepQuery = bound.SetConsistencyLevel(CONSISTENCY);

                if (m_debug) m_log.DebugFormat("[CHATLOG.Cassandra]: Executing {0}", prepQuery.ToString());
                m_session.Execute(prepQuery);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[CHATLOG]: Unable to write message to cluster: {0}", e);
            }
        }
 public void LogChatMessage(ChatMessageLog log)
 {
     m_fileWriter.WriteLine(log.ToString());
     m_fileWriter.Flush();
 }