Beispiel #1
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                _bbs.Write("~l1~c1SysOp~c2:~c7");
                string command = _bbs.Input(true, false, false);
                if (command.Length == 1)
                {
                    switch (command.Substring(0, 1).ToUpper())
                    {
                    case "H":
                        _bbs.SendFileForTermType("sysop_help", true);
                        break;

                    case "Q":
                        quitflag = true;
                        break;

                    default:
                        _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                        break;
                    }
                }
                else
                {
                    if (command.Length >= 2)
                    {
                        switch (command.Substring(0, 2).ToUpper())
                        {
                        case "LG":     //List Access Groups
                            CMD_ListGroups();
                            break;

                        case "AG":     //Add Access Group
                            CMD_ListGroups();
                            break;

                        case "EG":     //Edit Access Group
                            CMD_ListGroups();
                            break;

                        case "RG":     //Remove Access Group
                            CMD_ListGroups();
                            break;

                        default:
                            _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                            break;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                _bbs.WriteLine("~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7R~c1ead~c2, ~c7Q~c1uit");
                _bbs.Write("~c1News~c2: ~c7:");
                string command = _bbs.Input(true, false, false);
                switch (command.ToUpper()[0])
                {
                case 'B':
                    break;

                case 'U':
                    break;

                case 'G':
                    break;

                case 'P':
                    break;

                case 'Q':
                    quitflag = true;
                    break;
                }
            }
        }
Beispiel #3
0
        public void AddLine(int userid)
        {
            _bbs.currentArea = "Graffiti Wall, entering graffiti";
            _bbs.Write("~l1~c1~d0Enter your graffiti.  Please try to keep it to one line.  MCI is permitted.~l1~c7:~c1");
            String s = _bbs.Input(true, false, false);

            _bbsDataCore.AddGraffiti(s, userid);
            _bbs.WriteLine("~l1Your message has been added.");
        }
Beispiel #4
0
 public void Prompt()
 {
     _quitFlag = false;
     while ((!_quitFlag) && _bbs.Connected)
     {
         //Show GFiles Prompt
         if (!_bbs.expertMode)
         {
             _bbs.WriteLine("~l1~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7Q~c1uit");
         }
         else
         {
             _bbs.WriteLine();
         }
         _bbs.Write("~c1GFiles~c2:~c7");
         string command = _bbs.Input(true, false, false);
         if (command.Length > 0)
         {
             if ("0123456789".Contains(command.Substring(0, 1)))
             {
                 //Select item.
                 AreaListRow selectedItem = _currentList.FirstOrDefault(p => p.ListId.ToString().Equals(command));
                 if (selectedItem != null)
                 {
                     if (selectedItem.RowType == AreaListRowType.Area)
                     {
                         CmdAreaChange(selectedItem.Id);
                     }
                     else
                     {
                         //Show this file
                         CmdRead(selectedItem.Id);
                     }
                 }
             }
             else
             {
                 HandleCommand(command);
             }
         }
     }
 }
Beispiel #5
0
        private bool GetUsername()
        {
            bool result = false;

            //Prompt for username
            validinput = false;
            tries      = 0;

            while (!validinput && (tries < 5))
            {
                _bbs.WriteLine("~l2~c1Enter a username to use on this system");
                _bbs.Write("~c1Username~c2:~c7");
                Username = _bbs.Input(true, false, false);
                //Validate username. No dupes (case-insensitive)
                if (Utils.CheckForSQL(Username))
                {
                    _bbs.WriteLine("~s1~c2You're a real f*****g asshole.  Beat it.");
                    validinput = false;
                    tries      = 99;
                }
                else
                {
                    if (_bbsDataCore.ValidNewUsername(Username))
                    {
                        validinput = true;
                    }
                    else
                    {
                        _bbs.WriteLine("~l1~c2Invalid or duplicate username.");
                        tries++;
                    }
                }
            }
            result = validinput;
            return(result);
        }
Beispiel #6
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                if (!_bbs.expertMode)
                {
                    _bbs.WriteLine("~l1~c7? ~c1Menu, ~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7Q~c1uit");
                }
                else
                {
                    _bbs.WriteLine();
                }
                if (CurrentUDBase > -1)
                {
                    _bbs.Write("~c1UDBases~c2:~c7");
                }
                else
                {
                    _bbs.Write("~c1UDBases~c2:~c7");
                }
                string command = _bbs.Input(true, false, false);
                if (command.Length > 0)
                {
                    if ("0123456789".Contains(command.Substring(0, 1)))
                    {
                        if (CurrentUDBase == -1)
                        {
                            //Select item.
                            IdAndKeys selectedItem = Current_Area_List.FirstOrDefault(p => p.Keys["listid"].Equals(command));
                            if (selectedItem != null)
                            {
                                if (selectedItem.Keys["type"] == "area")
                                {
                                    _bbs.WriteLine("~l1~c7Changing to Area: " + selectedItem.Keys["title"] + "~p1");
                                    ChangeToArea(selectedItem.Id);
                                }
                                else
                                {
                                    _bbs.WriteLine("~l1~c7Changing to UDBase: " + selectedItem.Keys["title"] + "~p1");
                                    ChangeToUDBase(selectedItem.Id);
                                }
                            }
                        }
                        else
                        {
                            //We're in a udbase \
                            //CMD_DetailsByFileId(int.Parse(command));
                        }
                    }
                    else
                    {
                        switch (command.ToUpper()[0])
                        {
                        case 'H':
                            if (CurrentUDBase == -1)
                            {
                                _bbs.SendFileForTermType("udarea_help", true);
                            }
                            else
                            {
                                _bbs.SendFileForTermType("udbase_help", true);
                            }
                            break;

                        case '?':
                            if (CurrentUDBase == -1)
                            {
                                _bbs.SendFileForTermType("udarea_menu", true);
                            }
                            else
                            {
                                _bbs.SendFileForTermType("udbase_menu", true);
                            }
                            break;

                        case 'L':
                            CMD_List();
                            break;

                        case '/':
                            if (CurrentUDBase > -1)
                            {
                                CurrentUDBase = -1;
                                CMD_List();
                            }
                            else
                            {
                                if (Current_Area > -1)
                                {
                                    CurrentUDBase = -1;
                                    IdAndKeys mba = _bbsDataCore.UDBase_ParentArea(Current_Area);
                                    _bbs.WriteLine("~l1~c7Changing to Area: " + mba.Keys["title"] + "~p1");
                                    ChangeToArea(mba.Id);
                                }
                                else
                                {
                                    _bbs.WriteLine("~l1~d2Already at top level.~d0");
                                }
                            }
                            break;

                        case 'U':
                            if (CurrentUDBase == -1)
                            {
                                _bbs.WriteLine("~l1~d1Select a UD base.~d0");
                            }
                            else
                            {
                                CMD_Upload();
                            }
                            break;

                        case 'Q':
                            quitflag = true;
                            break;

                        case 'D':
                            //Download
                            if (command.Length == 1)
                            {
                                _bbs.Write("~c1File Number~c2:~c7");
                                int i = _bbs.InputNumber(3);
                                if (i > -1)
                                {
                                    CMD_Download(i.ToString());
                                }
                            }
                            else
                            {
                                CMD_Download(command.Substring(1, command.Length - 1));
                            }
                            break;
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                _bbs.WriteLine("~l1" + Path);
                if (!_bbs.expertMode)
                {
                    _bbs.WriteLine("~c7? ~c1Menu, ~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7Q~c1uit");
                }
                else
                {
                    _bbs.WriteLine();
                }
                if (CurrentMessageBase > -1)
                {
                    _bbs.Write("~c1Bases~c2:~c7");
                }
                else
                {
                    _bbs.Write("~c1Bases~c2:~c7");
                }
                string command = _bbs.Input(true, false, false);
                if (command.Length > 0)
                {
                    if ("0123456789".Contains(command.Substring(0, 1)))
                    {
                        if (CurrentMessageBase == -1)
                        {
                            //Select item.
                            IdAndKeys selectedItem = Current_Area_List.FirstOrDefault(p => p.Keys["listid"].Equals(command));
                            if (selectedItem != null)
                            {
                                if (selectedItem.Keys["type"] == "area")
                                {
                                    _bbs.WriteLine("~l1~c7Changing to Area: " + selectedItem.Keys["title"] + "~p1");
                                    ChangeToArea(selectedItem.Id);
                                }
                                else
                                {
                                    _bbs.WriteLine("~l1~c7Changing to Message Base: " + selectedItem.Keys["title"] + "~p1");
                                    ChangeToMessageBase(selectedItem.Id);
                                }
                            }
                        }
                        else
                        {
                            //We're in a messagebase \
                            CMD_ReadThreadByListId(int.Parse(command));
                        }
                    }
                    else
                    {
                        switch (command.ToUpper()[0])
                        {
                        case 'H':
                            if (CurrentMessageBase == -1)
                            {
                                _bbs.SendFileForTermType("messagearea_help", true);
                            }
                            else
                            {
                                _bbs.SendFileForTermType("messagebase_help", true);
                            }
                            break;

                        case '?':
                            if (CurrentMessageBase == -1)
                            {
                                _bbs.SendFileForTermType("messagearea_menu", true);
                            }
                            else
                            {
                                _bbs.SendFileForTermType("messagebase_menu", true);
                            }
                            break;

                        case 'L':
                            CMD_List();
                            break;

                        case '/':
                            if (CurrentMessageBase > -1)
                            {
                                CurrentMessageBase = -1;
                                RecalculatePath();
                                CMD_List();
                            }
                            else
                            {
                                if (Current_Area > -1)
                                {
                                    CurrentMessageBase = -1;
                                    IdAndKeys mba = _bbsDataCore.MessageBase_ParentArea(Current_Area);
                                    _bbs.WriteLine("~l1~c7Changing to Area: " + mba.Keys["title"] + "~p1");
                                    ChangeToArea(mba.Id);
                                }
                                else
                                {
                                    _bbs.WriteLine("~l1~d2Already at top level.~d0");
                                }
                            }
                            break;

                        case 'P':
                            if (CurrentMessageBase == -1)
                            {
                                _bbs.WriteLine("~l1~d1Select a message base.~d0");
                            }
                            else
                            {
                                CMD_Post();
                            }
                            break;

                        case 'Q':
                            quitflag = true;
                            break;

                        case 'R':
                            // "Unread" means the message id does not appear in the
                            // R = Read next unread message
                            // RA = Read all messages in all threads
                            // RA# = Read all messages in specified thread
                            // R# = Read unread messages in specified thread
                            // R#,# = Read specified message in specified thread
                            // RN = Read unread messages in all threads with unread messages
                            if (CurrentMessageBase == -1)
                            {
                                _bbs.WriteLine("~l1~d1Select a message base.~d0");
                            }
                            else
                            {
                                if (command.Length > 1)
                                {
                                    if (command.ToUpper()[1] == 'A')
                                    {
                                        //RA, RA#
                                    }
                                    else
                                    {
                                        if (command.ToUpper()[1] == 'N')
                                        {
                                            //RN,RN#
                                        }
                                        else
                                        {
                                            if ("1234567890".Contains(command.ToUpper()[1]))
                                            {
                                                //R#
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    CMD_ReadNextUnread();
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
Beispiel #8
0
        public void MainPrompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                if (!_bbs.overrideDoNotDisturb)
                {
                    _bbs.doNotDisturb = false;
                }
                //Show Main Prompt
                if (!_bbs.expertMode)
                {
                    if (_bbs.terminalType.Columns() == 40)
                    {
                        _bbs.WriteLine("~l2~c7? ~c1Menu~c2,~c7H~c1elp~c2,~c7B~c1ases~c2,~c7G~c1Files~c2,~c7P~c1Files~c2,~c7Q~c1uit");
                    }
                    else
                    {
                        _bbs.WriteLine("~l2~c7? ~c1Help~c2, ~c7B~c1ases~c2, ~c7U~c1DBases~c2, ~c7G~c1Files~c2, ~c7P~c1Files~c2, ~c7Q~c1uit");
                    }
                }
                else
                {
                    _bbs.WriteLine();
                }
                _bbs.currentArea = "Main Prompt";
                _bbs.Write("~c1Main~c2:~c7");
                string command = _bbs.Input(true, false, false, true, 10);
                if (command.Length > 0)
                {
                    switch (command.ToString().ToUpper())
                    {
                    case "?":
                        _bbs.SendFileForTermType("MainMenu", true);
                        break;

                    case "B":
                        MessageBases mb = new MessageBases(_bbs, _bbsDataCore);
                        mb.Prompt();
                        break;

                    case "DND":
                        CMD_DND();
                        break;

                    case "F":
                        CMD_Feedback();
                        break;

                    case "G":
                        try
                        {
                            GFiles gf = new GFiles(_bbs, _bbsDataCore);
                            gf.Prompt();
                        }
                        catch (Exception e)
                        {
                            LoggingAPI.LogEntry("Exception in Main.MainPrompt: " + e);
                            //Log this?
                        }
                        break;

                    case "P":
                        try
                        {
                            PFiles pf = new PFiles(_bbs, _bbsDataCore);
                            pf.Prompt();
                        }
                        catch (Exception e)
                        {
                            LoggingAPI.LogEntry("Exception in Main.MainPrompt: " + e);
                            //Log this?
                        }
                        break;

                    case "Q!":
                        quitflag = true;
                        break;

                    case "Q":
                        CMD_Feedback();
                        _bbs.Write("~l1~c1Leave one-liner?");
                        if (_bbs.YesNo(true, true))
                        {
                            _bbs.GraffitiWall.AddLine(_bbs.CurrentUser.Id);
                        }
                        quitflag = true;
                        break;

                    case "SY":
                        //If the current user has any groups that would allow sysop access
                        if (_bbs.currentUser.UserAccessGroups.Any(p => p.AccessGroup.AllowSysOp))
                        {
                            _bbs.Write("~l1~c1Password:~c7");
                            string sy = _bbs.Input(true, true, false);
                            if (sy.ToUpper() == _bbsConfig.SysOpMenuPassword.ToUpper())
                            {
                                _bbs.sysopIdentified = true;
                                SysOp sys = new SysOp(_bbs, _bbsDataCore);
                                sys.Prompt();
                            }
                            else
                            {
                                _bbs.WriteLine("~l1~d2Invalid password.  F**k off.~d0~c1");
                            }
                        }
                        else
                        {
                            _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                        }
                        break;

                    case "UD":
                    case "U":
                        UDBases ud = new UDBases(_bbs, _bbsDataCore);
                        ud.Prompt();
                        //break;
                        //UDBases ud = new UDBases(bbs);
                        //ud.Prompt();
                        break;


                    case "WHO":
                        CMD_Who();
                        break;

                    case "X":
                        _bbs.expertMode = !_bbs.expertMode;
                        _bbs.WriteLine("~l1~c1Expert mode is ~c7" + (_bbs.expertMode ? "ON" : "OFF") + "~c1.");
                        break;

                    default:
                        //Test multi-part commands
                        if (command.Length > 3 && command.Substring(0, 3).ToUpper() == "OLM")
                        {
                            CMD_OLM(command);
                        }
                        else if (command.Length > 3 && command.Substring(0, 3).ToUpper() == "SLM")
                        {
                            CMD_SLM(command);
                        }
                        else
                        {
                            if (_bbs.SysopIdentified)
                            {
                                CMD_SysOp(command);
                            }
                            else
                            {
                                _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                            }
                        }
                        break;
                    }
                }
                if ((!quitflag) && (!_bbs.doNotDisturb))
                {
                    //Show any received OLMs
                    _bbs.FlushOLMQueue();
                }
            }
        }
Beispiel #9
0
        public User LogIn()
        {
            _bbs.currentArea = "Logging In";
            User u = null;

            try
            {
                string uname    = "";
                string pass     = "";
                int    bigtries = 0;
                while (_bbs.Connected && bigtries < 3)
                {
                    int tries = 0;
                    while (_bbs.Connected && tries < 3)
                    {
                        _bbs.Write("~l2~c1Username~c2: ~c7");
                        uname = _bbs.Input(true, false, false, true, 30);
                        if (uname.ToUpper() == "NEW")
                        {
                            break;
                        }
                        else
                        {
                            _bbs.Write("~l1~c1Password~c2: ~c7");
                            pass = _bbs.Input(true, true, false, false, 30);
                            if ((uname == "") || (pass == ""))
                            {
                                tries++;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    if (tries < 3)
                    {
                        if (uname.ToUpper() == "NEW")
                        {
                            NewUser nu = new NewUser(_bbs, _bbsDataCore);
                            if (nu.Application())
                            {
                                u = _bbsDataCore.Login(nu.Username, nu.Password);
                            }
                            break;
                        }
                        else
                        {
                            //Username and pass have been filled in
                            u = _bbsDataCore.Login(uname, pass);
                            if (u != null)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        u = null;
                        break;
                    }
                    if (u == null)
                    {
                        bigtries++;
                    }
                }
                if (u != null)
                {
                    _bbs.WriteLine("~l1~c1Welcome, ~c7" + u.Username.ToUpper() + "~c1.~l4");
                }
                else
                {
                    BuggerOff();
                }
            }
            catch (Exception e)
            {
                LoggingAPI.LogEntry("Exception in Login.LogIn: " + e.Message);
            }
            return(u);
        }