Пример #1
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.");
        }
Пример #2
0
        public bool Application()
        {
            var result = false;

            //var quitflag = false;
            try
            {
                //Show new user file
                _bbs.SendFileForTermType("NewUser", true);
                if (!GetUsername())
                {
                    return(false);
                }
                if (!GetPassword())
                {
                    return(false);
                }
                RealName = GetField("Real Name", "~l2~cbEnter your real name.", 0);
                if (RealName == null)
                {
                    return(false);
                }
                Email = GetField("Email", "~l2~cbEnter your email address.", 0);
                if (Email == null)
                {
                    return(false);
                }
                ComputerType = GetField("Computer", "~l2~cbEnter your computer model.", 0);
                if (ComputerType == null)
                {
                    return(false);
                }
                var user = _bbsDataCore.SaveNewUser(Username, Password, RealName, Email, ComputerType, _bbs._remoteAddress, "");
                if (user != null)
                {
                    _bbs.currentUser = user;
                }

                //New User feedback
                _bbs.Write("~l2~cbLeave an introduction message?");
                if (_bbs.YesNo(true, true))
                {
                    var lineEditor = new Line_Editor(_bbs);
                    if (lineEditor.Edit(null))
                    {
                        _bbsDataCore.NewFeedback("New User Feedback", lineEditor.GetMessage(), _bbs.currentUser.Id);
                    }
                }
                //And Done
                result = true;
            }
            catch (Exception e)
            {
                LoggingAPI.LogEntry("Exception in NewUser.Application: " + e.ToString());
            }
            return(result);
        }
Пример #3
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;
                        }
                    }
                }
            }
        }
Пример #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("~c1PFiles~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
                         CmdRun(selectedItem.Id);
                     }
                 }
             }
             else
             {
                 HandleCommand(command);
             }
         }
     }
 }
Пример #5
0
        public void DisplayNews()
        {
            List <NewsItem> newsItems = _bbsDataCore.GetNews(_bbs.currentUser.LastDisconnection);

            if (_bbs.FileExistsForTermType("news_top"))
            {
                _bbs.SendFileForTermType("news_top", true);
            }
            else
            {
                _bbs.Write("~l2~d4" + Utils.Center("NEWS", _bbs.terminalType.Columns()) + "~d0");
            }
            if ((newsItems != null) && (newsItems.Count > 0))
            {
                foreach (NewsItem newsItem in newsItems)
                {
                    _bbs.WriteLine("~l1");
                    _bbs.WriteLine("~c1Subject: ~c7" + newsItem.Subject);
                    _bbs.WriteLine("~c1Date: ~c7" + newsItem.Sent.ToString("yy-MM-dd HH:mm") + "~c2");
                    _bbs.Write(Utils.Repeat('\xc0', _bbs.terminalType.Columns()));
                    _bbs.Write("~c1");
                    string[] splitarray = { "~\xff~" };
                    string[] lines      = newsItem.Body.TrimEnd("~\xff".ToCharArray()).Split(splitarray, StringSplitOptions.None);
                    foreach (string s in lines)
                    {
                        if (s != "")
                        {
                            _bbs.WriteLine(s);
                        }
                    }
                    _bbs.Write("~c4");
                }
            }
            else
            {
                _bbs.WriteLine("~c1Nothing Found");
            }
            _bbs.WriteLine("~d4" + Utils.Center("END OF NEWS", _bbs.terminalType.Columns()) + "~d0");
        }
Пример #6
0
        public void ShowLastTenCalls()
        {
            _bbs.currentArea = "Viewing Last 10 Callers";
            var callList = _bbsDataCore.GetLastTenCalls();

            if ((callList != null) && (callList.Count > 0))
            {
                if (_bbs.FileExistsForTermType("last10_top"))
                {
                    _bbs.SendFileForTermType("last10_top", true);
                }
                else
                {
                    _bbs.Write("~s1~d5" + Utils.Center("LAST 10 CALLERS", _bbs.terminalType.Columns()) + "~d0");
                }
                foreach (var call in callList)
                {
                    _bbs.WriteLine("~cd" + call.Item1 + "~c1:~c7" + call.Item2);
                }

                _bbs.WriteLine("~d5" + Utils.SPC(_bbs.terminalType.Columns()) + "~d0");
            }
        }
Пример #7
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;
                        }
                    }
                }
            }
        }
Пример #8
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;
                        }
                    }
                }
            }
        }
Пример #9
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();
                }
            }
        }
Пример #10
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);
        }