Ejemplo n.º 1
0
        private void list_keys(CommandParams p)
        {
            Infobot info = (Infobot)p.SourceChannel.RetrieveObject("Infobot");

            if (info == null)
            {
                return;
            }

            string result = "";

            if (info.Keys.Count == 0)
            {
                result = "No keys defined";
            }
            else
            {
                foreach (Infobot.InfobotKey key in info.Keys)
                {
                    result += key.Key + ", ";
                }
            }

            if (result.EndsWith(", ", StringComparison.InvariantCulture))
            {
                result = result.Substring(0, result.Length - 2);
            }

            if (result.Length > 450)
            {
                result = result.Substring(0, 450) + "...";
            }
            IRC.DeliverMessage(result, p.SourceChannel);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Search
        /// </summary>
        /// <param name="key">Key</param>
        /// <param name="Chan"></param>
        public void RSearch(string key, Channel Chan)
        {
            if (key == Configuration.System.CommandPrefix + "regsearch")
            {
                IRC.DeliverMessage(messages.Localize("Search1", Chan.Language), Chan.Name);
                return;
            }
            if (!key.StartsWith(Configuration.System.CommandPrefix + "regsearch "))
            {
                return;
            }
            if (!misc.IsValidRegex(key))
            {
                IRC.DeliverMessage(messages.Localize("Error1", Chan.Language), Chan.Name);
                return;
            }
            if (key.Length < 12)
            {
                IRC.DeliverMessage(messages.Localize("Search1", Chan.Language), Chan.Name);
                return;
            }
            Channel data    = RetrieveMasterDBChannel(Chan);
            bool    Allowed = (data != null);

            if (!Allowed)
            {
                IRC.DeliverMessage(messages.Localize("db7", Chan.Language), Chan.Name);
                return;
            }
            Infobot infobot = (Infobot)data.RetrieveObject("Infobot");

            if (infobot == null)
            {
                Syslog.Log("Unable to perform regsearch because the Infobot doesn't exist in " + Chan.Name, true);
                return;
            }
            infobot.search_key    = key.Substring(11);
            InfobotModule.running = true;
            ReplyChan             = Chan;
            tSearch = new Thread(infobot.StartSearch);
            tSearch.Start();
            int check = 1;

            while (InfobotModule.running)
            {
                check++;
                Thread.Sleep(100);
                if (check > 8)
                {
                    tSearch.Abort();
                    IRC.DeliverMessage(messages.Localize("Error2", Chan.Language), Chan.Name);
                    InfobotModule.running = false;
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        public void Find(string key, Channel Chan)
        {
            if (Chan == null || !key.StartsWith(Configuration.System.CommandPrefix + "search"))
            {
                return;
            }
            Channel data    = RetrieveMasterDBChannel(Chan);
            bool    Allowed = (data != null);

            if (!Allowed)
            {
                IRC.DeliverMessage(messages.Localize("db7", Chan.Language), Chan.Name);
                return;
            }
            if (key.Length < 9)
            {
                IRC.DeliverMessage(messages.Localize("Error1", Chan.Language), Chan.Name);
                return;
            }
            key = key.Substring(8);
            int     count   = 0;
            Infobot infobot = (Infobot)data.RetrieveObject("Infobot");

            if (infobot == null)
            {
                Syslog.Log("Unable to perform regsearch because the Infobot doesn't exist in " + Chan.Name, true);
                return;
            }
            string results = "";

            lock (infobot)
            {
                foreach (InfobotKey Data in infobot.Keys)
                {
                    if (Data.Key == key || Data.Text.Contains(key))
                    {
                        results = results + Data.Key + ", ";
                        count++;
                    }
                }
            }
            if (String.IsNullOrEmpty(results))
            {
                IRC.DeliverMessage(messages.Localize("ResultsWereNotFound", Chan.Language), Chan.Name);
            }
            else
            {
                IRC.DeliverMessage(messages.Localize("Results", Chan.Language, new List <string> {
                    count.ToString()
                }) + results, Chan.Name);
            }
        }
Ejemplo n.º 4
0
 public void SaveData()
 {
     foreach (Channel x in Configuration.ChannelList)
     {
         Infobot infobot = (Infobot)x.RetrieveObject("Infobot");
         if (infobot != null)
         {
             if (infobot.stored == false)
             {
                 infobot.stored = true;
                 infobot.Save();
             }
         }
     }
 }
Ejemplo n.º 5
0
        public override string Extension_DumpHtml(Channel channel)
        {
            string  HTML = "";
            Infobot info = (Infobot)channel.RetrieveObject("Infobot");

            if (info != null)
            {
                List <Infobot.InfobotKey>   list    = new List <Infobot.InfobotKey>();
                List <Infobot.InfobotAlias> aliases = new List <Infobot.InfobotAlias>();
                lock (info)
                {
                    if (GetConfig(channel, "Infobot.Sorted", false))
                    {
                        list = info.SortedItem();
                    }
                    else
                    {
                        list.AddRange(info.Keys);
                    }
                    aliases.AddRange(info.Aliases);
                }
                string JSON_blob = Newtonsoft.Json.JsonConvert.SerializeObject(list);
                JSON_blob += "\n\n" + Newtonsoft.Json.JsonConvert.SerializeObject(aliases);
                string JSON_file = Configuration.Paths.DumpDir + "/" + channel.Name + "_dump.js";
                File.WriteAllText(JSON_file, JSON_blob);
                HTML += "JSON blob: <a href=\"" + System.Web.HttpUtility.UrlEncode(channel.Name) + "_dump.js\">open</a>";
                HTML += "\n<table border=1 class=\"infobot\" width=100%>\n<tr><th width=10%>Key</th><th>Value</th></tr>\n";
                if (list.Count > 0)
                {
                    foreach (Infobot.InfobotKey Key in list)
                    {
                        HTML += Core.HTML.AddKey(Key.Key, Key.Text);
                    }
                }
                HTML += "</table>\n";
                HTML += "<h4>Aliases</h4>\n<table class=\"infobot\" border=1 width=100%>\n";
                lock (info)
                {
                    foreach (Infobot.InfobotAlias data in info.Aliases)
                    {
                        HTML += Core.HTML.AddLink(data.Name, data.Key);
                    }
                }
                HTML += "</table><br />\n";
            }
            return(HTML);
        }
Ejemplo n.º 6
0
 public override void Load()
 {
     try
     {
         Unwritable = false;
         while (Core.IsRunning && IsWorking)
         {
             if (Unwritable)
             {
                 Thread.Sleep(200);
             }
             else if (jobs.Count > 0)
             {
                 Unwritable = true;
                 List <Infobot.InfoItem> list = new List <Infobot.InfoItem>();
                 list.AddRange(jobs);
                 jobs.Clear();
                 Unwritable = false;
                 foreach (Infobot.InfoItem item in list)
                 {
                     Infobot infobot = (Infobot)item.Channel.RetrieveObject("Infobot");
                     if (infobot != null)
                     {
                         infobot.InfobotExec(item.Name, item.User, item.Channel);
                     }
                 }
             }
             Thread.Sleep(200);
         }
     }
     catch (Exception b)
     {
         Unwritable = false;
         Console.WriteLine(b.InnerException);
     }
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public override bool Hook_SetConfig(Channel chan, libirc.UserInfo invoker, string config, string value)
        {
            bool _temp_a;

            switch (config)
            {
            case "infobot-trim-white-space-in-name":
                if (bool.TryParse(value, out _temp_a))
                {
                    SetConfig(chan, "Infobot.Trim-white-space-in-name", _temp_a);
                    IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List <string> {
                        value, config
                    }), chan.Name);
                    chan.SaveConfig();
                    return(true);
                }
                IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List <string> {
                    config, value
                }), chan.Name);
                return(true);

            case "infobot-auto-complete":
                if (bool.TryParse(value, out _temp_a))
                {
                    SetConfig(chan, "Infobot.auto-complete", _temp_a);
                    IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List <string> {
                        value, config
                    }), chan.Name);
                    chan.SaveConfig();
                    return(true);
                }
                IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List <string> {
                    config, value
                }), chan.Name);
                return(true);

            case "infobot-sorted":
                if (bool.TryParse(value, out _temp_a))
                {
                    SetConfig(chan, "Infobot.Sorted", _temp_a);
                    IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List <string> {
                        value, config
                    }), chan.Name);
                    chan.SaveConfig();
                    return(true);
                }
                IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List <string> {
                    config, value
                }), chan.Name);
                return(true);

            case "infobot-help":
                if (bool.TryParse(value, out _temp_a))
                {
                    SetConfig(chan, "Infobot.Help", _temp_a);
                    IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List <string> {
                        value, config
                    }), chan.Name);
                    chan.SaveConfig();
                    return(true);
                }
                IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List <string> {
                    config, value
                }), chan.Name);
                return(true);

            case "infobot-case":
                if (bool.TryParse(value, out _temp_a))
                {
                    SetConfig(chan, "Infobot.Case", _temp_a);
                    IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List <string> {
                        value, config
                    }), chan.Name);
                    chan.SaveConfig();
                    Infobot infobot = (Infobot)chan.RetrieveObject("Infobot");
                    if (infobot != null)
                    {
                        infobot.Sensitive = _temp_a;
                    }
                    return(true);
                }
                IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List <string> {
                    config, value
                }), chan.Name);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 9
