Initial revision
[citadel.git] / wincit / ipc.frm
1 VERSION 4.00
2 Begin VB.Form IPC 
3    Appearance      =   0  'Flat
4    BackColor       =   &H80000005&
5    BorderStyle     =   1  'Fixed Single
6    ClientHeight    =   3075
7    ClientLeft      =   2130
8    ClientTop       =   1575
9    ClientWidth     =   5895
10    ControlBox      =   0   'False
11    BeginProperty Font 
12       name            =   "System"
13       charset         =   0
14       weight          =   700
15       size            =   9.75
16       underline       =   0   'False
17       italic          =   0   'False
18       strikethrough   =   0   'False
19    EndProperty
20    ForeColor       =   &H80000008&
21    Height          =   3480
22    Left            =   2070
23    LinkTopic       =   "Form1"
24    MaxButton       =   0   'False
25    MDIChild        =   -1  'True
26    MinButton       =   0   'False
27    ScaleHeight     =   3075
28    ScaleWidth      =   5895
29    Top             =   1230
30    Width           =   6015
31    Begin VB.Timer md_timeout 
32       Left            =   120
33       Top             =   2520
34    End
35    Begin VB.CommandButton cancel_button 
36       Appearance      =   0  'Flat
37       BackColor       =   &H80000005&
38       Caption         =   "Cancel"
39       BeginProperty Font 
40          name            =   "MS Sans Serif"
41          charset         =   0
42          weight          =   700
43          size            =   8.25
44          underline       =   0   'False
45          italic          =   0   'False
46          strikethrough   =   0   'False
47       EndProperty
48       Height          =   492
49       Left            =   4680
50       TabIndex        =   1
51       Top             =   2520
52       Width           =   1092
53    End
54    Begin VB.TextBox DebugWin 
55       Appearance      =   0  'Flat
56       BeginProperty Font 
57          name            =   "MS Sans Serif"
58          charset         =   0
59          weight          =   700
60          size            =   8.25
61          underline       =   0   'False
62          italic          =   0   'False
63          strikethrough   =   0   'False
64       EndProperty
65       Height          =   2052
66       Left            =   0
67       MultiLine       =   -1  'True
68       ScrollBars      =   2  'Vertical
69       TabIndex        =   0
70       Top             =   360
71       Width           =   5892
72    End
73    Begin IPOCXLib.IPocx TCP 
74       Left            =   600
75       Top             =   2520
76       _Version        =   65536
77       _ExtentX        =   2143
78       _ExtentY        =   873
79       _StockProps     =   0
80       HostAddr        =   ""
81       HostPort        =   0
82       LocalAddr       =   ""
83       LocalPort       =   0
84    End
85    Begin VB.Label StatMsg 
86       Appearance      =   0  'Flat
87       AutoSize        =   -1  'True
88       BackColor       =   &H80000005&
89       Caption         =   "Connecting to server, please wait..."
90       BeginProperty Font 
91          name            =   "MS Sans Serif"
92          charset         =   0
93          weight          =   700
94          size            =   12
95          underline       =   0   'False
96          italic          =   0   'False
97          strikethrough   =   0   'False
98       EndProperty
99       ForeColor       =   &H80000008&
100       Height          =   300
101       Left            =   0
102       TabIndex        =   2
103       Top             =   0
104       Width           =   5892
105       WordWrap        =   -1  'True
106    End
107 End
108 Attribute VB_Name = "IPC"
109 Attribute VB_Creatable = False
110 Attribute VB_Exposed = False
111
112
113 Private Sub cancel_button_Click()
114     Cancelled = True
115     DebugWin.Text = "CANCELLED!"
116 End Sub
117
118 Private Sub Form_Load()
119     
120     Cancelled = False
121     IPC.Width = 5988
122     IPC.Height = 3492
123     IPC.Top = Int((MainWin.Height - IPC.Height) / 3)
124     IPC.Left = Int((MainWin.Width - IPC.Width) / 2)
125     Show
126     DoEvents
127
128   
129 TCPConnect:
130     tcpconnected = False
131     h$ = StripTrailingWhiteSpace(CurrBBS.PhoneOrAddress)
132     p$ = StripTrailingWhiteSpace(Str$(CurrBBS.TCPport))
133
134     On Error Resume Next
135     statmsg.Caption = "Trying <" + h$ + "> port <" + p$ + ">"
136     TCP.HostAddr = h$
137     TCP.HostPort = p$
138     TCP.Connect
139     TCPinbuf$ = ""
140
141     If Cancelled = True Then GoTo endload
142
143 StartServer:
144     statmsg.Caption = serv_gets()
145
146     IPC.Width = 0
147     IPC.Height = 0
148
149     DoubleClickAction$ = GetPrivateProfileVBString("Preferences", "DoubleClickAction", "GOTO", "WINCIT.INI")
150     Load CitUser
151     md_timeout.Interval = KeepAlive
152     md_timeout.Enabled = True
153     InTrans = False
154     SaveNewCount = 0
155     SaveOldCount = 0
156
157 endload:
158     If Cancelled = True Then
159         TCP.Connected = False
160         IPC.Width = 0
161         IPC.Height = 0
162         Load SelectBBS
163
164         End If
165 End Sub
166
167 Private Sub Form_Unload(Cancel As Integer)
168
169     If tcpconnected = True Then
170         tcpconnected = False
171         End If
172
173 End Sub
174
175 Private Sub md_timeout_Timer()
176     md_timeout.Enabled = False
177     If begin_trans() = True Then
178         serv_puts ("NOOP")
179         a$ = serv_gets()
180         If Left$(a$, 1) <> "2" Then
181             MsgBox a$, 48
182             End If
183         If Mid$(a$, 4, 1) = "*" Then
184             serv_puts ("PEXP")
185             a$ = serv_gets()
186             If Left$(a$, 1) = "1" Then
187                 ex$ = ""
188                 Do
189                     a$ = serv_gets()
190                     If a$ <> "000" Then ex$ = ex$ + a$ + Chr$(13) + Chr$(10)
191                     Loop Until a$ = "000"
192                 MsgBox ex$, 0, "Express message"
193                 End If
194             End If
195         Call end_trans
196         End If
197     md_timeout.Interval = KeepAlive
198     md_timeout.Enabled = True
199 End Sub
200
201
202 Private Sub TCP_DataReceived(ByVal data As String, ByVal l As Long)
203
204 TCPinbuf$ = TCPinbuf$ + data
205
206 End Sub
207
208 Private Sub TCP_Disconnected()
209
210 tcpconnected = False
211
212 End Sub
213
214