VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmPrivate 
   Caption         =   "Private"
   ClientHeight    =   3360
   ClientLeft      =   6780
   ClientTop       =   4365
   ClientWidth     =   4560
   LinkTopic       =   "Form1"
   ScaleHeight     =   3360
   ScaleWidth      =   4560
   Begin VB.TextBox txtMessage 
      Height          =   765
      Left            =   0
      MultiLine       =   -1  'True
      TabIndex        =   2
      Top             =   2640
      Width           =   3135
   End
   Begin VB.CommandButton cmdSend 
      Caption         =   "Send"
      Height          =   375
      Left            =   3120
      TabIndex        =   1
      Top             =   3000
      Width           =   1455
   End
   Begin VB.ComboBox cboMode 
      Height          =   315
      Left            =   3120
      TabIndex        =   0
      Text            =   "Channel Msg"
      Top             =   2640
      Width           =   1455
   End
   Begin RichTextLib.RichTextBox rtbView 
      Height          =   2655
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   4575
      _ExtentX        =   8070
      _ExtentY        =   4683
      _Version        =   393217
      Enabled         =   -1  'True
      ScrollBars      =   3
      TextRTF         =   $"frmPrivate.frx":0000
   End
   Begin VB.Menu File 
      Caption         =   "F&ile"
      Begin VB.Menu mnuClear 
         Caption         =   "Clear Channel Text"
      End
      Begin VB.Menu mnuLog 
         Caption         =   "Log Channel Text"
      End
      Begin VB.Menu sep1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuClose 
         Caption         =   "Close"
      End
   End
   Begin VB.Menu mnuOption 
      Caption         =   "O&ptions"
      Index           =   0
      Begin VB.Menu mnuEncryption 
         Caption         =   "Encryption"
         Index           =   1
         Begin VB.Menu mnuSetKey 
            Caption         =   "Set Key"
         End
         Begin VB.Menu sep2 
            Caption         =   "-"
         End
         Begin VB.Menu mnuEncrypt 
            Caption         =   "Encrypt"
         End
         Begin VB.Menu mnuDecrypt 
            Caption         =   "Decrypt"
         End
      End
   End
   Begin VB.Menu Internal 
      Caption         =   "Internal"
      Visible         =   0   'False
      Begin VB.Menu mnuCopy 
         Caption         =   "Copy"
      End
   End
End
Attribute VB_Name = "frmPrivate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim theNickname As String
Public key As String


Private Sub cmdSend_Click()
    Dim Color As Long
    If Me.mnuEncrypt.Checked = True Then
        If key = "" Then key = InputBox("Please enter Encryption Key", "Enter Key")
        txtMessage.text = EnCrypt(txtMessage.text, key)
    End If

    Select Case cboMode.text

    Case "Private Msg"

        frmmain.SendData "PRIVMSG " + Me.Caption + " :" + txtMessage.text
        If frmmain.chkGreyOut.value = 1 Then Color = &H8000000F Else Color = vbBlack
        DisplayMessageInPrivate txtMessage.text, frmmain.txtNick, Color
        txtMessage.text = ""
        txtMessage.SelStart = 0
        SendKeys (vbBack) 'set cursor back to original spot

    Case "Join"
        JoinChannel (txtMessage.text) 'Join a channel

    Case "Command"
        frmmain.SendData (txtMessage.text) 'Sends the text to the IRC server
        txtMessage.text = ""
        txtMessage.SetFocus

    Case Else
        MsgBox "Please select mode" 'If none of those modes are selected

    End Select


End Sub


Private Sub Form_Activate()
'Set focus the the message textbox
txtMessage.SetFocus
End Sub

Private Sub Form_Load()
    
    'Add options to cmbomode
    With cboMode
        .text = "Private Msg"
        .AddItem "Private Msg"
        .AddItem "Join"
        .AddItem "Command"
    End With
    
End Sub

Private Sub Form_Resize()
'resize contols on form
ResizeForm Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
' frmmain.SendData ("PART " + Me.Caption) DONT HTINK THIS IS IMPLIMANTED

'Remove from dictionary
frmmain.allPrivates.Remove (Me.Caption)

End Sub

Private Sub mnuClear_Click()
    'remove all text from rtbView
    rtbView.text = ""
End Sub

Private Sub mnuClose_Click()
    'Unload form
    Unload Me
End Sub

Private Sub mnuCopy_Click()
    'Pu data on clipboard
    Clipboard.SetText rtbView.SelText
End Sub

Private Sub mnuDecrypt_Click()
    Me.mnuDecrypt.Checked = Not Me.mnuDecrypt.Checked
End Sub

Private Sub mnuEncrypt_Click()
    Me.mnuEncrypt.Checked = Not Me.mnuEncrypt.Checked
End Sub

Private Sub mnuLog_Click()
    rtbView.SaveFile (App.Path + "\logs\" + Me.Tag + " " + " " + CStr(Int(Rnd() * 100)) + ".rtf")
End Sub

Private Sub mnuSetKey_Click()
    key = InputBox("Please enter Encryption Key", "Enter Key")
End Sub

Private Sub rtbView_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then PopupMenu Me.Internal
End Sub

Private Sub txtMessage_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        cmdSend_Click
    End If
End Sub