/*
         *      private void OnRegisterCaps(UUID agentID, Caps caps)
         *      {
         * //            m_log.DebugFormat("[{0}]: OnRegisterCaps: agentID {1} caps {2}",Name, agentID, caps);
         *
         *          caps.RegisterHandler(
         *              "ViewerStats",
         *              new RestStreamHandler(
         *                  "POST",
         *                  capsBase + UUID.Random(),
         *                  (request, path, param, httpRequest, httpResponse)
         *                      => ViewerStatsReport(request, path, param, agentID, caps),
         *                  "ViewerStats",
         *                  agentID.ToString()));
         *      }
         */
        #endregion

        private void AgentRegionLoginLog(ScenePresence sp)
        {
            UserLogAgentData agentData = new UserLogAgentData();

            try
            {
                ClientInfo ci = sp.ControllingClient.GetClientInfo();
                IPEndPoint ip = sp.ControllingClient.RemoteEndPoint;

                agentData.RegionID    = sp.Scene.RegionInfo.RegionID;
                agentData.RegionName  = sp.Scene.RegionInfo.RegionName;
                agentData.Position    = string.Format("/{0:F2}/{1:F2}/{2:F2}", sp.AbsolutePosition.X, sp.AbsolutePosition.Y, sp.AbsolutePosition.Z);
                agentData.ID          = ci.agentcircuit.AgentID;
                agentData.Name        = string.Format("{0} {1}", ci.agentcircuit.firstname, ci.agentcircuit.lastname);
                agentData.IP          = ip.Address.ToString();
                agentData.Viewer      = sp.Viewer;
                agentData.Grid        = "Unknown";
                agentData.CountryCode = m_agentCountry.LookupCountryCode(ip.Address);
                agentData.CountryName = m_agentCountry.LookupCountryName(ip.Address);
            }
            catch (Exception ex)
            {
                m_log.ErrorFormat("[{0}]: Exception on received agentdata - {1} : {2}", Name, ex.Message, ex.StackTrace);
                Util.PrintCallStack();
                return;
            }

            if (m_dataStore == null)
            {
                m_log.WarnFormat("[{0}]: No data-storage is aviable.", Name);
                return;
            }

            m_dataStore.StoreAgentLoginData(agentData);
        }
        private void AgentRegionLoginLog(ScenePresence sp)
        {
            UserLogAgentData agentData = new UserLogAgentData();

            try
            {
                ClientInfo ci = sp.ControllingClient.GetClientInfo();
                IPEndPoint ip = sp.ControllingClient.RemoteEndPoint;

                agentData.RegionID = sp.Scene.RegionInfo.RegionID;
                agentData.RegionName = sp.Scene.RegionInfo.RegionName;
                agentData.Position = string.Format("/{0:F2}/{1:F2}/{2:F2}", sp.AbsolutePosition.X, sp.AbsolutePosition.Y, sp.AbsolutePosition.Z);
                agentData.ID = ci.agentcircuit.AgentID;
                agentData.Name = string.Format("{0} {1}", ci.agentcircuit.firstname, ci.agentcircuit.lastname);
                agentData.IP = ip.Address.ToString();
                agentData.Viewer = sp.Viewer;
                agentData.Grid = "Unknown";
                agentData.CountryCode = m_agentCountry.LookupCountryCode(ip.Address);
                agentData.CountryName = m_agentCountry.LookupCountryName(ip.Address);
            }
            catch (Exception ex)
            {
                m_log.ErrorFormat("[{0}]: Exception on received agentdata - {1} : {2}", Name, ex.Message, ex.StackTrace);
                Util.PrintCallStack();
                return;
            }

            if (m_dataStore == null)
            {
                m_log.WarnFormat("[{0}]: No data-storage is aviable.", Name);
                return;
            }

            m_dataStore.StoreAgentLoginData(agentData);
        }