Exemplo n.º 1
0
        } // SendFWFeature

        private string MakeFWentry(string strChallengePhrase, string strCallsign, string strPassword)
        {
            //
            // Make a callsign/tactical address entry for the ;FW command.  If requested, include the password hascode.
            //
            string strFW = strCallsign;

            if (!string.IsNullOrEmpty(strChallengePhrase) & !string.IsNullOrEmpty(strPassword))
            {
                uint intResult = WinlinkAuth.ChallengedPassword(strChallengePhrase, strPassword);
                strFW += "|" + intResult.ToString("0000000000").Substring(2, 8);
            }

            return(strFW);
        }
Exemplo n.º 2
0
        } // GetPendingOutboundMessages

        private void ProtocolCommands(string strText, bool blnCrLf)
        {
            // Interprets the protocol commands as they are received...

            Globals.queChannelDisplay.Enqueue("X" + strText);
            string strCommand = strText.ToUpper();

            if (strCommand.StartsWith(";PM:"))
            {
                // Ignore preview-message commands
                return;
            }

            var switchExpr = ProtocolState;

            switch (switchExpr)
            {
            case EProtocolStates.Connected:
            {
                if (string.IsNullOrEmpty(Globals.strConnectedGridSquare))         // test for one
                {
                    IsGridSquare(strCommand);
                }

                if (strCommand.StartsWith("[") & strText.EndsWith("]"))
                {
                    ParseInboundSID(strText);
                }
                else if (strText.EndsWith(">"))
                {
                    ProtocolStateChange(EProtocolStates.Accepted);
                    SendFWFeature();
                    Send(strSID);
                    if (blnSecureLogin)
                    {
                        uint intResult;
                        // This is compatible with WL2K secure login and generates the same ;PR: reply as AirMail
                        intResult      = WinlinkAuth.ChallengedPassword(strChallengePhrase, Globals.SecureLoginPassword);
                        strSecureReply = ";PR: " + intResult.ToString("0000000000").Substring(2, 8);
                        Send(strSecureReply);
                    }

                    if (blnIFlag)
                    {
                        Send("; " + stcChannel.RemoteCallsign + " DE " + Globals.SiteCallsign + " (" + Globals.SiteGridSquare + ") QTC " + aryOutboundMessages.Count.ToString() + "...");
                    }
                    objB2Protocol = new ProtocolB2(this, ref stcChannel, ref aryOutboundMessages);
                }
                else if (strCommand.StartsWith(";PQ: "))         // Check for secure login challenge phrase
                {
                    strChallengePhrase = strCommand.Substring(4).Trim();
                    uint temp = 0;
                    if (!UInt32.TryParse(strChallengePhrase, out temp))
                    {
                        Globals.queChannelDisplay.Enqueue("R*** Non numeric challange phrase - ending connection");
                        Disconnect();
                    }
                    else
                    {
                        blnSecureLogin = true;
                    }
                }

                break;
            }

            case EProtocolStates.Accepted:
            {
                objB2Protocol.ChannelInput(strText);
                break;
            }
            }
        } // ProtocolCommands