Exemplo n.º 1
0
        private bool DeliverKey(InfobotKey Key, string OriginalText, Channel chan, libirc.UserInfo fu)
        {
            if (Key == null)
            {
                return(false);
            }
            string Target_ = "";
            string text    = OriginalText;

            // we remove the key name from message so that only parameters remain
            if (text.Contains(" "))
            {
                text = text.Substring(text.IndexOf(" ") + 1);
            }
            else
            {
                text = "";
            }
            if (text.Contains("|"))
            {
                Target_ = OriginalText.Substring(OriginalText.IndexOf("|") + 1);
                if (Module.GetConfig(chan, "Infobot.Trim-white-space-in-name", true))
                {
                    Target_ = Target_.Trim();
                }
                text = text.Substring(0, text.IndexOf("|"));
            }
            List <string> Parameters = new List <string>(text.Split(' '));
            string        value_     = ParseInfo(Parameters, text, Key, fu);

            if (Key.IsAct)
            {
                if (String.IsNullOrEmpty(Target_))
                {
                    IRC.DeliverAction(value_, chan);
                }
                else
                {
                    IRC.DeliverAction(Target_ + ": " + value_, chan);
                }
            }
            else
            {
                if (String.IsNullOrEmpty(Target_))
                {
                    IRC.DeliverMessage(value_, chan);
                }
                else
                {
                    IRC.DeliverMessage(Target_ + ": " + value_, chan);
                }
            }
            Key.Displayed++;
            Key.LastTime = DateTime.Now;
            this.StoreDB();
            return(true);
        }
Exemplo n.º 2
0
        public void UnsetRaw(string key, string user, Channel chan)
        {
            InfobotKey Key = GetKey(key, Sensitive);

            if (Key == null)
            {
                IRC.DeliverMessage("There is no such a key, " + user, chan.Name);
                return;
            }
            Key.Raw = false;
            IRC.DeliverMessage("This key will be displayed normally", chan.Name);
            this.StoreDB();
        }
Exemplo n.º 3
0
        public void SetRaw(string key, string user, Channel chan)
        {
            InfobotKey Key = GetKey(key, Sensitive);

            if (Key == null)
            {
                IRC.DeliverMessage("There is no such a key, " + user, chan.Name);
                return;
            }
            Key.Raw = true;
            IRC.DeliverMessage("This key will be displayed with no extra styling, variables and will ignore all symbols", chan.Name);
            this.StoreDB();
        }
Exemplo n.º 4
0
        private static string ParseInfo(List <string> parameters, string original, InfobotKey Key, libirc.UserInfo fu)
        {
            bool raw = false;

            if (Key != null)
            {
                raw = Key.Raw;
            }
            string text = Key.Text;

            if (!raw)
            {
                text = text.Replace("$infobot_nick", fu.Nick);
                text = text.Replace("$infobot_host", fu.Host);
            }
            if (parameters.Count > 0)
            {
                string keys = "";
                int    curr = 0;
                while (parameters.Count > curr)
                {
                    if (!raw)
                    {
                        text = text.Replace("$" + (curr + 1), parameters[curr]);
                        text = text.Replace("$url_encoded_" + (curr + 1), HttpUtility.UrlEncode(parameters[curr]));
                        text = text.Replace("$wiki_encoded_" + (curr + 1), HttpUtility.UrlEncode(parameters[curr]).Replace("+", "_").Replace("%3a", ":").Replace("%2f", "/").Replace("%28", "(").Replace("%29", ")"));
                    }
                    if (keys == "")
                    {
                        keys = parameters[curr];
                    }
                    else
                    {
                        keys = keys + " " + parameters[curr];
                    }
                    curr++;
                }
                if (original.Contains("|") && !raw)
                {
                    original = original.Substring(0, original.IndexOf("|"));
                    original = original.Trim();
                }
                text = text.Replace("$*", original);
                text = text.Replace("$url_encoded_*", HttpUtility.UrlEncode(original));
                text = text.Replace("$wiki_encoded_*", HttpUtility.UrlEncode(original).Replace("+", "_").Replace("%3a", ":").Replace("%2f", "/").Replace("%28", "(").Replace("%29", ")"));
            }
            return(text);
        }
