Guest User

Untitled

a guest
Oct 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Begin VB.Form frmMain
  4.    BorderStyle     =   1  'Fixed Single
  5.   Caption         =   "Redirecthub"
  6.    ClientHeight    =   4095
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5490
  10.    Icon            =   "frmMain.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.   ScaleHeight     =   4095
  14.    ScaleWidth      =   5490
  15.    StartUpPosition =   2  'CenterScreen
  16.   Begin VB.CheckBox chkWebServe
  17.       Caption         =   "Enable WebServer [EXPERIMENTAL]"
  18.       Height          =   255
  19.       Left            =   120
  20.       TabIndex        =   29
  21.       Top             =   3840
  22.       Width           =   3495
  23.    End
  24.    Begin VB.Timer tmrUptimeSec
  25.       Interval        =   100
  26.       Left            =   3960
  27.       Top             =   3240
  28.    End
  29.    Begin VB.CheckBox chkUptime
  30.       Caption         =   "Show uptime on connect?"
  31.       Height          =   195
  32.       Left            =   120
  33.       TabIndex        =   23
  34.       Top             =   1320
  35.       Width           =   2175
  36.    End
  37.    Begin VB.TextBox txtArray
  38.       BackColor       =   &H00FFFFFF&
  39.       Height          =   645
  40.       Left            =   1320
  41.       MultiLine       =   -1  'True
  42.      ScrollBars      =   2  'Vertical
  43.      TabIndex        =   21
  44.       Text            =   "frmMain.frx":2CFA
  45.       Top             =   2640
  46.       Width           =   2535
  47.    End
  48.    Begin VB.TextBox txtPort
  49.       BeginProperty Font
  50.          Name            =   "Tahoma"
  51.          Size            =   8.25
  52.          Charset         =   0
  53.          Weight          =   400
  54.          Underline       =   0   'False
  55.         Italic          =   0   'False
  56.         Strikethrough   =   0   'False
  57.      EndProperty
  58.       Height          =   285
  59.       Left            =   1320
  60.       TabIndex        =   1
  61.       Text            =   "7778"
  62.       Top             =   1560
  63.       Width           =   615
  64.    End
  65.    Begin VB.CommandButton cmdToggle
  66.       BackColor       =   &H00B56B00&
  67.       Caption         =   "Start"
  68.       BeginProperty Font
  69.          Name            =   "Tahoma"
  70.          Size            =   8.25
  71.          Charset         =   0
  72.          Weight          =   400
  73.          Underline       =   0   'False
  74.         Italic          =   0   'False
  75.         Strikethrough   =   0   'False
  76.      EndProperty
  77.       Height          =   315
  78.       Left            =   3960
  79.       TabIndex        =   18
  80.       Top             =   1290
  81.       Width           =   1275
  82.    End
  83.    Begin VB.Timer tmrTick
  84.       Interval        =   1000
  85.       Left            =   4920
  86.       Top             =   2760
  87.    End
  88.    Begin MSWinsockLib.Winsock sckListen
  89.       Left            =   3960
  90.       Top             =   2760
  91.       _ExtentX        =   741
  92.       _ExtentY        =   741
  93.       _Version        =   393216
  94.    End
  95.    Begin MSWinsockLib.Winsock Socket
  96.       Index           =   0
  97.       Left            =   4440
  98.       Top             =   2760
  99.       _ExtentX        =   741
  100.       _ExtentY        =   741
  101.       _Version        =   393216
  102.    End
  103.    Begin VB.TextBox txtRdBotName
  104.       Height          =   285
  105.       Left            =   1320
  106.       TabIndex        =   12
  107.       Text            =   "LeGioN™"
  108.       Top             =   2280
  109.       Width           =   1335
  110.    End
  111.    Begin VB.TextBox txtNetwork
  112.       Height          =   285
  113.       Left            =   1320
  114.       TabIndex        =   11
  115.       Text            =   "ViCiouS LeGioN™"
  116.       Top             =   1920
  117.       Width           =   1335
  118.    End
  119.    Begin VB.CommandButton cmdLog
  120.       Caption         =   "Hub Traffic"
  121.       BeginProperty Font
  122.          Name            =   "Tahoma"
  123.          Size            =   8.25
  124.          Charset         =   0
  125.          Weight          =   400
  126.          Underline       =   0   'False
  127.         Italic          =   0   'False
  128.         Strikethrough   =   0   'False
  129.      EndProperty
  130.       Height          =   315
  131.       Left            =   3960
  132.       Style           =   1  'Graphical
  133.      TabIndex        =   10
  134.       Top             =   1680
  135.       Width           =   915
  136.    End
  137.    Begin VB.CommandButton cmdEditChat
  138.       Caption         =   "Edit..."
  139.       BeginProperty Font
  140.          Name            =   "Tahoma"
  141.          Size            =   8.25
  142.          Charset         =   0
  143.          Weight          =   400
  144.          Underline       =   0   'False
  145.         Italic          =   0   'False
  146.         Strikethrough   =   0   'False
  147.      EndProperty
  148.       Height          =   315
  149.       Left            =   2880
  150.       TabIndex        =   5
  151.       Top             =   120
  152.       Width           =   855
  153.    End
  154.    Begin VB.CheckBox chkChat
  155.       Caption         =   "Send chat message to clients"
  156.       BeginProperty Font
  157.          Name            =   "Tahoma"
  158.          Size            =   8.25
  159.          Charset         =   0
  160.          Weight          =   400
  161.          Underline       =   0   'False
  162.         Italic          =   0   'False
  163.         Strikethrough   =   0   'False
  164.      EndProperty
  165.       Height          =   255
  166.       Left            =   120
  167.       TabIndex        =   4
  168.       Top             =   120
  169.       Width           =   2415
  170.    End
  171.    Begin VB.CommandButton cmdEditPM
  172.       Caption         =   "Edit..."
  173.       BeginProperty Font
  174.          Name            =   "Tahoma"
  175.          Size            =   8.25
  176.          Charset         =   0
  177.          Weight          =   400
  178.          Underline       =   0   'False
  179.         Italic          =   0   'False
  180.         Strikethrough   =   0   'False
  181.      EndProperty
  182.       Height          =   315
  183.       Left            =   2880
  184.       TabIndex        =   3
  185.       Top             =   480
  186.       Width           =   855
  187.    End
  188.    Begin VB.CheckBox chkPM
  189.       Caption         =   "Send private message to clients"
  190.       BeginProperty Font
  191.          Name            =   "Tahoma"
  192.          Size            =   8.25
  193.          Charset         =   0
  194.          Weight          =   400
  195.          Underline       =   0   'False
  196.         Italic          =   0   'False
  197.         Strikethrough   =   0   'False
  198.      EndProperty
  199.       Height          =   255
  200.       Left            =   120
  201.       TabIndex        =   2
  202.       Top             =   480
  203.       Width           =   2655
  204.    End
  205.    Begin VB.Label lblUptime
  206.       AutoSize        =   -1  'True
  207.      BackStyle       =   0  'Transparent
  208.      Caption         =   "Uptime:"
  209.       ForeColor       =   &H00000000&
  210.       Height          =   195
  211.       Left            =   120
  212.       TabIndex        =   28
  213.       Top             =   3600
  214.       Width           =   540
  215.    End
  216.    Begin VB.Label lblUptimeDay
  217.       AutoSize        =   -1  'True
  218.      BackColor       =   &H00FFFFFF&
  219.       BackStyle       =   0  'Transparent
  220.      Caption         =   "0"
  221.       ForeColor       =   &H00000000&
  222.       Height          =   195
  223.       Left            =   720
  224.       TabIndex        =   27
  225.       Top             =   3600
  226.       Width           =   90
  227.    End
  228.    Begin VB.Label lblUptimeSec
  229.       AutoSize        =   -1  'True
  230.      BackColor       =   &H00FFFFFF&
  231.       BackStyle       =   0  'Transparent
  232.      Caption         =   "0"
  233.       ForeColor       =   &H00000000&
  234.       Height          =   195
  235.       Left            =   1800
  236.       TabIndex        =   26
  237.       Top             =   3600
  238.       Width           =   90
  239.    End
  240.    Begin VB.Label lblUptimeHour
  241.       AutoSize        =   -1  'True
  242.      BackColor       =   &H00FFFFFF&
  243.       BackStyle       =   0  'Transparent
  244.      Caption         =   "0"
  245.       ForeColor       =   &H00000000&
  246.       Height          =   195
  247.       Left            =   1080
  248.       TabIndex        =   25
  249.       Top             =   3600
  250.       Width           =   90
  251.    End
  252.    Begin VB.Label lblUptimeMin
  253.       AutoSize        =   -1  'True
  254.      BackColor       =   &H00FFFFFF&
  255.       BackStyle       =   0  'Transparent
  256.      Caption         =   "0"
  257.       ForeColor       =   &H00000000&
  258.       Height          =   195
  259.       Left            =   1440
  260.       TabIndex        =   24
  261.       Top             =   3600
  262.       Width           =   90
  263.    End
  264.    Begin VB.Label Label7
  265.       AutoSize        =   -1  'True
  266.      Caption         =   "Redirect Array:"
  267.       Height          =   195
  268.       Left            =   120
  269.       TabIndex        =   22
  270.       Top             =   2865
  271.       Width           =   1050
  272.    End
  273.    Begin VB.Label Label1
  274.       AutoSize        =   -1  'True
  275.      Caption         =   "Listen Port:"
  276.       BeginProperty Font
  277.          Name            =   "Tahoma"
  278.          Size            =   8.25
  279.          Charset         =   0
  280.          Weight          =   400
  281.          Underline       =   0   'False
  282.         Italic          =   0   'False
  283.         Strikethrough   =   0   'False
  284.      EndProperty
  285.       Height          =   195
  286.       Left            =   120
  287.       TabIndex        =   0
  288.       Top             =   1605
  289.       Width           =   825
  290.    End
  291.    Begin VB.Image imgAbout2
  292.       Height          =   480
  293.       Left            =   4560
  294.       Picture         =   "frmMain.frx":2D32
  295.       Top             =   240
  296.       Width           =   480
  297.    End
  298.    Begin VB.Image imgAbout
  299.       Height          =   480
  300.       Left            =   3960
  301.       Picture         =   "frmMain.frx":35FC
  302.       Top             =   240
  303.       Width           =   480
  304.    End
  305.    Begin VB.Label lblAbout
  306.       AutoSize        =   -1  'True
  307.      Caption         =   "Redirect Hub"
  308.       BeginProperty Font
  309.          Name            =   "Tahoma"
  310.          Size            =   8.25
  311.          Charset         =   0
  312.          Weight          =   400
  313.          Underline       =   0   'False
  314.         Italic          =   0   'False
  315.         Strikethrough   =   0   'False
  316.      EndProperty
  317.       Height          =   195
  318.       Left            =   3960
  319.       TabIndex        =   20
  320.       Top             =   810
  321.       Width           =   930
  322.    End
  323.    Begin VB.Label Label4
  324.       AutoSize        =   -1  'True
  325.      Caption         =   "by aDe 2003"
  326.       BeginProperty Font
  327.          Name            =   "Tahoma"
  328.          Size            =   8.25
  329.          Charset         =   0
  330.          Weight          =   400
  331.          Underline       =   0   'False
  332.         Italic          =   0   'False
  333.         Strikethrough   =   0   'False
  334.      EndProperty
  335.       Height          =   195
  336.       Left            =   3960
  337.       TabIndex        =   19
  338.       Top             =   1050
  339.       Width           =   915
  340.    End
  341.    Begin VB.Label Label8
  342.       AutoSize        =   -1  'True
  343.      Caption         =   "Use "";"" to seperate hub addresses."
  344.       ForeColor       =   &H000000FF&
  345.       Height          =   195
  346.       Left            =   1320
  347.       TabIndex        =   17
  348.       Top             =   3360
  349.       Width           =   2490
  350.    End
  351.    Begin VB.Label cmdStart2
  352.       Alignment       =   2  'Center
  353.      Appearance      =   0  'Flat
  354.      BackColor       =   &H00B56B00&
  355.       BorderStyle     =   1  'Fixed Single
  356.      Caption         =   "Start"
  357.       BeginProperty Font
  358.          Name            =   "Tahoma"
  359.          Size            =   8.25
  360.          Charset         =   0
  361.          Weight          =   400
  362.          Underline       =   0   'False
  363.         Italic          =   0   'False
  364.         Strikethrough   =   0   'False
  365.      EndProperty
  366.       ForeColor       =   &H80000009&
  367.       Height          =   255
  368.       Left            =   3960
  369.       TabIndex        =   16
  370.       Top             =   2040
  371.       Width           =   1455
  372.    End
  373.    Begin VB.Label cmdChangeRd
  374.       Alignment       =   2  'Center
  375.      Appearance      =   0  'Flat
  376.      BackColor       =   &H00B56B00&
  377.       BorderStyle     =   1  'Fixed Single
  378.      Caption         =   "Change Redirect"
  379.       Enabled         =   0   'False
  380.      BeginProperty Font
  381.          Name            =   "Tahoma"
  382.          Size            =   8.25
  383.          Charset         =   0
  384.          Weight          =   400
  385.          Underline       =   0   'False
  386.         Italic          =   0   'False
  387.         Strikethrough   =   0   'False
  388.      EndProperty
  389.       ForeColor       =   &H80000009&
  390.       Height          =   255
  391.       Left            =   3960
  392.       TabIndex        =   15
  393.       Top             =   2400
  394.       Visible         =   0   'False
  395.      Width           =   1455
  396.    End
  397.    Begin VB.Label Label6
  398.       AutoSize        =   -1  'True
  399.      BackStyle       =   0  'Transparent
  400.      Caption         =   "Bot Name:"
  401.       Height          =   195
  402.       Left            =   120
  403.       TabIndex        =   14
  404.       Top             =   2325
  405.       Width           =   750
  406.    End
  407.    Begin VB.Label Label5
  408.       AutoSize        =   -1  'True
  409.      BackStyle       =   0  'Transparent
  410.      Caption         =   "Network Name:"
  411.       Height          =   195
  412.       Left            =   120
  413.       TabIndex        =   13
  414.       Top             =   1965
  415.       Width           =   1110
  416.    End
  417.    Begin VB.Label lblLastNick
  418.       AutoSize        =   -1  'True
  419.      Caption         =   "(none)"
  420.       BeginProperty Font
  421.          Name            =   "Tahoma"
  422.          Size            =   8.25
  423.          Charset         =   0
  424.          Weight          =   400
  425.          Underline       =   0   'False
  426.         Italic          =   0   'False
  427.         Strikethrough   =   0   'False
  428.      EndProperty
  429.       Height          =   195
  430.       Left            =   3120
  431.       TabIndex        =   9
  432.       Top             =   960
  433.       Width           =   480
  434.    End
  435.    Begin VB.Label lblCounter
  436.       AutoSize        =   -1  'True
  437.      Caption         =   "0"
  438.       BeginProperty Font
  439.          Name            =   "Tahoma"
  440.          Size            =   8.25
  441.          Charset         =   0
  442.          Weight          =   400
  443.          Underline       =   0   'False
  444.         Italic          =   0   'False
  445.         Strikethrough   =   0   'False
  446.      EndProperty
  447.       Height          =   195
  448.       Left            =   1320
  449.       TabIndex        =   8
  450.       Top             =   960
  451.       Width           =   90
  452.    End
  453.    Begin VB.Label Label3
  454.       AutoSize        =   -1  'True
  455.      Caption         =   "Last client:"
  456.       BeginProperty Font
  457.          Name            =   "Tahoma"
  458.          Size            =   8.25
  459.          Charset         =   0
  460.          Weight          =   400
  461.          Underline       =   0   'False
  462.         Italic          =   0   'False
  463.         Strikethrough   =   0   'False
  464.      EndProperty
  465.       Height          =   195
  466.       Left            =   2280
  467.       TabIndex        =   7
  468.       Top             =   960
  469.       Width           =   780
  470.    End
  471.    Begin VB.Label Label2
  472.       AutoSize        =   -1  'True
  473.      Caption         =   "Redirects done:"
  474.       BeginProperty Font
  475.          Name            =   "Tahoma"
  476.          Size            =   8.25
  477.          Charset         =   0
  478.          Weight          =   400
  479.          Underline       =   0   'False
  480.         Italic          =   0   'False
  481.         Strikethrough   =   0   'False
  482.      EndProperty
  483.       Height          =   195
  484.       Left            =   120
  485.       TabIndex        =   6
  486.       Top             =   960
  487.       Width           =   1140
  488.    End
  489. End
  490. Attribute VB_Name = "frmMain"
  491. Attribute VB_GlobalNameSpace = False
  492. Attribute VB_Creatable = False
  493. Attribute VB_PredeclaredId = True
  494. Attribute VB_Exposed = False
  495. Dim addrArr() As String, addrIndex As Byte
  496. Dim addr As String
  497.  
  498. Dim localPort As Long, bOn As Boolean
  499. Dim strChat As String, strPM As String
  500.  
  501. Sub LogError(strSub As String, strError As String)
  502. If Not frmErrors.Visible = True Then frmErrors.Show
  503.     frmErrors.txtLog.Text = frmErrors.txtLog.Text & vbCrLf & "<" & strSub & "> " & strError
  504. End Sub
  505.  
  506. Private Sub chkWebServe_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  507. If chkWebServe.Value = 0 Then
  508.     Unload webserve
  509. Else
  510.     Load webserve
  511. End If
  512. End Sub
  513.  
  514. 'Moves on to the next address in the list. Is *required* by the redirecter.
  515. Private Sub cmdChangeRd_Click()
  516.     addr = addrArr(addrIndex)
  517.     addrIndex = addrIndex + 1
  518.    
  519. If addrIndex > UBound(addrArr) Then
  520.     addrIndex = 0
  521. End If
  522. End Sub
  523.  
  524. Private Sub cmdEditChat_Click()
  525. On Error GoTo RepErr
  526. GoTo RunSub
  527. RepErr:
  528. LogError "cmdEditChat", Error$
  529. Exit Sub
  530. RunSub:
  531.  
  532. Load frmEditText
  533. frmEditText.txtEdit.Text = strChat
  534. frmEditText.Show vbModal
  535. strChat = frmEditText.txtEdit.Text
  536. Unload frmEditText
  537. End Sub
  538.  
  539. Private Sub cmdEditPM_Click()
  540. On Error GoTo RepErr
  541. GoTo RunSub
  542. RepErr:
  543. LogError "cmdEditPM", Error$
  544. Exit Sub
  545. RunSub:
  546.  
  547. Load frmEditText
  548. frmEditText.txtEdit.Text = strPM
  549. frmEditText.Show vbModal
  550. strPM = frmEditText.txtEdit.Text
  551. Unload frmEditText
  552. End Sub
  553.  
  554. Private Sub cmdLog_Click()
  555.   frmLog.Show
  556. End Sub
  557.  
  558. Private Sub cmdToggle_Click()
  559. On Error GoTo RepErr
  560. GoTo RunSub
  561. RepErr:
  562. LogError "cmdToggle_Click", Error$
  563. Exit Sub
  564. RunSub:
  565.  
  566. Dim i As Integer
  567. Select Case bOn
  568.   Case False
  569.     If Not OpenPort(Val(txtPort.Text)) Then
  570.       MsgBox "Sorry, could not open port '" & txtPort.Text & "' for TCP listening..."
  571.       Exit Sub
  572.     End If
  573.     bOn = True
  574.     cmdToggle.Caption = "Stop"
  575.     tmrUptimeSec.Enabled = True
  576.     txtPort.Enabled = False
  577.   Case True
  578.     If sckListen.State <> sckClosed Then sckListen.Close
  579.     For i = 0 To Socket.UBound
  580.       KillSocket i
  581.     Next
  582.     bOn = False
  583.     cmdToggle.Caption = "Start"
  584.     tmrUptimeSec.Enabled = False    
  585.     txtPort.Enabled = True
  586. End Select
  587. End Sub
  588.  
  589. Function OpenPort(iPort As Long) As Boolean
  590. On Error GoTo RepErr
  591. GoTo RunSub
  592. RepErr:
  593. LogError "OpenPort", Error$
  594. Exit Function
  595. RunSub:
  596.  
  597. On Error GoTo faill
  598. sckListen.localPort = iPort
  599. sckListen.Listen
  600. localPort = iPort
  601. OpenPort = True
  602. Exit Function
  603.  
  604. faill:
  605. localPort = 0
  606. OpenPort = False
  607. End Function
  608.  
  609. Private Sub Form_Load()
  610.     lblAbout.Caption = "Redirect- hub v. " & verNum
  611.     GetSettings
  612.     'Splits each address using the symbol ";".
  613.    addrArr = Split(txtArray.Text, ";")
  614.     'Uptime timer. Home made uptime :).
  615.    tmrUptimeSec.Interval = 1000
  616. End Sub
  617.  
  618. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  619.     SaveSettings
  620. End
  621. End Sub
  622.  
  623. Private Sub Form_Unload(Cancel As Integer)
  624. End
  625. End Sub
  626. Sub SaveSettings()
  627. On Error GoTo RepErr
  628. GoTo RunSub
  629. RepErr:
  630. LogError "SaveSettings", Error$
  631. Exit Sub
  632. RunSub:
  633.  
  634. Dim aPath As String
  635. aPath = App.Path
  636. dFile = "RedirectHub.cfg"
  637. If Right(aPath, 1) <> "\" Then aPath = aPath & "\"
  638.  
  639. dStr = "[Settings]" & vbCrLf
  640. dStr = dStr & "<Port>" & txtPort.Text & vbCrLf
  641. dStr = dStr & "<Network>" & txtNetwork.Text & vbCrLf
  642. dStr = dStr & "<BotName>" & txtRdBotName.Text & vbCrLf
  643. dStr = dStr & "<RedirectArray>" & txtArray.Text & vbCrLf
  644. dStr = dStr & "<ChatMSGOn>" & chkChat.Value & vbCrLf
  645. dStr = dStr & "<PMOn>" & chkPM.Value & vbCrLf
  646. dStr = dStr & "<UptimeOn>" & chkUptime.Value & vbCrLf
  647. dStr = dStr & "<ChatMSG>" & strChat & "</ChatMSG>" & vbCrLf
  648. dStr = dStr & "<PM>" & strPM & "</PM>" & vbCrLf
  649. dStr = dStr & vbCrLf
  650. Open aPath & dFile For Output As #1
  651. Print #1, dStr
  652. Close #1
  653.  
  654. End Sub
  655.  
  656. Sub GetSettings()
  657. On Error GoTo RepErr
  658. GoTo RunSub
  659. RepErr:
  660. LogError "GetSettings", Error$
  661. Exit Sub
  662. RunSub:
  663.  
  664. Dim aStr As String, aSect As String
  665. aSect = "Settings"
  666. aStr = aGetFile("RedirectHub.cfg")
  667. If aStr = "" Then Exit Sub
  668.  
  669. txtPort.Text = aGEFS(aStr, aSect, "Port", "7778")
  670. txtNetwork.Text = aGEFS(aStr, aSect, "Network", "ViCiouS LeGioN™")
  671. txtRdBotName.Text = aGEFS(aStr, aSect, "BotName", "LeGioN™")
  672. txtArray.Text = aGEFS(aStr, aSect, "Redirect", "1.legiondc.com;2.legiondc.com:443;3.legiondc.com:23")
  673. strChat = aGTFS(aStr, aSect, "ChatMSG", "")
  674. strPM = aGTFS(aStr, aSect, "PM", "")
  675. chkPM.Value = Val(aGEFS(aStr, aSect, "PMOn", "0"))
  676. chkChat.Value = Val(aGEFS(aStr, aSect, "ChatMSGOn", "0"))
  677. chkUptime = Val(aGEFS(aStr, aSect, "UptimeOn", "0"))
  678.  
  679. End Sub
  680.  
  681. Sub SocketSend(sckIndex As Integer, sckData As String)
  682. On Error GoTo RepErr
  683. GoTo RunSub
  684. RepErr:
  685. LogError "SocketSend", Error$
  686. Exit Sub
  687. RunSub:
  688.  
  689. Socket(sckIndex).SendData sckData
  690. If frmLog.Visible Then frmLog.txtLog.Text = frmLog.txtLog.Text & vbCrLf & "<" & sckIndex & "--> " & sckData
  691. End Sub
  692.  
  693. Private Sub imgAbout_Click()
  694. Dim dStr As String
  695. dStr = "RedirectHub version " & verNum & " by aDe 2003." & vbCrLf
  696. dStr = dStr & "dchub://phats0.d2g.com" & vbCrLf
  697. dStr = dStr & "ade_n84@hotmail.com" & vbCrLf
  698.  
  699. MsgBox dStr, vbInformation
  700. End Sub
  701.  
  702. Private Sub sckListen_ConnectionRequest(ByVal requestID As Long)
  703. On Error GoTo RepErr
  704. GoTo RunSub
  705. RepErr:
  706. LogError "sckListen_ConnectionRequest", Error$
  707. Exit Sub
  708. RunSub:
  709.  
  710. Dim i As Integer
  711. i = NewSock("30")
  712. Socket(i).Accept requestID
  713. DoEvents
  714. SocketSend i, "$Lock REDIRECTHUB-V" & verNum & "-ABCABCABCABCABCABC Pk=aDe2003|"
  715.  
  716. If frmLog.Visible Then frmLog.txtLog.Text = frmLog.txtLog.Text & vbCrLf & "<" & i & "> Opened"
  717. End Sub
  718.  
  719. Public Function NewSock(addTag As String) As Integer
  720. On Error GoTo RepErr
  721. GoTo RunSub
  722. RepErr:
  723. LogError "NewSock", Error$
  724. Exit Function
  725. RunSub:
  726.  
  727. Dim i As Integer
  728.  
  729.  For i = 0 To Socket.UBound
  730.  
  731.   If Socket(i).Tag = "" Then
  732.    Socket(i).Tag = addTag
  733.    FindSocket = i
  734.    Exit Function
  735.   End If
  736.  
  737.  Next
  738.  
  739.  Load Socket(Socket.UBound + 1)
  740.  Socket(Socket.UBound).Tag = addTag
  741.  FindSocket = Socket.UBound
  742.  
  743. End Function
  744.  
  745. Private Sub Socket_DataArrival(Index As Integer, ByVal bytesTotal As Long)
  746. On Error GoTo RepErr
  747. GoTo RunSub
  748. RepErr:
  749. LogError "Socket_DataArrival", Error$
  750. Exit Sub
  751. RunSub:
  752.  
  753. Dim dStr As String, cNick As String
  754. Socket(Index).GetData dStr
  755.  
  756. If frmLog.Visible Then frmLog.txtLog.Text = frmLog.txtLog.Text & vbCrLf & "<--" & Index & "> " & dStr
  757.  
  758. If InStr(1, dStr, "$ValidateNick ") Then
  759.   cNick = BeforeFirst(AfterFirst(dStr, "$ValidateNick "), "|")
  760.   lblCounter.Caption = Val(lblCounter.Caption) + 1
  761.   lblLastNick.Caption = cNick
  762.   If chkChat.Value Then SocketSend Index, "<Hub> " & strChat & "|"
  763.   If chkPM.Value Then SocketSend Index, "$To: " & cNick & " From: " & "Hub $" & strPM & "|"
  764.   'Rotates the array and prepares the next address to redirect to.
  765.  cmdChangeRd_Click
  766.   SocketSend Index, "$ForceMove " & addr & "|"
  767.   DoEvents
  768.   Socket(Index).Tag = "2"
  769. End If
  770. End Sub
  771.  
  772.  
  773. Sub KillSocket(Index As Integer)
  774. On Error GoTo RepErr
  775. GoTo RunSub
  776. RepErr:
  777. LogError "KillSocket", Error$
  778. Exit Sub
  779. RunSub:
  780.  
  781.  If Socket(Index).State <> sckClosed Then Socket(Index).Close
  782.  Socket(Index).Tag = ""
  783.  If frmLog.Visible Then frmLog.txtLog.Text = frmLog.txtLog.Text & vbCrLf & "<" & Index & "> Closed"
  784. End Sub
  785.  
  786. Private Sub tmrTick_Timer()
  787. On Error GoTo RepErr
  788. GoTo RunSub
  789. RepErr:
  790. LogError "tmrTick_Timer", Error$
  791. Exit Sub
  792. RunSub:
  793.  
  794. Dim cVal As Integer
  795. Dim i As Integer
  796. For i = 0 To Socket.UBound
  797.   If Len(Socket(i).Tag) Then
  798.     cVal = Int(Val(Socket(i).Tag))
  799.     If cVal = 0 Then
  800.       KillSocket i
  801.     Else
  802.       Socket(i).Tag = cVal - 1
  803.     End If
  804.   End If
  805. Next
  806.  
  807. End Sub
  808.  
  809. Private Sub tmrUptimeSec_Timer()
  810.     'Only keep track of uptime if the array is turned on. If it is then starting counting uptime.
  811.    If bOn = True Then
  812.  
  813.     lblUptimeSec.Caption = Format(lblUptimeSec.Caption + 1, "00")
  814.     'Once the uptime in seconds reaches 60 then it resets to 0 and adds 1 minute.
  815.    If lblUptimeSec.Caption > 59 Then
  816.         lblUptimeSec.Caption = Format(lblUptimeSec.Caption - 60, "00")
  817.         lblUptimeMin.Caption = Format(lblUptimeMin.Caption + 1, "00")
  818.     End If
  819.     'Once the uptime in minutes reaches 60 then it resets to 0 and adds 1 hour.
  820.    If lblUptimeMin.Caption > 59 Then
  821.         lblUptimeMin.Caption = Format(lblUptimeMin.Caption - 60, "00")
  822.         lblUptimeHour.Caption = Format(lblUptimeHour.Caption + 1, "00")
  823.     End If
  824.    
  825.     'Once the uptime in hours reaches 24 then it resets to 0 and adds 1 day.
  826.    If lblUptimeHour.Caption > 23 Then
  827.         lblUptimeHour.Caption = lblUptimeHour.Caption - 24
  828.         lblUptimeDay.Caption = lblUptimeDay.Caption + 1
  829.     End If
  830.  
  831.     'If it's not keeping uptime then make sure those values stay at "00".
  832.    Else
  833.         lblUptimeSec.Caption = "00"
  834.     lblUptimeMin.Caption = "00"
  835.     lblUptimeHour.Caption = "00"
  836.     lblUptimeDay.Caption = "00"
  837.     End If
  838. End Sub
  839.  
  840. 'If the array loses focus it will still remember spliting addys. Lets say for example you enter an addy in, and then you click away to minimize, then it will "lose focus" and remember that the addys are split.
  841. Private Sub txtArray_LostFocus()
  842.     addrArr = Split(txtArray.Text, ";")
  843. End Sub
Add Comment
Please, Sign In to add comment