예제 #1
0
                    public override bool ModLoad()
                    {
                        DataDriver = MyBase.DataDriver;
                        //Load the DB into memory
                        try
                        {
                            if (DataDriver.DBExists("floodserv.db"))
                            {
                                FloodDB = DataDriver.LoadDB("floodserv.db");
                                if (FloodDB == null)
                                {
                                    throw (new Exception("NickServ: Unknown DB Load Error"));
                        //									return false;
                                }
                            }
                            else
                            {
                                MakeDB();
                            }
                            BlackLight.Services.Timers.Timer FSSaveTimer;
                            FSSaveTimer = new BlackLight.Services.Timers.Timer(new TimeSpan(0), new TimeSpan(0, 5, 0), - 1, new Timers.TimedCallBack(TimerSaveDB));
                            MyBase.timerController.addTimer(FSSaveTimer);
                            MyBase.Core.events.OnFinishedNetBurst += new BlackLight.Services.Core.ServicesCore.ServicesEvents.OnFinishedNetBurstEventHandler(this.OnConnect);
                        }
                        catch (Exception ex)
                        {
                            MyBase.Core.SendLogMessage("FloodServ", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace);
                            //show("FloodServ Error " + ex.Message + " " + ex.StackTrace);
                            return false;
                        }

                        mFloodServ = new LocalClient("FloodServ",new MessageCallBack(FloodServCallBack) ,MyBase.Core);
                        ModuleList tModules = new ModuleList();
                        tModules.Add(MyBase.ModuleManage.Modules["Help"]);
                        MyService = new FloodServService(mFloodServ, MyBase.Core, FloodDB, tModules);
                        mFloodServ.host = "services.com";
                        mFloodServ.modes = "S";
                        mFloodServ.realname = "FloodServ";
                        mFloodServ.time = BlackLight.Services.Converters.Time.GetTS(DateTime.Now);
                        mFloodServ.username = "******";
                        MyBase.Core.events.onClientConnect += new BlackLight.Services.Core.ServicesCore.ServicesEvents.onClientConnectEventHandler(MyService.OnClientConnect);

                        mFloodServ.Cmds.Add("HELP", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSHelp));

                        mFloodServ.Cmds.Add("NPWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNPWatch));

                        mFloodServ.Cmds.Add("NSWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNSWatch));

                        mFloodServ.Cmds.Add("REGWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSRegWatch));

                        mFloodServ.Cmds.Add("NPSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNPScan));

                        mFloodServ.Cmds.Add("NSSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNSScan));

                        mFloodServ.Cmds.Add("REGSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSRegScan));

                        MyBase.Core.LocalClients.AddClient(mFloodServ);
                        return true;
                    }
예제 #2
0
                    public override bool ModLoad()
                    {
                        DataDriver = MyBase.DataDriver;
                        //Load the DB into memory
                        try
                        {
                            if (DataDriver.DBExists("nickserv.db"))
                            {
                                NickDB = DataDriver.LoadDB("nickserv.db");
                                if (NickDB == null)
                                {
                                    throw (new Exception("NickServ: Unknown DB Load Error"));
                        //									return false;
                                }
                            }
                            else
                            {
                                MakeDB();
                            }
                            BlackLight.Services.Timers.Timer NSSaveTimer;
                            NSSaveTimer = new BlackLight.Services.Timers.Timer(new TimeSpan(0), new TimeSpan(0, 5, 0), - 1, new Timers.TimedCallBack( TimerSaveDB));
                            MyBase.timerController.addTimer(NSSaveTimer);
                            MyBase.Core.events.OnFinishedNetBurst += new BlackLight.Services.Core.ServicesCore.ServicesEvents.OnFinishedNetBurstEventHandler(this.OnConnect);
                        }
                        catch (Exception ex)
                        {
                            MyBase.Core.SendLogMessage("Nick", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace);
                            //show("NickServ Error " + ex.Message + " " + ex.StackTrace);
                            return false;
                        }

                        mNickServ = new LocalClient("NickServ", new MessageCallBack(NickServCallBack), MyBase.Core);
                        ModuleList tModules = new ModuleList();
                        tModules.Add(MyBase.ModuleManage.Modules["Help"]);
                        MyService = new NickServService(mNickServ, MyBase.Core, NickDB, tModules);
                        mNickServ.host = "services.com";
                        mNickServ.modes = "S";
                        mNickServ.realname = "NickyServ";
                        mNickServ.time = BlackLight.Services.Converters.Time.GetTS(DateTime.Now);
                        mNickServ.username = "******";

                        // Client
                        mNickServ.Cmds.Add("REGISTER", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSRegister));
                        // Client
                        mNickServ.Cmds.Add("IDENTIFY", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSIdentify));
                        // Client
                        mNickServ.Cmds.Add("GROUP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGroup));
                        // Client
                        mNickServ.Cmds.Add("GLIST", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGList));
                        // Client/Oper
                        mNickServ.Cmds.Add("DROP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSDrop));
                        // Client
                        mNickServ.Cmds.Add("GHOST", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGhost));

                        mNickServ.Cmds.Add("HELP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSHelp));
                        // Client/Open - (oper gets more)
                        // bNickServ.Cmds.Add("INFO", AddressOf MyService.NullFunction)
                        // Client
                        // bNickServ.Cmds.Add("LOGOUT", AddressOf MyService.NullFunction)
                        // Client
                        // bNickServ.Cmds.Add("RECOVER", AddressOf MyService.NullFunction)
                        // Client
                        // bNickServ.Cmds.Add("RELEASE", AddressOf MyService.NullFunction)
                        // Client
                        //  bNickServ.Cmds.Add("AJOIN", AddressOf MyService.NullFunction)
                        // Client / Oper
                        //  bNickServ.Cmds.Add("ACCESS", AddressOf MyService.NullFunction)
                        // Client / Oper
                        //  bNickServ.Cmds.Add("ALIST", AddressOf MyService.NullFunction)
                        // Client
                        //  bNickServ.Cmds.Add("STATUS", AddressOf MyService.NullFunction)
                        // Client/Oper
                        // bNickServ.Cmds.Add("SET", AddressOf MyService.NullFunction)

                        // Oper
                        //  bNickServ.Cmds.Add("FIND", AddressOf MyService.NullFunction)
                        // Oper
                        // bNickServ.Cmds.Add("FORBID", AddressOf MyService.NullFunction)
                        // Oper
                        // bNickServ.Cmds.Add("UNFORBID", AddressOf MyService.NullFunction)
                        // Oper
                        //  bNickServ.Cmds.Add("SUSPEND", AddressOf MyService.NullFunction)
                        // Oper
                        // bNickServ.Cmds.Add("UNSUSPEND", AddressOf MyService.NullFunction)
                        // Oper - de oper/dc
                        // bNickServ.Cmds.Add("NOOP", AddressOf MyService.NullFunction)
                        // Oper
                        //bNickServ.Cmds.Add("UNIDENTIFY", AddressOf MyService.NullFunction)

                        MyBase.Core.LocalClients.AddClient(mNickServ);
                        return true;
                    }