예제 #1
0
        protected void JsonChatControler(string message, string sender_name, UUID sender_uuid, bool avatar, bool group, UUID group_uuid, bool localchat, bool fromme)
        {
            if ((group == true) || (localchat == true) || (fromme == true))
            {
                return;
            }
            try
            {
                bool frommaster = true;
                if (sender_uuid != master_uuid)
                {
                    frommaster = false;
                }
                if (frommaster == true)
                {
                    if (message == "fakerestart")
                    {
                        AlertMessageEventArgs Alertargs = new AlertMessageEventArgs("this is a fake restart message", new Random().Next(99999).ToString(), new OpenMetaverse.StructuredData.OSDMap());
                        AlertEvent(this, Alertargs);
                        return;
                    }
                }
                JsonApiDefine APIE = JsonConvert.DeserializeObject <JsonApiDefine>(message);

                CoreCommandLib(sender_uuid, frommaster, APIE.cmd, APIE.args, APIE.signing, APIE.reply);
            }
            catch (Exception e)
            {
                LogFormater.Crit("[CoreCommandLib] exploded: " + e.Message + "");
            }
        }
예제 #2
0
 protected override void BotChatControler(string message, string sender_name, UUID sender_uuid, bool avatar, bool group, UUID group_uuid, bool localchat, bool fromme)
 {
     base.BotChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme);
     if ((group == true) || (localchat == true) || (fromme == true))
     {
         return;
     }
     try
     {
         JsonApiDefine APIE = JsonConvert.DeserializeObject <JsonApiDefine>(message);
         JsonChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme);
     }
     catch
     {
         // Old style [non json] to json converter [to be phased out]
         string   signing_code = "";
         string[] S1           = message.Split(new[] { "@@@" }, StringSplitOptions.RemoveEmptyEntries);
         if (S1.Length == 2)
         {
             signing_code = S1[1];
         }
         S1 = S1[0].Split(new[] { "#|#" }, StringSplitOptions.RemoveEmptyEntries);
         string outputto = "none";
         if (S1.Length == 2)
         {
             outputto = S1[1];
         }
         S1 = S1[0].Split(new[] { "|||" }, StringSplitOptions.RemoveEmptyEntries);
         string[] args = new string[] { };
         if (S1.Length == 2)
         {
             args = S1[1].Split(new[] { "~#~" }, StringSplitOptions.RemoveEmptyEntries);
         }
         JsonApiDefine Apihandoff = new JsonApiDefine();
         Apihandoff.cmd     = S1[0];
         Apihandoff.args    = args;
         Apihandoff.reply   = outputto;
         Apihandoff.signing = signing_code;
         message            = JsonConvert.SerializeObject(Apihandoff);
         JsonChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme);
     }
 }