private OMVSD.OSD PostHandler(RestHandler handler, Uri uri, String after, OMVSD.OSD body)
        {
            try {
                OMVSD.OSDMap mapBody = (OMVSD.OSDMap)body;
                m_log.Log(LogLevel.DCOMMDETAIL, "PostHandler: received chat '{0}'", mapBody["Message"]);
                // collect parameters and send it to the simulator
                string    msg           = Uri.UnescapeDataString(mapBody["Message"].AsString().Replace("+", " "));
                OMVSD.OSD channelString = new OMVSD.OSDString("0");
                mapBody.TryGetValue("Channel", out channelString);
                int       channel    = Int32.Parse(channelString.AsString());
                OMVSD.OSD typeString = new OMVSD.OSDString("Normal");
                mapBody.TryGetValue("Type", out typeString);
                OMV.ChatType chatType = OpenMetaverse.ChatType.Normal;
                if (typeString.AsString().Equals("Whisper"))
                {
                    chatType = OMV.ChatType.Whisper;
                }
                if (typeString.AsString().Equals("Shout"))
                {
                    chatType = OMV.ChatType.Shout;
                }
                m_comm.GridClient.Self.Chat(msg, channel, chatType);

                // echo my own message back for the log and chat window

                /* NOTE: Don't have to do this. The simulator echos it back
                 * OMV.ChatEventArgs cea = new OpenMetaverse.ChatEventArgs(m_comm.GridClient.Network.CurrentSim,
                 *              msg,
                 *              OpenMetaverse.ChatAudibleLevel.Fully,
                 *              chatType,
                 *              OpenMetaverse.ChatSourceType.Agent,
                 *              m_comm.GridClient.Self.Name,
                 *              OMV.UUID.Zero,
                 *              OMV.UUID.Zero,
                 *              m_comm.GridClient.Self.RelativePosition);
                 * this.Self_ChatFromSimulator(this, cea);
                 */
            }
            catch (Exception e) {
                m_log.Log(LogLevel.DCOMM, "ERROR PARSING CHAT MESSAGE: {0}", e);
            }
            // the return value does not matter
            return(new OMVSD.OSDMap());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// The statistics ParameterSet has some delegated values that are only valid
 /// when logging in, etc. When the values are asked for, this routine is called
 /// delegate which calculates the current values of the statistic.
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 protected OMVSD.OSD RuntimeValueFetch(string key)
 {
     OMVSD.OSD ret = null;
     try {
     if ((m_client != null) && (IsConnected && m_isLoggedIn)) {
         switch (key) {
             case FIELDCURRENTSIM:
                 ret = new OMVSD.OSDString(m_client.Network.CurrentSim.Name);
                 break;
             case FIELDCURRENTGRID:
                 ret = new OMVSD.OSDString(m_loginGrid);
                 break;
             case FIELDPOSITIONX:
                 ret = new OMVSD.OSDString(m_client.Self.SimPosition.X.ToString());
                 break;
             case FIELDPOSITIONY:
                 ret = new OMVSD.OSDString(m_client.Self.SimPosition.Y.ToString());
                 break;
             case FIELDPOSITIONZ:
                 ret = new OMVSD.OSDString(m_client.Self.SimPosition.Z.ToString());
                 break;
         }
         if (ret != null) return ret;
     }
     }
     catch (Exception e) {
     m_log.Log(LogLevel.DCOMM, "RuntimeValueFetch: failure getting {0}: {1}", key, e.ToString());
     }
     return new OMVSD.OSDString("");
 }
Ejemplo n.º 3
0
        private OMVSD.OSD PostHandler(RestHandler handler, Uri uri, String after, OMVSD.OSD body)
        {
            try {
            OMVSD.OSDMap mapBody = (OMVSD.OSDMap)body;
            m_log.Log(LogLevel.DCOMMDETAIL, "PostHandler: received chat '{0}'", mapBody["Message"]);
            // collect parameters and send it to the simulator
            string msg = Uri.UnescapeDataString(mapBody["Message"].AsString().Replace("+", " "));
            OMVSD.OSD channelString = new OMVSD.OSDString("0");
            mapBody.TryGetValue("Channel", out channelString);
            int channel = Int32.Parse(channelString.AsString());
            OMVSD.OSD typeString = new OMVSD.OSDString("Normal");
            mapBody.TryGetValue("Type", out typeString);
            OMV.ChatType chatType = OpenMetaverse.ChatType.Normal;
            if (typeString.AsString().Equals("Whisper")) chatType = OMV.ChatType.Whisper;
            if (typeString.AsString().Equals("Shout")) chatType = OMV.ChatType.Shout;
            m_comm.GridClient.Self.Chat(msg, channel, chatType);

            // echo my own message back for the log and chat window
            /* NOTE: Don't have to do this. The simulator echos it back
            OMV.ChatEventArgs cea = new OpenMetaverse.ChatEventArgs(m_comm.GridClient.Network.CurrentSim,
                            msg,
                            OpenMetaverse.ChatAudibleLevel.Fully,
                            chatType,
                            OpenMetaverse.ChatSourceType.Agent,
                            m_comm.GridClient.Self.Name,
                            OMV.UUID.Zero,
                            OMV.UUID.Zero,
                            m_comm.GridClient.Self.RelativePosition);
            this.Self_ChatFromSimulator(this, cea);
             */
            }
            catch (Exception e) {
            m_log.Log(LogLevel.DCOMM, "ERROR PARSING CHAT MESSAGE: {0}", e);
            }
            // the return value does not matter
            return new OMVSD.OSDMap();
        }