home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Proper_MSN47068172002.psc / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2002-01-08  |  22.3 KB  |  686 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  4. Begin VB.Form Form1 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Galaxy Messenger"
  7.    ClientHeight    =   5595
  8.    ClientLeft      =   150
  9.    ClientTop       =   720
  10.    ClientWidth     =   4395
  11.    BeginProperty Font 
  12.       Name            =   "Arial"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    Icon            =   "frmMain.frx":0000
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    ScaleHeight     =   5595
  24.    ScaleWidth      =   4395
  25.    StartUpPosition =   3  'Windows Default
  26.    Begin VB.TextBox Text3 
  27.       Height          =   975
  28.       Left            =   4560
  29.       MultiLine       =   -1  'True
  30.       ScrollBars      =   3  'Both
  31.       TabIndex        =   9
  32.       Top             =   4440
  33.       Width           =   4335
  34.    End
  35.    Begin MSComctlLib.ImageList ImageList1 
  36.       Left            =   5040
  37.       Top             =   4920
  38.       _ExtentX        =   1005
  39.       _ExtentY        =   1005
  40.       BackColor       =   -2147483643
  41.       ImageWidth      =   16
  42.       ImageHeight     =   16
  43.       MaskColor       =   12632256
  44.       _Version        =   393216
  45.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  46.          NumListImages   =   3
  47.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  48.             Picture         =   "frmMain.frx":08CA
  49.             Key             =   ""
  50.          EndProperty
  51.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  52.             Picture         =   "frmMain.frx":11A4
  53.             Key             =   ""
  54.          EndProperty
  55.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  56.             Picture         =   "frmMain.frx":1A7E
  57.             Key             =   ""
  58.          EndProperty
  59.       EndProperty
  60.    End
  61.    Begin VB.TextBox Text2 
  62.       Height          =   1335
  63.       Left            =   4560
  64.       MultiLine       =   -1  'True
  65.       ScrollBars      =   3  'Both
  66.       TabIndex        =   8
  67.       Top             =   3000
  68.       Width           =   4335
  69.    End
  70.    Begin VB.TextBox Text1 
  71.       Height          =   2415
  72.       Left            =   4560
  73.       MultiLine       =   -1  'True
  74.       ScrollBars      =   3  'Both
  75.       TabIndex        =   6
  76.       Top             =   120
  77.       Width           =   4335
  78.    End
  79.    Begin VB.Timer Timer2 
  80.       Enabled         =   0   'False
  81.       Interval        =   500
  82.       Left            =   8520
  83.       Top             =   5040
  84.    End
  85.    Begin VB.Timer Timer1 
  86.       Interval        =   100
  87.       Left            =   8520
  88.       Top             =   4560
  89.    End
  90.    Begin VB.PictureBox Picture1 
  91.       BackColor       =   &H00FFFFFF&
  92.       Height          =   975
  93.       Left            =   0
  94.       ScaleHeight     =   915
  95.       ScaleWidth      =   4335
  96.       TabIndex        =   5
  97.       Top             =   4560
  98.       Width           =   4395
  99.       Begin VB.Image picLogo 
  100.          Appearance      =   0  'Flat
  101.          Height          =   615
  102.          Left            =   120
  103.          Picture         =   "frmMain.frx":2358
  104.          Stretch         =   -1  'True
  105.          Top             =   140
  106.          Width           =   780
  107.       End
  108.       Begin VB.Image picLogo2 
  109.          Height          =   495
  110.          Left            =   1000
  111.          Picture         =   "frmMain.frx":3DCE
  112.          Top             =   190
  113.          Width           =   3105
  114.       End
  115.    End
  116.    Begin VB.Frame Frame1 
  117.       Appearance      =   0  'Flat
  118.       BackColor       =   &H80000005&
  119.       BorderStyle     =   0  'None
  120.       BeginProperty Font 
  121.          Name            =   "MS Sans Serif"
  122.          Size            =   8.25
  123.          Charset         =   0
  124.          Weight          =   400
  125.          Underline       =   0   'False
  126.          Italic          =   0   'False
  127.          Strikethrough   =   0   'False
  128.       EndProperty
  129.       ForeColor       =   &H80000008&
  130.       Height          =   3615
  131.       Left            =   120
  132.       TabIndex        =   1
  133.       Top             =   600
  134.       Width           =   4150
  135.       Begin MSWinsockLib.Winsock Winsock1 
  136.          Left            =   3600
  137.          Top             =   3000
  138.          _ExtentX        =   741
  139.          _ExtentY        =   741
  140.          _Version        =   393216
  141.       End
  142.       Begin VB.Label Label3 
  143.          Alignment       =   2  'Center
  144.          BackStyle       =   0  'Transparent
  145.          Caption         =   "To sign in with a different name click here"
  146.          BeginProperty Font 
  147.             Name            =   "Arial"
  148.             Size            =   8.25
  149.             Charset         =   0
  150.             Weight          =   700
  151.             Underline       =   -1  'True
  152.             Italic          =   0   'False
  153.             Strikethrough   =   0   'False
  154.          EndProperty
  155.          Height          =   615
  156.          Left            =   960
  157.          TabIndex        =   4
  158.          Top             =   3000
  159.          Width           =   2295
  160.       End
  161.       Begin VB.Image Image1 
  162.          Appearance      =   0  'Flat
  163.          Height          =   495
  164.          Left            =   120
  165.          Picture         =   "frmMain.frx":8E80
  166.          Stretch         =   -1  'True
  167.          Top             =   240
  168.          Width           =   540
  169.       End
  170.       Begin VB.Label Label2 
  171.          BackStyle       =   0  'Transparent
  172.          Caption         =   "username@username.com"
  173.          BeginProperty Font 
  174.             Name            =   "Arial"
  175.             Size            =   8.25
  176.             Charset         =   0
  177.             Weight          =   400
  178.             Underline       =   -1  'True
  179.             Italic          =   0   'False
  180.             Strikethrough   =   0   'False
  181.          EndProperty
  182.          ForeColor       =   &H00C00000&
  183.          Height          =   255
  184.          Left            =   840
  185.          TabIndex        =   3
  186.          Top             =   480
  187.          Width           =   3255
  188.       End
  189.       Begin VB.Label Label1 
  190.          BackStyle       =   0  'Transparent
  191.          Caption         =   "You are not signed in"
  192.          BeginProperty Font 
  193.             Name            =   "Arial"
  194.             Size            =   8.25
  195.             Charset         =   0
  196.             Weight          =   700
  197.             Underline       =   0   'False
  198.             Italic          =   0   'False
  199.             Strikethrough   =   0   'False
  200.          EndProperty
  201.          Height          =   255
  202.          Left            =   840
  203.          TabIndex        =   2
  204.          Top             =   240
  205.          Width           =   3255
  206.       End
  207.       Begin VB.Shape Shape1 
  208.          BackColor       =   &H00E0E0E0&
  209.          BorderColor     =   &H00E0E0E0&
  210.          FillColor       =   &H00E0E0E0&
  211.          FillStyle       =   0  'Solid
  212.          Height          =   735
  213.          Left            =   0
  214.          Top             =   120
  215.          Width           =   4215
  216.       End
  217.    End
  218.    Begin MSComctlLib.TreeView TreeView1 
  219.       Height          =   4335
  220.       Left            =   0
  221.       TabIndex        =   0
  222.       Top             =   120
  223.       Width           =   4395
  224.       _ExtentX        =   7752
  225.       _ExtentY        =   7646
  226.       _Version        =   393217
  227.       Indentation     =   353
  228.       Style           =   7
  229.       ImageList       =   "ImageList1"
  230.       Appearance      =   1
  231.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  232.          Name            =   "Arial"
  233.          Size            =   8.25
  234.          Charset         =   0
  235.          Weight          =   400
  236.          Underline       =   0   'False
  237.          Italic          =   0   'False
  238.          Strikethrough   =   0   'False
  239.       EndProperty
  240.    End
  241.    Begin VB.Label Label4 
  242.       Caption         =   "ABOVE: USERLIST    - BELOW: ONLINE CONTACTS"
  243.       Height          =   255
  244.       Left            =   4560
  245.       TabIndex        =   7
  246.       Top             =   2640
  247.       Width           =   4335
  248.    End
  249.    Begin VB.Image cAni3 
  250.       Height          =   480
  251.       Left            =   6240
  252.       Picture         =   "frmMain.frx":974A
  253.       Top             =   1920
  254.       Width           =   480
  255.    End
  256.    Begin VB.Image cAni2 
  257.       Height          =   480
  258.       Left            =   6240
  259.       Picture         =   "frmMain.frx":A014
  260.       Top             =   1320
  261.       Width           =   480
  262.    End
  263.    Begin VB.Image cAni1 
  264.       Height          =   480
  265.       Left            =   6240
  266.       Picture         =   "frmMain.frx":A8DE
  267.       Top             =   720
  268.       Width           =   480
  269.    End
  270.    Begin VB.Image Ani3 
  271.       Height          =   855
  272.       Left            =   6960
  273.       Picture         =   "frmMain.frx":B1A8
  274.       Top             =   1920
  275.       Width           =   810
  276.    End
  277.    Begin VB.Image Ani2 
  278.       Height          =   615
  279.       Left            =   6960
  280.       Picture         =   "frmMain.frx":D66E
  281.       Top             =   1320
  282.       Width           =   690
  283.    End
  284.    Begin VB.Image Ani1 
  285.       Height          =   690
  286.       Left            =   6960
  287.       Picture         =   "frmMain.frx":ED1C
  288.       Top             =   720
  289.       Width           =   615
  290.    End
  291.    Begin VB.Menu File 
  292.       Caption         =   "&File"
  293.       Begin VB.Menu Signout 
  294.          Caption         =   "&Sign out"
  295.       End
  296.       Begin VB.Menu dash1 
  297.          Caption         =   "-"
  298.       End
  299.       Begin VB.Menu Exit 
  300.          Caption         =   "E&xit"
  301.       End
  302.    End
  303.    Begin VB.Menu Options 
  304.       Caption         =   "&Options"
  305.       Begin VB.Menu Prefs 
  306.          Caption         =   "&Prefrences"
  307.       End
  308.    End
  309.    Begin VB.Menu Help 
  310.       Caption         =   "&Help"
  311.       Begin VB.Menu About 
  312.          Caption         =   "&About"
  313.       End
  314.    End
  315. Attribute VB_Name = "Form1"
  316. Attribute VB_GlobalNameSpace = False
  317. Attribute VB_Creatable = False
  318. Attribute VB_PredeclaredId = True
  319. Attribute VB_Exposed = False
  320. Dim Animation As Integer
  321. Dim Animation2 As Integer
  322. Dim AnimationTimer As Integer
  323. Dim LastUsername As String
  324. Dim LastPassword As String
  325. Public UserName As String
  326. Dim Password As String
  327. Dim ConnectSection As Integer
  328. Dim RecList As Boolean
  329. Dim TotContacts As Integer
  330. Dim AtLoad As Boolean
  331. Dim iM(65535) As New Form4
  332. Dim IMnumber As Integer
  333. Dim RingUser As String
  334. Dim SwitchRequest As Boolean
  335. Public Sub StartConnect(UN As String, PW As String)
  336. LastUsername = UN
  337. LastPassword = PW
  338. UserName = UN
  339. Password = PW
  340. Label3.Visible = False
  341. Label2 = "Click here to cancel sign in"
  342. Label1 = "Attempting to connect.."
  343. Timer2.Enabled = True
  344. ConnectSection = 0
  345. Winsock1.Connect "64.4.13.58", 1863
  346. End Sub
  347. Private Sub About_Click()
  348. Form3.Show
  349. End Sub
  350. Private Sub Exit_Click()
  351. RemoveTrayIcon
  352. End Sub
  353. Private Sub Form_Load()
  354. If AtLoad = False Then SysTray.AddTrayIcon Form1.Icon, Form1, "Galaxy Messenger": AtLoad = True
  355. SwitchRequest = False
  356. Text1 = ""
  357. Text2 = ""
  358. Text3 = ""
  359. RecList = False
  360. LastUsername = GetSetting("Galaxy Messenger", "Login", "Username")
  361. LastPassword = GetSetting("Galaxy Messenger", "Login", "Password")
  362. If LastUsername = "" Then Label2 = "Click here to sign in"
  363. If Not LastUsername = "" Then Label2 = LastUsername
  364. End Sub
  365. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  366. If TrayEvent(X) = "LEFTUP" Then Form1.Show
  367. If TrayEvent(X) = "RIGHTUP" Then
  368. response$ = MsgBox("Are you sure you want to close Galaxy Messenger?" & vbCrLf & "All online conversations will be closed", vbQuestion + vbYesNo, "Galaxy Messenger")
  369. If response$ = vbYes Then SysTray.RemoveTrayIcon: End
  370. End If
  371. End Sub
  372. Private Sub Form_Unload(Cancel As Integer)
  373. Cancel = 1
  374. Form1.Hide
  375. End Sub
  376. Private Sub Label2_Click()
  377. If Label2 = "Click here to sign in" Then Label3_Click: Exit Sub
  378. If Label2 = "Click here to cancel sign in" Then
  379. Form_Load
  380. Winsock1.Close
  381. Label1 = "You are not signed in"
  382. Timer2.Enabled = False
  383. Image1.Picture = cAni1.Picture
  384. Label3.Visible = True
  385. Exit Sub
  386. End If
  387. StartConnect LastUsername, LastPassword
  388. End Sub
  389. 'ANIMATION SUBS
  390. Private Sub Label3_Click()
  391. Form2.Show
  392. End Sub
  393. Private Sub Prefs_Click()
  394. MsgBox "Sorry, there are no settings available yet", vbInformation, "Galaxy Messenger"
  395. End Sub
  396. Private Sub Signout_Click()
  397. Form_Load
  398. Winsock1.Close
  399. Label1 = "You are not signed in"
  400. Timer2.Enabled = False
  401. Image1.Picture = cAni1.Picture
  402. Label3.Visible = True
  403. TreeView1.Nodes.Clear
  404. Frame1.Visible = True
  405. End Sub
  406. Private Sub Timer1_Timer()
  407. AnimationTimer = AnimationTimer + 1
  408. Animation = Animation + 1
  409. If Animation = 0 Then picLogo.Picture = Ani1.Picture
  410. If Animation = 1 Then picLogo.Picture = Ani2.Picture
  411. If Animation = 2 Then picLogo.Picture = Ani3.Picture
  412. If Animation = 2 Then Animation = -1
  413. If AnimationTimer = 6 Then Timer1.Enabled = False
  414. End Sub
  415. Private Sub Timer2_Timer()
  416. Animation2 = Animation2 + 1
  417. If Animation2 = 0 Then Image1.Picture = cAni1.Picture
  418. If Animation2 = 1 Then Image1.Picture = cAni2.Picture
  419. If Animation2 = 2 Then Image1.Picture = cAni3.Picture
  420. If Animation2 = 2 Then Animation2 = -1
  421. End Sub
  422. Public Sub StartAni()
  423. AnimationTimer = 0
  424. Timer1.Enabled = True
  425. End Sub
  426. Private Sub TreeView1_DblClick()
  427. If TreeView1.SelectedItem.Index = 1 Or TreeView1.SelectedItem.Index = 2 Then Exit Sub
  428. RingUser = TreeView1.SelectedItem.Text
  429. IMnumber = IMnumber + 1
  430. Load iM(IMnumber)
  431. iM(IMnumber).ThisUser = TreeView1.SelectedItem.Text
  432. SwitchRequest = True
  433. SendData "XFR " & IMnumber & " SB"
  434. End Sub
  435. Private Sub Winsock1_Close()
  436. Form_Load
  437. Winsock1.Close
  438. Label1 = "You are not signed in"
  439. Timer2.Enabled = False
  440. Image1.Picture = cAni1.Picture
  441. Label3.Visible = True
  442. End Sub
  443. 'END ANIMATION SUBS
  444. Function RemoveString(Entire As String, Word As String, Replace As String) As String
  445.     Dim I As Integer
  446.     I = 1
  447.     Dim LeftPart
  448.     Do While True
  449.         I = InStr(1, Entire, Word)
  450.         If I = 0 Then
  451.             Exit Do
  452.         Else
  453.             LeftPart = Left(Entire, I - 1)
  454.             Entire = LeftPart & Replace & Right(Entire, Len(Entire) - Len(Word) - Len(LeftPart))
  455.         End If
  456.     Loop
  457.    RemoveString = Entire
  458.       
  459. End Function
  460. Private Sub Winsock1_Connect()
  461. If ConnectSection = 0 Then SendData "VER 0 MSNP5 MSNP4 CVRO": Label1 = "Preparing to log in.."
  462. If ConnectSection = 1 Then SendData "VER 3 MSNP5 MSNP4 CVRO": Label1 = "Logging on to server.."
  463. End Sub
  464. Public Sub SendData(Data As String, Optional NoCRLF As Boolean = False)
  465. If NoCRLF = False Then Winsock1.SendData Data & vbCrLf Else Winsock1.SendData Data
  466. Debug.Print ">> Outgoing Data: " & vbCrLf & Data
  467. StartAni
  468. End Sub
  469. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  470. Dim IncData As String
  471. Winsock1.GetData IncData
  472. Debug.Print "<< Incomming Data: " & vbCrLf & IncData
  473. StartAni
  474. 'STAGE 1
  475. If IncData = "VER 0 MSNP5 MSNP4" & vbCrLf Then SendData "INF 1": Label1 = Label1 & "."
  476. 'STAGE 2
  477. If IncData = "INF 1 MD5" & vbCrLf Then SendData "USR 2 MD5 I " & UserName: Label1 = Label1 & "."
  478. 'STAGE 3 (receives ip address of server and connects to it)
  479. If Mid(IncData, 1, 8) = "XFR 2 NS" Then
  480. X = InStrRev(IncData, ":")
  481. ConnectSection = 1
  482. Winsock1.Close
  483. Winsock1.Connect Mid(IncData, 10, X - 10), 1863
  484. End If
  485. 'STAGE 4
  486. If IncData = "VER 3 MSNP5 MSNP4" & vbCrLf Then SendData "INF  4"
  487. 'STAGE 5
  488. If IncData = "INF 4 MD5" & vbCrLf Then SendData "USR 5 MD5 I " & UserName
  489. 'STAGE 6
  490. If Mid(IncData, 1, 11) = "USR 5 MD5 S" Then
  491. Label1 = "Verifying username && password.."
  492. mt = InStrRev(IncData, "S")
  493. xt = Right(IncData, Len(IncData) - mt)
  494. xt = Left(xt, Len(xt) - 2)
  495. xt = Right(xt, Len(xt) - 1)
  496. SendData "USR 6 MD5 S " & MD5.MD5String(xt & Password)
  497. End If
  498. If IncData = "911 6" & vbCrLf Then
  499. MsgBox "Your username or password is invalid", vbInformation, "Error"
  500. Winsock1_Close
  501. End If
  502. 'STAGE 7
  503. If Mid(IncData, 1, 8) = "USR 6 OK" Then
  504. X = InStrRev(IncData, " ")
  505. uname$ = Mid(IncData, X + 1, Len(Mid(IncData, X)) - 2) & ", signing you in.."
  506. uname$ = RemoveString(uname$, "%20", " ")
  507. uname$ = RemoveString(uname$, "%25", "%")
  508. Label1 = "Welcome " & uname$
  509. SendData "CHG 7 NLN" 'sets online status and receives list of online contacts
  510. End If
  511. 'STAGE 8 (decoding the online contacts list)
  512. 'NTS: in future versions make this detect users status
  513. If InStr(1, IncData, "ILN 7") Then
  514. Text2 = Text2 & IncData
  515. End If
  516. If Mid(IncData, 1, 9) = "CHG 7 NLN" Then SendData "LST 8 RL" 'request contact list
  517. 'Useful notes: (* = deffinatly..  NST: Find out the others)
  518. 'BUSY = BSY *
  519. 'AWAY = AWY *
  520. 'BRB = BRB *
  521. 'PHONE = PHN
  522. 'IDLE = IDL *
  523. 'LUNCH = OUT
  524. 'ONLINE = NLN *
  525. 'OFFLINE = FLN *
  526. '\/\/\/\/\/\/\/\/\ STAGE 9 - FINAL STAGE (decoding the contact list) \/\/\/\/\/\/\/\/\
  527. '\/\/\/\/\/\/\/\/\ STAGE 9 - FINAL STAGE (decoding the contact list) \/\/\/\/\/\/\/\/\
  528. If RecList = True Then
  529. Text1 = Text1 & IncData
  530. If GetContactNumber(Text1, GetTotalContacts(Text1)) = GetTotalContacts(Text1) Then
  531. Frame1.Visible = False
  532. RecList = False
  533. TreeView1.Nodes.Add , , , "Online", 3
  534. TreeView1.Nodes.Add , , , "Offline", 2
  535. TreeView1.Nodes.Item(1).Bold = True
  536. TreeView1.Nodes.Item(2).Bold = True
  537. TreeView1.Nodes.Item(1).Expanded = True
  538. TreeView1.Nodes.Item(2).Expanded = True
  539. lists1 = lists1 + 1
  540. If Mid(Text1, lists1, 2) = vbCrLf Then
  541. list2 = Mid(Text1, 1, lists1 - 1)
  542. Text1 = Mid(Text1, lists1 + 2)
  543. lists1 = 0
  544. list3 = list3 + 1
  545. If Mid(list2, list3, 1) = " " Then spaces2 = spaces2 + 1
  546. Loop Until spaces2 = 6
  547. list3 = list3 + 1
  548. list2 = Mid(list2, list3)
  549. list4 = list4 + 1
  550. If Mid(list2, list4, 1) = " " Then spaces3 = spaces3 + 1
  551. Loop Until spaces3 = 1
  552. list4 = list4 - 1
  553. list2 = Mid(list2, 1, list4)
  554. 'ADD TO LIST
  555. 'NTS: list2 = email
  556. If Text2 = "" Then TreeView1.Nodes.Add 2, tvwChild, , list2, 1: GoTo 55
  557. If InStr(1, Text2.Text, list2) Then
  558. TreeView1.Nodes.Add 1, tvwChild, , list2, 1
  559. TreeView1.Nodes.Add 2, tvwChild, , list2, 1
  560. End If
  561. 55 ' Sleep 10
  562. End If
  563. list3 = 0
  564. list2 = ""
  565. list4 = 0
  566. spaces2 = 0
  567. Spaces = 0
  568. spaces3 = 0
  569. If Len(Text1) <= 8 Then GoTo 60
  570. Loop Until Text1 = ""
  571. End If
  572. Exit Sub
  573. End If
  574. 'END STAGE 9
  575. If InStr(1, IncData, "LST 8 RL") Then
  576. Label1 = "Receiving contact list.."
  577. Dim List1 As String
  578. RecList = True
  579. 'List1 = Mid(incData, InStr(1, incData, "LST 8 RL"))
  580. List1 = IncData
  581. Text1 = Text1 & List1
  582. xx% = 0
  583. I% = I% + 1
  584. If Mid(Text1, I%, 1) = " " Then xx% = xx% + 1
  585. Loop Until xx% = 5
  586. I% = I% + 1
  587. o% = o% + 1
  588. If Mid(Text1, I% + o%, 1) = " " Then Z% = Z% + 1
  589. Loop Until Z% = 1
  590. TotContacts = Mid(Text1, I%, o%)
  591. End If
  592. 'IF CONTACT COMES ONLINE
  593. If Mid(IncData, 1, 7) = "NLN NLN" Then
  594. nowonline = GetItem(IncData, 2)
  595. listsearchx = 2
  596. listsearchx = listsearchx + 1
  597. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  598. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowonline)
  599. TreeView1.Nodes.Remove (listsearchx)
  600. TreeView1.Nodes.Add 1, tvwChild, , nowonline, 1
  601. End If
  602. 'IF CONTACT GOES OFFLINE
  603. If Mid(IncData, 1, 3) = "FLN" Then
  604. nowoffline = GetItem(IncData, 1, , True)
  605. listsearchx = 2
  606. listsearchx = listsearchx + 1
  607. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  608. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowoffline)
  609. TreeView1.Nodes.Remove (listsearchx)
  610. TreeView1.Nodes.Add 2, tvwChild, , nowoffline, 1
  611. End If
  612. 'IF CONTACT GOES AWAY
  613. If Mid(IncData, 1, 7) = "NLN AWY" Then
  614. nowaway = GetItem(IncData, 2)
  615. listsearchx = 2
  616. listsearchx = listsearchx + 1
  617. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  618. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowaway)
  619. TreeView1.Nodes.Remove (listsearchx)
  620. TreeView1.Nodes.Add 1, tvwChild, , nowaway & " (Away)", 1
  621. End If
  622. 'IF CONTACT GOES BRB
  623. If Mid(IncData, 1, 7) = "NLN BRB" Then
  624. nowBRB = GetItem(IncData, 2)
  625. listsearchx = 2
  626. listsearchx = listsearchx + 1
  627. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  628. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowBRB)
  629. TreeView1.Nodes.Remove (listsearchx)
  630. TreeView1.Nodes.Add 1, tvwChild, , nowBRB & " (Be Right Back)", 1
  631. End If
  632. 'IF CONTACT GOES BUSY
  633. If Mid(IncData, 1, 7) = "NLN BSY" Then
  634. nowBusy = GetItem(IncData, 2)
  635. listsearchx = 2
  636. listsearchx = listsearchx + 1
  637. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  638. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowBusy)
  639. TreeView1.Nodes.Remove (listsearchx)
  640. TreeView1.Nodes.Add 1, tvwChild, , nowBusy & " (Busy)", 1
  641. End If
  642. 'IF CONTACT GOES ON THE PHONE
  643. If Mid(IncData, 1, 7) = "NLN PHN" Then
  644. nowPhone = GetItem(IncData, 2)
  645. listsearchx = 2
  646. listsearchx = listsearchx + 1
  647. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  648. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowPhone)
  649. TreeView1.Nodes.Remove (listsearchx)
  650. TreeView1.Nodes.Add 1, tvwChild, , nowPhone & " (On the Phone)", 1
  651. End If
  652. 'IF CONTACT GOES To Lunch
  653. If Mid(IncData, 1, 7) = "NLN LUN" Then
  654. nowLunch = GetItem(IncData, 2)
  655. listsearchx = 2
  656. listsearchx = listsearchx + 1
  657. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  658. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowLunch)
  659. TreeView1.Nodes.Remove (listsearchx)
  660. TreeView1.Nodes.Add 1, tvwChild, , nowLunch & " (Out to Lunch)", 1
  661. End If
  662. 'IF CONTACT GOES IDLE
  663. If Mid(IncData, 1, 7) = "NLN IDL" Then
  664. nowIdle = GetItem(IncData, 2)
  665. listsearchx = 2
  666. listsearchx = listsearchx + 1
  667. If listsearchx = TreeView1.Nodes.Count + 1 Then Exit Sub
  668. Loop Until InStr(1, TreeView1.Nodes.Item(listsearchx).Text, nowIdle)
  669. TreeView1.Nodes.Remove (listsearchx)
  670. TreeView1.Nodes.Add 1, tvwChild, , nowIdle & " (Idle)", 1
  671. End If
  672. 'WHEN USER REQUESTS TO START A CONVO
  673. If Mid(IncData, 1, 3) = "RNG" Then
  674. IMnumber = IMnumber + 1
  675. Load iM(IMnumber)
  676. iM(IMnumber).IncConnection GetItem(IncData, 1), GetItem(IncData, 2, ":"), GetItem(IncData, 4), GetItem(IncData, 5), GetItem(IncData, 6, , True), UserName
  677. End If
  678. 'WHEN LOCAL USER REQUEST TO START A CONVO IS ACCEPTED
  679. If Mid(IncData, 1, 3) = "XFR" Then
  680. If SwitchRequest = False Then Exit Sub
  681. SwitchRequest = False
  682. temp$ = GetItem(IncData, 1)
  683. iM(temp$).OutConnection iM(temp$).ThisUser, GetItem(IncData, 3, ":"), GetItem(IncData, 5, , True)
  684. End If
  685. End Sub
  686.