0
        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            // "\uff01" is the full-width version of "!".
            if ((message.StartsWith("!") || message.StartsWith("\uff01")) && GetConfig(channel, "Infobot.Enabled", true))
            {
                while (Unwritable)
                {
                    Thread.Sleep(10);
                }
                Unwritable = true;
                Infobot.InfoItem item = new Infobot.InfoItem
                {
                    Channel = channel,
                    Name    = "!" + message.Substring(1),
                    User    = invoker,
                };
                jobs.Add(item);
                Unwritable = false;
            }

            Infobot infobot = null;

            if (message.StartsWith(Configuration.System.CommandPrefix))
            {
                infobot = (Infobot)channel.RetrieveObject("Infobot");
                if (infobot == null)
                {
                    Syslog.Log("Object Infobot in " + channel.Name + " doesn't exist", true);
                }
                if (GetConfig(channel, "Infobot.Enabled", true))
                {
                    if (infobot != null)
                    {
                        infobot.Find(message, channel);
                        infobot.RSearch(message, channel);
                    }
                }
            }

            if (Snapshots)
            {
                if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-recovery "))
                {
                    if (channel.SystemUsers.IsApproved(invoker, PermissionRestoreSnapshot))
                    {
                        string name = message.Substring("@infobot-recovery ".Length);
                        if (!GetConfig(channel, "Infobot.Enabled", true))
                        {
                            IRC.DeliverMessage("Infobot is not enabled in this channel", channel, libirc.Defs.Priority.Low);
                            return;
                        }
                        if (infobot != null)
                        {
                            infobot.RecoverSnapshot(channel, name);
                        }
                        return;
                    }
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                    }
                    return;
                }

                if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-snapshot "))
                {
                    if (channel.SystemUsers.IsApproved(invoker, PermissionSnaphot))
                    {
                        string name = message.Substring("@infobot-snapshot ".Length);
                        if (!GetConfig(channel, "Infobot.Enabled", true))
                        {
                            IRC.DeliverMessage("Infobot is not enabled in this channel", channel, libirc.Defs.Priority.Low);
                            return;
                        }
                        if (infobot != null)
                        {
                            infobot.CreateSnapshot(channel, name);
                        }
                        return;
                    }
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                    }
                    return;
                }

                if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-set-raw "))
                {
                    if (channel.SystemUsers.IsApproved(invoker, PermissionAdd))
                    {
                        string name = message.Substring("@infobot-set-raw ".Length);
                        if (!GetConfig(channel, "Infobot.Enabled", true))
                        {
                            IRC.DeliverMessage("Infobot is not enabled in this channel", channel, libirc.Defs.Priority.Low);
                            return;
                        }
                        if (infobot != null)
                        {
                            infobot.SetRaw(name, invoker.Nick, channel);
                            return;
                        }
                    }
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                    }
                    return;
                }

                if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-unset-raw "))
                {
                    if (channel.SystemUsers.IsApproved(invoker, PermissionAdd))
                    {
                        string name = message.Substring("@infobot-unset-raw ".Length);
                        if (!GetConfig(channel, "Infobot.Enabled", true))
                        {
                            IRC.DeliverMessage("Infobot is not enabled in this channel", channel, libirc.Defs.Priority.Low);
                            return;
                        }
                        if (infobot != null)
                        {
                            infobot.UnsetRaw(name, invoker.Nick, channel);
                            return;
                        }
                    }
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                    }
                    return;
                }

                if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-snapshot-rm "))
                {
                    if (channel.SystemUsers.IsApproved(invoker, PermissionDeleteSnapshot))
                    {
                        string name = message.Substring("@infobot-snapshot-rm ".Length);
                        name.Replace(".", "");
                        name.Replace("/", "");
                        name.Replace("\\", "");
                        name.Replace("*", "");
                        name.Replace("?", "");
                        if (name == "")
                        {
                            IRC.DeliverMessage("You should specify a file name", channel);
                            return;
                        }
                        if (!File.Exists(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name + Path.DirectorySeparatorChar + name))
                        {
                            IRC.DeliverMessage("File not found", channel);
                            return;
                        }
                        File.Delete(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name + Path.DirectorySeparatorChar + name);
                        IRC.DeliverMessage("Requested file was removed", channel);
                        return;
                    }
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel);
                    }
                    return;
                }

                if (message == Configuration.System.CommandPrefix + "infobot-snapshot-ls")
                {
                    string        files      = "";
                    DirectoryInfo di         = new DirectoryInfo(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name);
                    FileInfo[]    rgFiles    = di.GetFiles("*");
                    int           curr       = 0;
                    int           displaying = 0;
                    foreach (FileInfo fi in rgFiles)
                    {
                        curr++;
                        if (files.Length < 200)
                        {
                            files += fi.Name + " ";
                            displaying++;
                        }
                    }
                    string response;
                    if (curr == displaying)
                    {
                        response = "There are " + displaying + " files: " + files;
                    }
                    else
                    {
                        response = "There are " + curr + " files, but displaying only " + displaying + " of them: " + files;
                    }
                    if (curr == 0)
                    {
                        response = "There is no snapshot so far, create one!:)";
                    }
                    IRC.DeliverMessage(response, channel.Name);
                    return;
                }
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-share-trust+ "))
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionShare))
                {
                    if (channel.SharedDB != "local")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot16", channel.Language), channel);
                        return;
                    }
                    if (channel.SharedDB != "local" && channel.SharedDB != "")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot15", channel.Language), channel);
                        return;
                    }
                    if (message.Length <= "@infobot-share-trust+ ".Length)
                    {
                        IRC.DeliverMessage(messages.Localize("db6", channel.Language), channel.Name);
                        return;
                    }
                    string  name  = message.Substring("@infobot-share-trust+ ".Length);
                    Channel guest = Core.GetChannel(name);
                    if (guest == null)
                    {
                        IRC.DeliverMessage(messages.Localize("db8", channel.Language), channel.Name);
                        return;
                    }
                    if (channel.SharedLinkedChan.Contains(guest))
                    {
                        IRC.DeliverMessage(messages.Localize("db14", channel.Language), channel.Name);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("db1", channel.Language, new List <string> {
                        name
                    }), channel.Name);
                    lock (channel.SharedLinkedChan)
                    {
                        channel.SharedLinkedChan.Add(guest);
                    }
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-ignore- "))
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionIgnore))
                {
                    string item = message.Substring("@infobot-ignore+ ".Length);
                    if (item != "")
                    {
                        if (!channel.Infobot_IgnoredNames.Contains(item))
                        {
                            IRC.DeliverMessage(messages.Localize("infobot-ignore-found", channel.Language, new List <string> {
                                item
                            }), channel);
                            return;
                        }
                        channel.Infobot_IgnoredNames.Remove(item);
                        IRC.DeliverMessage(messages.Localize("infobot-ignore-rm", channel.Language, new List <string> {
                            item
                        }), channel);
                        channel.SaveConfig();
                        return;
                    }
                }
                else
                {
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                    }
                }
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-ignore+ "))
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionIgnore))
                {
                    string item = message.Substring("@infobot-ignore+ ".Length);
                    if (item != "")
                    {
                        if (channel.Infobot_IgnoredNames.Contains(item))
                        {
                            IRC.DeliverMessage(messages.Localize("infobot-ignore-exist", channel.Language, new List <string> {
                                item
                            }), channel);
                            return;
                        }
                        channel.Infobot_IgnoredNames.Add(item);
                        IRC.DeliverMessage(messages.Localize("infobot-ignore-ok", channel.Language, new List <string> {
                            item
                        }), channel);
                        channel.SaveConfig();
                        return;
                    }
                }
                else
                {
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                    }
                }
            }

            if (message == Configuration.System.CommandPrefix + "infobot-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionManage))
                {
                    if (!GetConfig(channel, "Infobot.Enabled", true))
                    {
                        IRC.DeliverMessage(messages.Localize("infobot1", channel.Language), channel);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("infobot2", channel.Language), channel, libirc.Defs.Priority.High);
                    SetConfig(channel, "Infobot.Enabled", false);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-share-trust- "))
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionShare))
                {
                    if (channel.SharedDB != "local")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot16", channel.Language), channel);
                        return;
                    }
                    if (message.Length <= "@infobot-share-trust+ ".Length)
                    {
                        IRC.DeliverMessage(messages.Localize("db6", channel.Language), channel);
                        return;
                    }
                    string  name   = message.Substring("@infobot-share-trust- ".Length);
                    Channel target = Core.GetChannel(name);
                    if (target == null)
                    {
                        IRC.DeliverMessage(messages.Localize("db8", channel.Language), channel);
                        return;
                    }
                    if (channel.SharedLinkedChan.Contains(target))
                    {
                        channel.SharedLinkedChan.Remove(target);
                        IRC.DeliverMessage(messages.Localize("db2", channel.Language, new List <string> {
                            name
                        }), channel);
                        channel.SaveConfig();
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("db4", channel.Language), channel);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-detail "))
            {
                if ((message.Length) <= "@infobot-detail ".Length)
                {
                    IRC.DeliverMessage(messages.Localize("db6", channel.Language), channel);
                    return;
                }
                if (GetConfig(channel, "Infobot.Enabled", true))
                {
                    if (channel.SharedDB == "local" || channel.SharedDB == "")
                    {
                        if (infobot != null)
                        {
                            infobot.InfobotDetail(message.Substring(16), channel);
                        }
                        return;
                    }
                    if (channel.SharedDB != "")
                    {
                        Channel db = Core.GetChannel(channel.SharedDB);
                        if (db == null)
                        {
                            IRC.DeliverMessage("Error, null pointer to shared channel", channel, libirc.Defs.Priority.Low);
                            return;
                        }
                        if (infobot != null)
                        {
                            infobot.InfobotDetail(message.Substring(16), channel);
                        }
                        return;
                    }
                    return;
                }
                IRC.DeliverMessage("Infobot is not enabled on this channel", channel, libirc.Defs.Priority.Low);
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-link "))
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionShare))
                {
                    if (channel.SharedDB == "local")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot17", channel.Language), channel);
                        return;
                    }
                    if (channel.SharedDB != "")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot18", channel.Language, new List <string> {
                            channel.SharedDB
                        }), channel);
                        return;
                    }
                    if ((message.Length - 1) < "@infobot-link ".Length)
                    {
                        IRC.DeliverMessage(messages.Localize("db6", channel.Language), channel);
                        return;
                    }
                    string  name = message.Substring("@infobot-link ".Length);
                    Channel db   = Core.GetChannel(name);
                    if (db == null)
                    {
                        IRC.DeliverMessage(messages.Localize("db8", channel.Language), channel);
                        return;
                    }
                    if (!Infobot.Linkable(db, channel))
                    {
                        IRC.DeliverMessage(messages.Localize("db9", channel.Language), channel);
                        return;
                    }
                    channel.SharedDB = name.ToLower();
                    IRC.DeliverMessage(messages.Localize("db10", channel.Language), channel);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "infobot-share-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionShare))
                {
                    if (channel.SharedDB == "")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot14", channel.Language), channel);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("infobot13", channel.Language), channel);
                    foreach (Channel curr in Configuration.ChannelList)
                    {
                        if (curr.SharedDB == channel.Name.ToLower())
                        {
                            curr.SharedDB = "";
                            curr.SaveConfig();
                            IRC.DeliverMessage(messages.Localize("infobot19", curr.Language, new List <string> {
                                invoker.Nick
                            }), curr);
                        }
                    }
                    channel.SharedDB = "";
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "infobot-on")
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionManage))
                {
                    if (GetConfig(channel, "Infobot.Enabled", true))
                    {
                        IRC.DeliverMessage(messages.Localize("infobot3", channel.Language), channel);
                        return;
                    }
                    SetConfig(channel, "Infobot.Enabled", true);
                    channel.SaveConfig();
                    IRC.DeliverMessage(messages.Localize("infobot4", channel.Language), channel, libirc.Defs.Priority.High);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "infobot-share-on")
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionShare))
                {
                    if (channel.SharedDB == "local")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot11", channel.Language), channel, libirc.Defs.Priority.High);
                        return;
                    }
                    if (channel.SharedDB != "local" && channel.SharedDB != "")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot15", channel.Language), channel, libirc.Defs.Priority.High);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("infobot12", channel.Language), channel);
                    channel.SharedDB = "local";
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
            }
        }