Log() public static method

Log the specified Message and MessageType.
public static Log ( string Message, Type MessageType ) : bool
Message string /// If set to true message. ///
MessageType System.Type /// If set to true message type. ///
return bool
示例#1
0
        private static void WriteData()
        {
            List <STI> jobs = new List <STI>();

            lock (Data)
            {
                jobs.AddRange(Data);
                Data.Clear();
            }
            foreach (STI item in jobs)
            {
                if (item.DelayedWrite)
                {
                    while (!Write(item))
                    {
                        Syslog.Log("Unable to write data, delaying write", true);
                        Thread.Sleep(6000);
                    }
                }
                else
                {
                    Write(item);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Called on action
        /// </summary>
        /// <param name="message">Message</param>
        /// <param name="Channel">Channel</param>
        /// <param name="host">Host</param>
        /// <param name="nick">Nick</param>
        /// <returns></returns>
        public static bool GetAction(string message, string Channel, string host, string nick)
        {
            Channel channel = GetChannel(Channel);

            if (channel != null)
            {
                foreach (Module curr in ExtensionHandler.ExtensionList)
                {
                    if (!curr.IsWorking)
                    {
                        continue;
                    }
                    try
                    {
                        curr.Hook_ACTN(channel, new libirc.UserInfo(nick, "", host), message);
                    }
                    catch (Exception fail)
                    {
                        Syslog.Log("Exception on Hook_ACTN in module: " + curr.Name);
                        HandleException(fail, curr.Name);
                    }
                }
            }
            return(false);
        }
示例#3
0
 /// <summary>
 /// Intialise module
 /// </summary>
 /// <param name="module"></param>
 public static void InitialiseMod(Module module)
 {
     if (string.IsNullOrEmpty(module.Name))
     {
         Syslog.Log("This module has invalid name and was terminated to prevent troubles", true);
         throw new WmibException("Invalid name");
     }
     module.Date = DateTime.Now;
     if (Module.Exist(module.Name))
     {
         Syslog.Log("This module is already registered " + module.Name + " this new instance was terminated to prevent troubles", true);
         throw new WmibException("This module is already registered");
     }
     try
     {
         lock (module)
         {
             Syslog.Log("Loading module: " + module.Name + " v" + module.Version);
             Extensions.Add(module);
         }
         module.Init();
     }
     catch (Exception fail)
     {
         module.IsWorking = false;
         Syslog.Log("Unable to create instance of " + module.Name);
         Core.HandleException(fail);
     }
 }
示例#4
0
        protected override void __evt_KICK(NetworkKickEventArgs args)
        {
            if (args.ChannelName == Configuration.System.DebugChan && this.instance != Instance.PrimaryInstance)
            {
                return;
            }
            Channel channel = Core.GetChannel(args.ChannelName);

            if (channel == null)
            {
                return;
            }
            SystemHooks.IrcKick(channel, args.SourceInfo, args.Target);
            if (this.Nickname.ToLower() == args.Target.ToLower())
            {
                Syslog.Log("I was kicked from " + args.ChannelName + " by " + args.SourceInfo.Nick + " with kick message: " + args.Message);
                lock (Configuration.Channels)
                {
                    if (Configuration.Channels.Contains(channel))
                    {
                        Configuration.Channels.Remove(channel);
                    }
                }
                Configuration.Save();
            }
        }
示例#5
0
        protected override void __evt_JOIN(NetworkChannelEventArgs args)
        {
            if (args.ChannelName == Configuration.System.DebugChan && this.instance != Instance.PrimaryInstance)
            {
                return;
            }
            Channel channel = Core.GetChannel(args.ChannelName);

            if (channel != null)
            {
                foreach (Module module in ExtensionHandler.ExtensionList)
                {
                    try
                    {
                        if (module.IsWorking)
                        {
                            module.Hook_Join(channel, args.SourceInfo);
                        }
                    }
                    catch (Exception fail)
                    {
                        Syslog.Log("MODULE: exception at Hook_Join in " + module.Name, true);
                        Core.HandleException(fail);
                    }
                }
            }
        }
示例#6
0
 /// <summary>
 /// Disable module
 /// </summary>
 public void Exit()
 {
     Syslog.Log("Unloading module: " + Name);
     try
     {
         if (!Hook_OnUnload())
         {
             Syslog.Log("Unable to unload module, forcefully removed from memory: " + Name, true);
         }
         IsWorking            = false;
         RestartOnModuleCrash = false;
         if (thread != null)
         {
             Syslog.Log("Terminating module: " + Name, true);
             if (RestartOnModuleCrash)
             {
                 RestartOnModuleCrash = false;
             }
             Core.ThreadManager.KillThread(thread);
         }
         ExtensionHandler.UnregisterMod(this);
     }
     catch (Exception fail)
     {
         Core.HandleException(fail);
     }
 }
示例#7
0
 /// <summary>
 /// Connect mysql
 /// </summary>
 public override void Connect()
 {
     lock (DatabaseLock)
     {
         if (IsConnected)
         {
             return;
         }
         try
         {
             Connection = new MySqlConnection("Server=" + Configuration.MySQL.MysqlHost + ";" +
                                              "Database=" + Configuration.MySQL.Mysqldb + ";" +
                                              "User ID=" + Configuration.MySQL.MysqlUser + ";" +
                                              "Password="******";" +
                                              "port=" + Configuration.MySQL.MysqlPort + ";" +
                                              "CharSet=utf8;" +
                                              "Pooling=false");
             Connection.Open();
             connected = true;
         }
         catch (MySqlException ex)
         {
             Syslog.Log("MySQL: Unable to connect to server: " + ex, true);
             connected = false;
         }
     }
 }
示例#8
0
 private static void dm(string text, string target, libirc.Defs.Priority priority = libirc.Defs.Priority.Normal, bool is_act = false)
 {
     // get a target instance
     if (target.StartsWith("#"))
     {
         // it's a channel
         Channel ch = Core.GetChannel(target);
         if (ch == null)
         {
             Syslog.Log("Not sending message to unknown channel: " + target);
             return;
         }
         if (!ch.PrimaryInstance.IsConnected)
         {
             Syslog.Log("Not sending message using disconnected instance: " + ch.PrimaryInstance.Nick + " target: " + target + " message: " + text);
             return;
         }
         if (!ch.Suppress)
         {
             Self(text, ch);
             if (!is_act)
             {
                 ch.PrimaryInstance.Network.Message(text, target, priority);
             }
             else
             {
                 ch.PrimaryInstance.Network.Act(text, target, priority);
             }
         }
     }
     else
     {
         lock (Instance.TargetBuffer)
         {
             if (Instance.TargetBuffer.ContainsKey(target))
             {
                 if (is_act)
                 {
                     Instance.TargetBuffer[target].Network.Act(text, target, priority);
                 }
                 else
                 {
                     Instance.TargetBuffer[target].Network.Message(text, target, priority);
                 }
                 return;
             }
         }
         if (!is_act)
         {
             Instance.PrimaryInstance.Network.Message(text, target, priority);
         }
         else
         {
             Instance.PrimaryInstance.Network.Act(text, target, priority);
         }
     }
 }
示例#9
0
 /// <summary>
 /// Recover a file that had a backup and remove it
 /// </summary>
 /// <param name="FileName">Name of file</param>
 /// <returns></returns>
 public static bool BackupRecovery(string FileName)
 {
     if (File.Exists(Configuration.TempName(FileName)))
     {
         string temp = Path.GetTempFileName();
         File.Copy(Configuration.TempName(FileName), temp, true);
         Syslog.Log("Unfinished transaction from " + FileName + "~ was stored as " + temp);
         return(true);
     }
     return(false);
 }
示例#10
0
 public static void DumpMods()
 {
     if (!Directory.Exists(Configuration.Paths.ModulesPath))
     {
         Syslog.Log("There is no modules folder");
         return;
     }
     foreach (string dll in Directory.GetFiles(Configuration.Paths.ModulesPath, "*.dll"))
     {
         DumpAllModulesInLibrary(dll);
     }
 }
示例#11
0
        /// <summary>
        /// Copy the selected file to a temporary file name
        ///
        /// this function is used mostly for restore of corrupted data,
        /// so that the corrupted version of file can be stored in /tmp
        /// for debugging
        /// </summary>
        /// <param name='file'>
        /// File
        /// </param>
        public static bool GetTempFileName(string file)
        {
            string path = Path.GetTempFileName();

            File.Copy(file, path, true);
            if (File.Exists(path))
            {
                Syslog.Log("Unfinished transaction from " + file + " was stored as " + path);
                return(true);
            }
            return(false);
        }
示例#12
0
        private static void CreateModule(Type moduleType)
        {
            var module = (Module)Activator.CreateInstance(moduleType);

            if (!module.Construct())
            {
                Syslog.Log("Invalid module", true);
                module.Exit();
                return;
            }

            InitialiseMod(module);
        }
示例#13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="wmib.Channel"/> class.
        /// </summary>
        /// <param name='name'>
        /// Name.
        /// </param>
        public Channel(string name)
        {
            Name        = name;
            Suppress    = false;
            SystemUsers = new Security(this);
            LoadConfig();
            if (DefaultInstance == "any")
            {
                PrimaryInstance = Instance.GetInstance();
                // we need to save the instance so that next time bot reconnect to bouncer it uses the same instance
                DefaultInstance = PrimaryInstance.Nick;
                SaveConfig();
            }
            else
            {
                if (!Instance.Instances.ContainsKey(DefaultInstance))
                {
                    Syslog.WarningLog("There is no instance " + DefaultInstance + " reassigning channel " + this.Name +
                                      " to a different instance");
                    this.PrimaryInstance = Instance.GetInstance();
                    Syslog.Log("Reassigned to " + this.PrimaryInstance.Nick);
                }
                else
                {
                    PrimaryInstance = Instance.Instances[DefaultInstance];
                }
            }
            if (!Directory.Exists(Configuration.WebPages.HtmlPath))
            {
                Directory.CreateDirectory(Configuration.WebPages.HtmlPath);
            }

            foreach (Module module in ExtensionHandler.ExtensionList)
            {
                try
                {
                    if (module.IsWorking)
                    {
                        Channel self = this;
                        module.Hook_Channel(self);
                    }
                }
                catch (Exception fail)
                {
                    Syslog.Log("MODULE: exception at Hook_Channel in " + module.Name, true);
                    Core.HandleException(fail);
                }
            }
        }
示例#14
0
        /// <summary>
        /// Called when someone post a message to server
        /// </summary>
        /// <param name="channel">Channel</param>
        /// <param name="nick">Nick</param>
        /// <param name="host">Host</param>
        /// <param name="message">Message</param>
        /// <returns></returns>
        public static bool GetMessage(string channel, string nick, string host, string message)
        {
            LastText = nick + " chan: " + channel + " " + message;
            Channel channel_ = GetChannel(channel);

            if (channel_ != null)
            {
                if (!channel_.IgnoreUnknown || channel_.SystemUsers.IsKnown(nick, host))
                {
                    if (message.StartsWith(Configuration.System.CommandPrefix))
                    {
                        Commands.PartChannel(channel_, nick, host, message);
                    }
                    Commands.Processing.ProcessCommands(channel_, nick, "", host, message);
                }
                foreach (Module _Module in ExtensionHandler.ExtensionList)
                {
                    try
                    {
                        if (_Module.IsWorking)
                        {
                            _Module.Hook_PRIV(channel_, new libirc.UserInfo(nick, "", host), message);
                        }
                    }
                    catch (Exception f)
                    {
                        Syslog.Log("MODULE: exception at Hook_PRIV in " + _Module.Name, true);
                        HandleException(f);
                    }
                }
                if (channel_.RespondMessage)
                {
                    if (message.StartsWith(Configuration.IRC.NickName + ":"))
                    {
                        DateTime time = channel_.TimeOfLastMsg;
                        if (DateTime.Now >= time.AddSeconds(channel_.RespondWait))
                        {
                            IRC.DeliverMessage(messages.Localize("hi", channel_.Language, new List <string> {
                                nick
                            }), channel_.Name);
                            channel_.TimeOfLastMsg = DateTime.Now;
                        }
                    }
                }
            }

            return(false);
        }
示例#15
0
 /// <summary>
 /// Load a global list
 /// </summary>
 public static void Global()
 {
     if (!File.Exists(Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + "admins"))
     {
         // Create db
         Syslog.Log("Creating user file for admins");
         File.WriteAllText(Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + "admins", "");
     }
     GlobalLoad();
     Syslog.DebugLog("Registering fs watcher for global user list");
     fs.Path                = Variables.ConfigurationDirectory;
     fs.Changed            += GlobalChanged;
     fs.Created            += GlobalChanged;
     fs.Filter              = "admins";
     fs.EnableRaisingEvents = true;
 }
示例#16
0
 private void Exec()
 {
     try
     {
         Load();
         Syslog.Log("Module terminated: " + Name);
         IsWorking = false;
         Core.ThreadManager.UnregisterThread(thread);
     }
     catch (ThreadAbortException)
     {
         Syslog.Log("Module terminated: " + Name);
         Core.ThreadManager.UnregisterThread(thread);
         return;
     }
     catch (Exception f)
     {
         Core.HandleException(f);
         IsWorking = false;
         Syslog.Log("Module crashed: " + Name, true);
     }
     while (Core.IsRunning && RestartOnModuleCrash)
     {
         try
         {
             Warning   = true;
             IsWorking = true;
             Syslog.Log("Restarting the module: " + Name, true);
             Load();
             Syslog.Log("Module terminated: " + Name);
             IsWorking = false;
         }
         catch (ThreadAbortException)
         {
             Syslog.Log("Module terminated: " + Name);
             Core.ThreadManager.UnregisterThread(thread);
             return;
         }
         catch (Exception f)
         {
             Core.HandleException(f);
             IsWorking = false;
             Syslog.Log("Module crashed: " + Name, true);
         }
     }
 }
示例#17
0
 /// <summary>
 /// Exception handler
 /// </summary>
 /// <param name="ex">Exception pointer</param>
 /// <param name="module">Channel name</param>
 public static void HandleException(Exception ex, string module)
 {
     try
     {
         if (!string.IsNullOrEmpty(Configuration.System.DebugChan))
         {
             IRC.DeliverMessage("DEBUG Exception in module " + module + ": " + ex.Message + " st: "
                                + ex.StackTrace.Replace(Environment.NewLine, ""), Configuration.System.DebugChan);
         }
         Syslog.Log("DEBUG Exception in module " + module + ": " + ex.Message + ex.Source + ex.StackTrace, true);
     }
     catch (Exception fail)
     {
         // exception happened while we tried to handle another one, ignore that (probably issue with logging)
         Console.WriteLine(fail.ToString());
     }
 }
示例#18
0
        public static void ConnectAllIrcInstances()
        {
            foreach (Instance instance in Instances.Values)
            {
                // connect it to irc
                instance.Init();
            }
            // now we need to wait for all instances to connect
            Syslog.Log("Waiting for all instances to connect to irc");
            bool IsOk = false;

            while (!IsOk)
            {
                foreach (Instance instance in Instances.Values)
                {
                    if (!instance.IsWorking)
                    {
                        Syslog.DebugLog("Waiting for " + instance.Nick, 2);
                        Thread.Sleep(1000);
                        IsOk = false;
                        break;
                    }
                    Syslog.DebugLog("Connected to " + instance.Nick, 6);
                    IsOk = true;
                }
            }

            // wait for all instances to join their channels
            Syslog.Log("Waiting for all instances to join channels");
            IsOk = false;
            while (!IsOk)
            {
                foreach (Instance instance in Instances.Values)
                {
                    if (!instance.ChannelsJoined)
                    {
                        Thread.Sleep(100);
                        IsOk = false;
                        break;
                    }
                    IsOk = true;
                }
            }
            Syslog.Log("All instances joined their channels");
        }
示例#19
0
        /// <summary>
        /// Load a binary module
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static bool LoadAllModulesInLibrary(string path)
        {
            try
            {
                if (File.Exists(path))
                {
                    Assembly library = Assembly.LoadFrom(path);

                    if (library == null)
                    {
                        Syslog.WarningLog("Unable to load " + path + " because the file can't be read");
                        return(false);
                    }

                    Type[] types = library.GetTypes();

                    foreach (Type type in types)
                    {
                        if (type.IsSubclassOf(typeof(Module)))
                        {
                            // For recall later
                            _moduleTypes.Add(type);

                            if (ShouldCreateModuleOnStartup(type))
                            {
                                CreateModule(type);
                            }
                            else
                            {
                                Syslog.DebugLog("Not registering module (type " + type.Name + ") because it's not in a module list");
                            }
                        }
                    }

                    return(true);
                }

                Syslog.Log("Unable to load " + path + " because the file can't be read", true);
            }
            catch (Exception fail)
            {
                Core.HandleException(fail);
            }
            return(false);
        }
示例#20
0
 public static void IrcReloadChannelConf(Channel Channel)
 {
     foreach (Module module in ExtensionHandler.ExtensionList)
     {
         try
         {
             if (module.IsWorking)
             {
                 module.Hook_ReloadConfig(Channel);
             }
         }
         catch (Exception fail)
         {
             Syslog.Log("MODULE: exception at Hook_Reload in " + module.Name);
             Core.HandleException(fail, module.Name);
         }
     }
 }
示例#21
0
 public static void IrcKick(Channel Channel, libirc.UserInfo Source, string Target)
 {
     foreach (Module module in ExtensionHandler.ExtensionList)
     {
         if (!module.IsWorking)
         {
             continue;
         }
         try
         {
             module.Hook_Kick(Channel, Source, Target);
         }
         catch (Exception fail)
         {
             Syslog.Log("MODULE: exception at Hook_Kick in " + module.Name, true);
             Core.HandleException(fail, module.Name);
         }
     }
 }
示例#22
0
        protected override void __evt_QUIT(NetworkGenericDataEventArgs args)
        {
            foreach (Module module in ExtensionHandler.ExtensionList)
            {
                if (!module.IsWorking)
                {
                    continue;
                }

                try
                {
                    module.Hook_Quit(args.SourceInfo, args.Message);
                }
                catch (Exception fail)
                {
                    Syslog.Log("MODULE: exception at Hook_Quit in " + module.Name, true);
                    Core.HandleException(fail);
                }
            }
            foreach (Channel channel in instance.ChannelList)
            {
                if (channel.ContainsUser(args.SourceInfo.Nick))
                {
                    foreach (Module module in ExtensionHandler.ExtensionList)
                    {
                        if (!module.IsWorking)
                        {
                            continue;
                        }

                        try
                        {
                            module.Hook_ChannelQuit(channel, args.SourceInfo, args.Message);
                        }
                        catch (Exception fail)
                        {
                            Syslog.Log("MODULE: exception at Hook_ChannelQuit in " + module.Name, true);
                            Core.HandleException(fail);
                        }
                    }
                }
            }
        }
示例#23
0
 /// <summary>
 /// Add
 /// </summary>
 /// <param name="level">Level</param>
 /// <param name="user">Regex</param>
 /// <returns></returns>
 public bool AddUser(string level, string user)
 {
     if (!misc.IsValidRegex(user))
     {
         Syslog.Log("Unable to create user " + user + " because the regex is invalid", true);
         IRC.DeliverMessage("Unable to add user because this regex is not valid", this._Channel);
         return(false);
     }
     foreach (SystemUser u in Users)
     {
         if (u.Name == user)
         {
             IRC.DeliverMessage("Unable to add user because this user is already in a list", this._Channel);
             return(false);
         }
     }
     Users.Add(new SystemUser(level, user));
     Save();
     return(true);
 }
示例#24
0
        private bool connectBnc()
        {
            this.Send("CONTROL: CREATE " + this.Server);
            this.ChannelsJoined = false;
            int  retries    = 0;
            bool Connected_ = false;

            while (!Connected_)
            {
                Thread.Sleep(2000);
                this.Send("CONTROL: STATUS");
                string response = streamReader.ReadLine();
                this.TrafficLog(response, true);
                if (response.StartsWith(":"))
                {
                    // we received network data here
                    lock (Backlog)
                        Backlog.Add(response);
                    continue;
                }
                if (response == "CONTROL: TRUE")
                {
                    Syslog.Log("Bouncer connected to " + Server + " on: " + this.IRCNetwork.Nickname);
                    return(true);
                }
                else
                {
                    retries++;
                    if (retries > 6)
                    {
                        Syslog.WarningLog("Bouncer failed to connect to the network within 10 seconds, disconnecting it: "
                                          + this.IRCNetwork.Nickname);
                        this.Send("CONTROL: DISCONNECT");
                        return(false);
                    }
                    Syslog.Log("Still waiting for bouncer (trying " + retries.ToString() + "/6) on " + this.IRCNetwork.Nickname + " " + response);
                }
            }
            return(true);
        }
示例#25
0
 /// <summary>
 /// Thread
 /// </summary>
 public static void Exec()
 {
     try
     {
         Syslog.Log("KERNEL: loaded writer thread");
         while (IsRunning)
         {
             try
             {
                 Thread.Sleep(2000);
                 if (Data.Count > 0)
                 {
                     WriteData();
                 }
             }
             catch (ThreadAbortException)
             {
                 IsRunning = false;
                 break;
             }
             catch (Exception fail)
             {
                 Core.HandleException(fail);
             }
         }
         if (Data.Count > 0)
         {
             Syslog.Log("KERNEL: Writer thread was requested to stop, but there is still some data to write");
             WriteData();
             Syslog.Log("KERNEL: No remaining data, stopping writer thread");
         }
         Syslog.Log("KERNEL: No remaining data, stopping writer thread");
     }
     catch (Exception fail)
     {
         Core.HandleException(fail);
         Syslog.Log("KERNEL: The writer thread was terminated", true);
     }
 }
示例#26
0
        public static bool DumpAllModulesInLibrary(string path)
        {
            try
            {
                if (File.Exists(path))
                {
                    Assembly library = Assembly.LoadFrom(path);
                    if (library == null)
                    {
                        Syslog.WarningLog("Unable to load " + path + " because the file can't be read");
                        return(false);
                    }
                    Type[] types = library.GetTypes();
                    string list  = "";
                    foreach (Type type in types)
                    {
                        if (type.IsSubclassOf(typeof(Module)))
                        {
                            list += type.Name + ",";
                        }
                    }
                    list = list.TrimEnd(',');
                    if (list == "")
                    {
                        list = "No modules found in this file";
                    }
                    Console.WriteLine("In " + path + ": " + list);
                    return(true);
                }

                Syslog.Log("Unable to load " + path + " because the file can't be read", true);
            }
            catch (Exception fail)
            {
                Core.HandleException(fail);
            }
            return(false);
        }
示例#27
0
 /// <summary>
 /// Recover a file that was previously stored
 /// </summary>
 /// <param name="name"></param>
 /// <param name="ch"></param>
 /// <returns></returns>
 public static bool RecoverFile(string name, string ch = "unknown object")
 {
     try
     {
         if (File.Exists(Configuration.TempName(name)))
         {
             if (Core.GetTempFileName(name))
             {
                 Syslog.Log("Restoring unfinished transaction of " + ch + " for db_" + name);
                 File.Copy(Configuration.TempName(name), name, true);
                 return(true);
             }
             Syslog.Log("Unfinished transaction could not be restored! DB of " + name + " is probably broken", true);
         }
         return(false);
     }
     catch (Exception b)
     {
         HandleException(b);
         Syslog.Log("Unfinished transaction could not be restored! DB of " + name + " is now broken");
         return(false);
     }
 }
示例#28
0
 protected override void __evt_NICK(NetworkNICKEventArgs args)
 {
     foreach (Channel channel in instance.ChannelList)
     {
         if (channel.ContainsUser(args.OldNick))
         {
             foreach (Module extension_ in ExtensionHandler.ExtensionList)
             {
                 try
                 {
                     if (extension_.IsWorking)
                     {
                         extension_.Hook_Nick(channel, args.SourceInfo, args.OldNick, args.NewNick);
                     }
                 }
                 catch (Exception fail)
                 {
                     Syslog.Log("MODULE: exception in Hook_Nick in " + extension_.Name, true);
                     Core.HandleException(fail);
                 }
             }
         }
     }
 }
示例#29
0
 private static void Restart(CommandParams parameters)
 {
     IRC.DeliverMessage("System is shutting down, requested by " + parameters.User.Nick + " from " + parameters.SourceChannel.Name, Configuration.System.DebugChan, libirc.Defs.Priority.High);
     Syslog.Log("System is shutting down, requested by " + parameters.User.Nick + " from " + parameters.SourceChannel.Name);
     Core.Kill();
 }
示例#30
0
        private static void Configure(CommandParams parameters)
        {
            if (string.IsNullOrEmpty(parameters.Parameters))
            {
                return;
            }

            if (parameters.Parameters.Contains("=") && !parameters.Parameters.EndsWith("="))
            {
                string name  = parameters.Parameters.Substring(0, parameters.Parameters.IndexOf("="));
                string value = parameters.Parameters.Substring(parameters.Parameters.IndexOf("=") + 1);
                bool   _temp_a;
                switch (name)
                {
                case "ignore-unknown":
                    if (bool.TryParse(value, out _temp_a))
                    {
                        parameters.SourceChannel.IgnoreUnknown = _temp_a;
                        IRC.DeliverMessage(messages.Localize("configuresave", parameters.SourceChannel.Language,
                                                             new List <string> {
                            value, name
                        }), parameters.SourceChannel);
                        parameters.SourceChannel.SaveConfig();
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("configure-va", parameters.SourceChannel.Language, new List <string> {
                        name, value
                    }), parameters.SourceChannel);
                    return;

                case "respond-wait":
                    int _temp_b;
                    if (int.TryParse(value, out _temp_b))
                    {
                        if (_temp_b > 1 && _temp_b < 364000)
                        {
                            parameters.SourceChannel.RespondWait = _temp_b;
                            IRC.DeliverMessage(messages.Localize("configuresave", parameters.SourceChannel.Language, new List <string> {
                                value, name
                            }), parameters.SourceChannel);
                            parameters.SourceChannel.SaveConfig();
                            return;
                        }
                    }
                    IRC.DeliverMessage(messages.Localize("configure-va", parameters.SourceChannel.Language, new List <string> {
                        name, value
                    }), parameters.SourceChannel);
                    return;

                case "respond-message":
                    if (bool.TryParse(value, out _temp_a))
                    {
                        parameters.SourceChannel.RespondMessage = _temp_a;
                        IRC.DeliverMessage(messages.Localize("configuresave", parameters.SourceChannel.Language, new List <string> {
                            value, name
                        }), parameters.SourceChannel);
                        parameters.SourceChannel.SaveConfig();
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("configure-va", parameters.SourceChannel.Language, new List <string> {
                        name, value
                    }), parameters.SourceChannel);
                    return;

                case "suppress-warnings":
                    if (bool.TryParse(value, out _temp_a))
                    {
                        parameters.SourceChannel.SuppressWarnings = _temp_a;
                        IRC.DeliverMessage(messages.Localize("configuresave", parameters.SourceChannel.Language, new List <string> {
                            value, name
                        }), parameters.SourceChannel);
                        parameters.SourceChannel.SaveConfig();
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("configure-va", parameters.SourceChannel.Language, new List <string> {
                        name, value
                    }), parameters.SourceChannel);
                    return;
                }
                bool exist = false;
                foreach (Module curr in ExtensionHandler.ExtensionList)
                {
                    try
                    {
                        if (curr.IsWorking && curr.Hook_SetConfig(parameters.SourceChannel, parameters.User, name, value))
                        {
                            exist = true;
                        }
                    }
                    catch (Exception fail)
                    {
                        Syslog.Log("Error on Hook_SetConfig module " + curr.Name);
                        Core.HandleException(fail, curr.Name);
                    }
                }
                if (!parameters.SourceChannel.SuppressWarnings && !exist)
                {
                    IRC.DeliverMessage(messages.Localize("configure-wrong", parameters.SourceChannel.Language), parameters.SourceChannel);
                }
                return;
            }
            if (!parameters.Parameters.Contains(" "))
            {
                switch (parameters.Parameters)
                {
                case "ignore-unknown":
                    IRC.DeliverMessage(messages.Localize("Responses-Conf", parameters.SourceChannel.Language, new List <string> {
                        parameters.Parameters, parameters.SourceChannel.IgnoreUnknown.ToString()
                    }), parameters.SourceChannel);
                    return;

                case "respond-message":
                    IRC.DeliverMessage(messages.Localize("Responses-Conf", parameters.SourceChannel.Language, new List <string> {
                        parameters.Parameters, parameters.SourceChannel.RespondMessage.ToString()
                    }), parameters.SourceChannel);
                    return;

                case "suppress-warnings":
                    IRC.DeliverMessage(messages.Localize("Responses-Conf", parameters.SourceChannel.Language, new List <string> {
                        parameters.Parameters, parameters.SourceChannel.SuppressWarnings.ToString()
                    }), parameters.SourceChannel);
                    return;
                }
                bool exist = false;
                foreach (Module curr in ExtensionHandler.ExtensionList)
                {
                    try
                    {
                        if (curr.IsWorking && curr.Hook_GetConfig(parameters.SourceChannel, parameters.User, parameters.Parameters))
                        {
                            exist = true;
                        }
                    }
                    catch (Exception fail)
                    {
                        Syslog.Log("Error on Hook_GetConfig module " + curr.Name);
                        Core.HandleException(fail);
                    }
                }
                if (exist)
                {
                    return;
                }
            }
            if (!parameters.SourceChannel.SuppressWarnings)
            {
                IRC.DeliverMessage(messages.Localize("configure-wrong", parameters.SourceChannel.Language), parameters.SourceChannel);
            }
        }