Exemplo n.º 5
0
        /// <summary>
        /// @infobot-detail
        /// </summary>
        /// <param name="key"></param>
        /// <param name="chan"></param>
        public void InfobotDetail(string key, Channel chan)
        {
            InfobotKey CV = GetKey(key, Sensitive);

            if (CV == null)
            {
                IRC.DeliverMessage("There is no such a key", chan, libirc.Defs.Priority.Low);
                return;
            }
            if (CV.Key == key)
            {
                string created = "N/A";
                string last    = "N/A";
                string name    = "N/A";
                if (CV.LastTime != NA)
                {
                    TimeSpan span = DateTime.Now - CV.LastTime;
                    last = CV.LastTime + " (" + span + " ago)";
                }
                if (CV.CreationTime != NA)
                {
                    created = CV.CreationTime.ToString();
                }
                if (!string.IsNullOrEmpty(CV.User))
                {
                    name = CV.User;
                }
                string type = " this key is not raw (variables will be changed using some awesome magic)";
                if (CV.Raw)
                {
                    type = " this key is raw";
                }
                IRC.DeliverMessage(messages.Localize("infobot-data", chan.Language, new List <string> {
                    key, name, created, CV.Displayed.ToString(),
                    last + type
                }), chan, libirc.Defs.Priority.Low);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Print a value to channel if found, this message doesn't need to be a valid command for it to work
        /// </summary>
        /// <param name="message">Message</param>
        /// <param name="user">User</param>
        /// <param name="chan">Channel</param>
        /// <param name="host">Host name</param>
        /// <returns></returns>
        public bool InfobotExec(string message, libirc.UserInfo user, Channel chan)
        {
            try
            {
                // check if it starts with the prefix
                if (!message.StartsWith(prefix))
                {
                    return(true);
                }
                // check if this channel is allowed to access the db
                Channel data    = RetrieveMasterDBChannel(chan);
                bool    Allowed = (data != null);
                // handle prefix
                message = message.Substring(1);
                Infobot infobot = null;

                if (Allowed)
                {
                    infobot = (Infobot)data.RetrieveObject("Infobot");
                }

                // check if key is ignored
                if (IsIgnored(message, chan))
                {
                    return(true);
                }

                // split by parameters so we can easily get the arguments user provided
                List <string> Parameters = new List <string>(message.Split(' '));

                // check if key has some parameters or command
                if (Parameters.Count > 1)
                {
                    // someone want to create a new key
                    if (Parameters[1] == "is" || Parameters[1] == "act")
                    {
                        bool isAct = Parameters[1] == "act";
                        // check if they are approved to do that
                        if (chan.SystemUsers.IsApproved(user, InfobotModule.PermissionAdd))
                        {
                            if (!Allowed)
                            {
                                // check if we can deliver error message
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("db7", chan.Language), chan);
                                }
                                return(true);
                            }
                            // they can but there is only 1 parameter and we need at least 2
                            if (Parameters.Count < 3)
                            {
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("key", chan.Language), chan);
                                }
                                return(true);
                            }
                            // get a key name
                            string key;
                            if (!isAct)
                            {
                                key = message.Substring(message.IndexOf(" is") + 4);
                            }
                            else
                            {
                                key = message.Substring(message.IndexOf(" act") + 5);
                            }
                            if (infobot != null)
                            {
                                infobot.SetKey(key, Parameters[0], user.Nick, chan, isAct);
                                return(true);
                            }
                        }
                        else
                        {
                            if (!chan.SuppressWarnings)
                            {
                                IRC.DeliverMessage(messages.Localize("Authorization", chan.Language), chan);
                            }
                        }
                        return(false);
                    }
                    else if (Parameters[1] == "replace")
                    {
                        // check if they are approved to do that
                        if (chan.SystemUsers.IsApproved(user, InfobotModule.PermissionAdd))
                        {
                            if (!Allowed)
                            {
                                // check if we can deliver error message
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("db7", chan.Language), chan);
                                }
                                return(true);
                            }
                            // they can but there is only 1 parameter and we need at least 2
                            if (Parameters.Count < 3)
                            {
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("key", chan.Language), chan);
                                }
                                return(true);
                            }
                            // get a key name
                            string key = message.Substring(message.IndexOf(" replace") + 9);
                            if (infobot != null)
                            {
                                infobot.replaceKey(key, Parameters[0], user.Nick, chan);
                                return(true);
                            }
                        }
                        else if (!chan.SuppressWarnings)
                        {
                            IRC.DeliverMessage(messages.Localize("Authorization", chan.Language), chan);
                        }
                        return(false);
                    }
                    // alias
                    bool force = false;
                    if (Parameters[1] == "alias" || Parameters[1] == "force-alias")
                    {
                        if (Parameters[1] == "force-alias")
                        {
                            force = true;
                        }
                        if (chan.SystemUsers.IsApproved(user, InfobotModule.PermissionAdd))
                        {
                            if (!Allowed)
                            {
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("db7", chan.Language), chan);
                                }
                                return(true);
                            }
                            if (Parameters.Count < 3)
                            {
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("InvalidAlias", chan.Language), chan);
                                }
                                return(true);
                            }
                            if (infobot != null)
                            {
                                infobot.aliasKey(message.Substring(message.IndexOf(" alias") + 7), Parameters[0], "", chan, force);
                                return(true);
                            }
                        }
                        else
                        {
                            if (!chan.SuppressWarnings)
                            {
                                IRC.DeliverMessage(messages.Localize("Authorization", chan.Language), chan);
                            }
                        }
                        return(false);
                    }
                    if (Parameters[1] == "unalias")
                    {
                        if (chan.SystemUsers.IsApproved(user, InfobotModule.PermissionDel))
                        {
                            if (!Allowed)
                            {
                                if (!chan.SuppressWarnings)
                                {
                                    IRC.DeliverMessage(messages.Localize("db7", chan.Language), chan);
                                }
                                return(true);
                            }
                            if (infobot != null)
                            {
                                lock (infobot)
                                {
                                    foreach (InfobotAlias b in infobot.Aliases)
                                    {
                                        if (b.Name == Parameters[0])
                                        {
                                            infobot.Aliases.Remove(b);
                                            IRC.DeliverMessage(messages.Localize("AliasRemoved", chan.Language), chan);
                                            this.StoreDB();
                                            return(false);
                                        }
                                    }
                                }
                            }
                            return(false);
                        }
                        if (!chan.SuppressWarnings)
                        {
                            IRC.DeliverMessage(messages.Localize("Authorization", chan.Language), chan);
                        }
                        return(false);
                    }
                    // remove key
                    if (Parameters[1] == "del")
                    {
                        if (chan.SystemUsers.IsApproved(user, InfobotModule.PermissionDel))
                        {
                            if (!Allowed)
                            {
                                IRC.DeliverMessage(messages.Localize("db7", chan.Language), chan);
                                return(true);
                            }
                            if (infobot != null)
                            {
                                infobot.rmKey(Parameters[0], "", chan);
                            }
                        }
                        else
                        {
                            if (!chan.SuppressWarnings)
                            {
                                IRC.DeliverMessage(messages.Localize("Authorization", chan.Language), chan);
                            }
                        }
                        return(false);
                    }
                }
                if (!Allowed)
                {
                    return(true);
                }

                InfobotKey Key = infobot.GetKey(Parameters[0]);
                // let's try to deliver this as a key
                if (DeliverKey(Key, message, chan, user))
                {
                    return(true);
                }

                string lower = Parameters[0].ToLower();
                // there is no key with this name, let's check if there is an alias for such a key
                lock (infobot)
                {
                    foreach (InfobotAlias alias in infobot.Aliases)
                    {
                        if (Sensitive)
                        {
                            if (alias.Name == Parameters[0])
                            {
                                // let's try to get a target key
                                InfobotKey Key_ = infobot.GetKey(alias.Key);
                                if (DeliverKey(Key_, message, chan, user))
                                {
                                    return(true);
                                }
                            }
                        }
                        else
                        {
                            if (alias.Name.ToLower() == lower)
                            {
                                // let's try to get a target key
                                InfobotKey Key_ = infobot.GetKey(alias.Key);
                                if (DeliverKey(Key_, message, chan, user))
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }

                if (Module.GetConfig(chan, "Infobot.auto-complete", false))
                {
                    if (infobot != null)
                    {
                        List <string> results = new List <string>();
                        lock (infobot)
                        {
                            foreach (InfobotKey f in infobot.Keys)
                            {
                                if (!results.Contains(f.Key) && f.Key.StartsWith(Parameters[0]))
                                {
                                    results.Add(f.Key);
                                }
                            }
                            foreach (InfobotAlias f in infobot.Aliases)
                            {
                                if (!results.Contains(f.Key) && f.Key.StartsWith(Parameters[0]))
                                {
                                    results.Add(f.Key);
                                }
                            }
                        }

                        if (results.Count == 1)
                        {
                            InfobotKey Key_ = infobot.GetKey(results[0]);
                            if (DeliverKey(Key_, message, chan, user))
                            {
                                return(true);
                            }
                            lock (infobot)
                            {
                                foreach (InfobotAlias alias in infobot.Aliases)
                                {
                                    if (alias.Name == results[0])
                                    {
                                        Key_ = infobot.GetKey(alias.Name);
                                        if (DeliverKey(Key_, message, chan, user))
                                        {
                                            return(true);
                                        }
                                    }
                                }
                            }
                        }

                        if (results.Count > 1)
                        {
                            if (Module.GetConfig(chan, "Infobot.Sorted", false))
                            {
                                results.Sort();
                            }
                            string x = "";
                            foreach (string ix in results)
                            {
                                x += ix + ", ";
                            }
                            IRC.DeliverMessage(messages.Localize("infobot-c-e", chan.Language, new List <string> {
                                x
                            }), chan);
                            return(true);
                        }
                    }
                }

                if (Module.GetConfig(chan, "Infobot.Help", false) && infobot != null)
                {
                    List <string> Sugg = new List <string>();
                    string        key  = Parameters[0].ToLower();
                    lock (infobot)
                    {
                        foreach (InfobotKey f in infobot.Keys)
                        {
                            if (!Sugg.Contains(f.Key) && (f.Text.ToLower().Contains(key) || f.Key.ToLower().Contains(key)))
                            {
                                Sugg.Add(f.Key);
                            }
                        }
                    }

                    if (Sugg.Count > 0)
                    {
                        string x = "";
                        if (Module.GetConfig(chan, "Infobot.Sorted", false))
                        {
                            Sugg.Sort();
                        }
                        foreach (string a in Sugg)
                        {
                            x += "!" + a + ", ";
                        }
                        IRC.DeliverMessage(messages.Localize("infobot-help", chan.Language, new List <string> {
                            x
                        }), chan.Name);
                        return(true);
                    }
                }
            }
            catch (Exception b)
            {
                Parent.HandleException(b);
            }
            return(true);
        }
Exemplo n.º 7
0
 public static string parseInfo(string key, string[] pars, string original, InfobotKey Key)
 {
     string keyv = key;
     bool raw = false;
     if (Key != null)
     {
         raw = Key.Raw;
     }
     if (pars.Length > 1)
     {
         string keys = "";
         int curr = 1;
         while (pars.Length > curr)
         {
             if (!raw)
             {
                 keyv = keyv.Replace("$" + curr.ToString(), pars[curr]);
                 keyv = keyv.Replace("$url_encoded_" + curr.ToString(), System.Web.HttpUtility.UrlEncode(pars[curr]));
             }
             if (keys == "")
             {
                 keys = pars[curr];
             }
             else
             {
                 keys = keys + " " + pars[curr];
             }
             curr++;
         }
         keyv = keyv.Replace("$*", original);
         keyv = keyv.Replace("$url_encoded_*", System.Web.HttpUtility.UrlEncode(original));
     }
     return keyv;
 }
Exemplo n.º 8
0
 public bool LoadData()
 {
     Keys.Clear();
     // Checking if db isn't broken
     core.recoverFile(datafile_xml, Channel);
     if (Load())
     {
         core.Log("Obsolete database found for " + Channel + " converting to new format");
         Save();
         File.Delete(datafile_raw);
         return true;
     }
     if (!File.Exists(datafile_xml))
     {
         // Create db
         Save();
         return true;
     }
     try
     {
         System.Xml.XmlDocument data = new System.Xml.XmlDocument();
         if (!File.Exists(datafile_xml))
         {
             Keys.Clear();
             return true;
         }
         data.Load(datafile_xml);
         lock (Keys)
         {
             lock (Alias)
             {
                 Keys.Clear();
                 Alias.Clear();
                 foreach (System.Xml.XmlNode xx in data.ChildNodes[0].ChildNodes)
                 {
                     if (xx.Name == "alias")
                     {
                         InfobotAlias _Alias = new InfobotAlias(xx.Attributes[0].Value, xx.Attributes[1].Value);
                         Alias.Add(_Alias);
                         continue;
                     }
                     bool raw = false;
                     if (xx.Attributes.Count > 6)
                     {
                         raw = bool.Parse(xx.Attributes[6].Value);
                     }
                     InfobotKey _key = new InfobotKey(xx.Attributes[0].Value, xx.Attributes[1].Value, xx.Attributes[2].Value, "false", xx.Attributes[3].Value,
                     xx.Attributes[4].Value, int.Parse(xx.Attributes[5].Value), raw);
                     Keys.Add(_key);
                 }
             }
         }
     }
     catch (Exception fail)
     {
         core.handleException(fail);
     }
     return true;
 }
Exemplo n.º 9
0
 private static string ParseInfo(List<string> parameters, string original, InfobotKey Key, libirc.UserInfo fu)
 {
     bool raw = false;
     if (Key != null)
         raw = Key.Raw;
     string text = Key.Text;
     if (!raw)
     {
         text = text.Replace("$infobot_nick", fu.Nick);
         text = text.Replace("$infobot_host", fu.Host);
     }
     if (parameters.Count > 0)
     {
         string keys = "";
         int curr = 0;
         while (parameters.Count > curr)
         {
             if (!raw)
             {
                 text = text.Replace("$" + (curr+1), parameters[curr]);
                 text = text.Replace("$url_encoded_" + (curr+1), HttpUtility.UrlEncode(parameters[curr]));
                 text = text.Replace("$wiki_encoded_" + (curr+1), HttpUtility.UrlEncode(parameters[curr]).Replace("+", "_").Replace("%3a", ":").Replace("%2f", "/").Replace("%28", "(").Replace("%29", ")"));
             }
             if (keys == "")
             {
                 keys = parameters[curr];
             }
             else
             {
                 keys = keys + " " + parameters[curr];
             }
             curr++;
         }
         if (original.Contains ("|") && !raw)
         {
             original = original.Substring (0, original.IndexOf ("|"));
             original = original.Trim ();
         }
         text = text.Replace("$*", original);
         text = text.Replace("$url_encoded_*", HttpUtility.UrlEncode(original));
         text = text.Replace("$wiki_encoded_*", HttpUtility.UrlEncode(original).Replace("+", "_").Replace("%3a", ":").Replace("%2f", "/").Replace("%28", "(").Replace("%29", ")"));
     }
     return text;
 }
Exemplo n.º 10
0
 private bool DeliverKey(InfobotKey Key, string OriginalText, Channel chan, libirc.UserInfo fu)
 {
     if (Key == null)
     {
         return false;
     }
     string Target_ = "";
     string text = OriginalText;
     // we remove the key name from message so that only parameters remain
     if (text.Contains(" "))
         text = text.Substring(text.IndexOf(" ") + 1);
     else
         text = "";
     if (text.Contains("|"))
     {
         Target_ = OriginalText.Substring(OriginalText.IndexOf("|") + 1);
         if (Module.GetConfig(chan, "Infobot.Trim-white-space-in-name", true))
         {
             Target_ = Target_.Trim();
         }
         text = text.Substring(0, text.IndexOf("|"));
     }
     List<string> Parameters = new List<string>(text.Split(' '));
     string value_ = ParseInfo(Parameters, text, Key, fu);
     if (Key.IsAct)
     {
         if (String.IsNullOrEmpty(Target_))
             IRC.DeliverAction(value_, chan);
         else
             IRC.DeliverAction(Target_ + ": " + value_, chan);
     }
     else
     {
         if (String.IsNullOrEmpty(Target_))
             IRC.DeliverMessage(value_, chan);
         else
             IRC.DeliverMessage(Target_ + ": " + value_, chan);
     }
     Key.Displayed++;
     Key.LastTime = DateTime.Now;
     this.StoreDB();
     return true;
 }
Exemplo n.º 11
0
        public bool LoadData()
        {
            lock (this)
            {
                Keys.Clear();
            }
            // Checking if db isn't broken
            Core.RecoverFile(datafile_xml, pChannel.Name);
            if (LoadAncientDB())
            {
                Parent.Log("Obsolete database found for " + pChannel.Name + " converting to new format");
                Save();
                File.Delete(datafile_raw);
                return(true);
            }
            if (!File.Exists(datafile_xml))
            {
                // Create db
                Save();
                return(true);
            }
            try
            {
                XmlDocument data = new XmlDocument();
                if (!File.Exists(datafile_xml))
                {
                    lock (this)
                    {
                        Keys.Clear();
                    }
                    return(true);
                }
                data.Load(datafile_xml);
                lock (this)
                {
                    Keys.Clear();
                    Aliases.Clear();
                }
                foreach (XmlNode xx in data.ChildNodes[0].ChildNodes)
                {
                    if (xx.Name == "alias")
                    {
                        InfobotAlias _Alias = new InfobotAlias(xx.Attributes[0].Value, xx.Attributes[1].Value);
                        lock (this)
                        {
                            Aliases.Add(_Alias);
                        }
                        continue;
                    }
                    bool   raw    = false;
                    string name   = "";
                    string value  = "";
                    string user   = "******";
                    string date   = "";
                    string time   = "";
                    bool   is_act = false;
                    int    number = 0;
                    foreach (XmlAttribute x in xx.Attributes)
                    {
                        switch (x.Name)
                        {
                        case "key_name":
                            name = x.Value;
                            break;

                        case "data":
                            value = x.Value;
                            break;

                        case "created_date":
                            date = x.Value;
                            break;

                        case "nickname":
                            user = x.Value;
                            break;

                        case "touched":
                            time = x.Value;
                            break;

                        case "triggered":
                            number = int.Parse(x.Value);
                            break;

                        case "raw":
                            raw = bool.Parse(x.Value);
                            break;

                        case "is_act":
                            is_act = bool.Parse(x.Value);
                            break;
                        }
                    }
                    InfobotKey _key = new InfobotKey(name, value, user, "false", date, time, number, raw, is_act);
                    lock (this)
                    {
                        Keys.Add(_key);
                    }
                }
            }
            catch (Exception fail)
            {
                Parent.HandleException(fail, "infobot");
            }
            return(true);
        }
Exemplo n.º 12
0
 public bool LoadData()
 {
     lock (this)
     {
         Keys.Clear();
     }
     // Checking if db isn't broken
     Core.RecoverFile(datafile_xml, pChannel.Name);
     if (LoadAncientDB())
     {
         Parent.Log("Obsolete database found for " + pChannel.Name + " converting to new format");
         Save();
         File.Delete(datafile_raw);
         return true;
     }
     if (!File.Exists(datafile_xml))
     {
         // Create db
         Save();
         return true;
     }
     try
     {
         XmlDocument data = new XmlDocument();
         if (!File.Exists(datafile_xml))
         {
             lock (this)
             {
                 Keys.Clear();
             }
             return true;
         }
         data.Load(datafile_xml);
         lock (this)
         {
             Keys.Clear();
             Aliases.Clear();
         }
         foreach (XmlNode xx in data.ChildNodes[0].ChildNodes)
         {
             if (xx.Name == "alias")
             {
                 InfobotAlias _Alias = new InfobotAlias(xx.Attributes[0].Value, xx.Attributes[1].Value);
                 lock (this)
                 {
                     Aliases.Add(_Alias);
                 }
                 continue;
             }
             bool raw = false;
             string name = "";
             string value = "";
             string user = "******";
             string date = "";
             string time = "";
             bool is_act = false;
             int number = 0;
             foreach (XmlAttribute x in xx.Attributes)
             {
                 switch (x.Name)
                 {
                     case "key_name":
                         name = x.Value;
                         break;
                     case "data":
                         value = x.Value;
                         break;
                     case "created_date":
                         date = x.Value;
                         break;
                     case "nickname":
                         user = x.Value;
                         break;
                     case "touched":
                         time = x.Value;
                         break;
                     case "triggered":
                         number = int.Parse(x.Value);
                         break;
                     case "raw":
                         raw = bool.Parse(x.Value);
                         break;
                     case "is_act":
                         is_act = bool.Parse(x.Value);
                         break;
                 }
             }
             InfobotKey _key = new InfobotKey(name, value, user, "false", date, time, number, raw, is_act);
             lock (this)
             {
                 Keys.Add(_key);
             }
         }
     }
     catch (Exception fail)
     {
         Parent.HandleException(fail, "infobot");
     }
     return true;
 }