Initial revision
[citadel.git] / wincit / cituser.frm
1 VERSION 4.00
2 Begin VB.Form CitUser 
3    AutoRedraw      =   -1  'True
4    BorderStyle     =   1  'Fixed Single
5    ClientHeight    =   6600
6    ClientLeft      =   1140
7    ClientTop       =   1500
8    ClientWidth     =   9255
9    ControlBox      =   0   'False
10    BeginProperty Font 
11       name            =   "MS Sans Serif"
12       charset         =   0
13       weight          =   700
14       size            =   8.25
15       underline       =   0   'False
16       italic          =   0   'False
17       strikethrough   =   0   'False
18    EndProperty
19    ForeColor       =   &H80000008&
20    Height          =   7005
21    Left            =   1080
22    LinkTopic       =   "Form1"
23    MaxButton       =   0   'False
24    MDIChild        =   -1  'True
25    MinButton       =   0   'False
26    ScaleHeight     =   6600
27    ScaleWidth      =   9255
28    Top             =   1155
29    Width           =   9375
30    Begin Threed.SSPanel helloframe 
31       Height          =   3375
32       Left            =   120
33       TabIndex        =   11
34       Top             =   3120
35       Width           =   6255
36       _Version        =   65536
37       _ExtentX        =   11033
38       _ExtentY        =   5953
39       _StockProps     =   15
40       BackColor       =   12632256
41       BevelWidth      =   4
42       BorderWidth     =   5
43       BevelOuter      =   1
44       Begin VB.TextBox hello 
45          Alignment       =   2  'Center
46          Appearance      =   0  'Flat
47          BackColor       =   &H00C0C0C0&
48          BorderStyle     =   0  'None
49          Height          =   3135
50          Left            =   120
51          MultiLine       =   -1  'True
52          TabIndex        =   12
53          Top             =   120
54          Width           =   6015
55       End
56    End
57    Begin Threed.SSPanel Panel3D1 
58       Height          =   1935
59       Left            =   6480
60       TabIndex        =   10
61       Top             =   2160
62       Width           =   2655
63       _Version        =   65536
64       _ExtentX        =   4683
65       _ExtentY        =   3413
66       _StockProps     =   15
67       BackColor       =   12632256
68       BevelWidth      =   4
69       BorderWidth     =   5
70       BevelOuter      =   1
71    End
72    Begin Threed.SSPanel Instructions 
73       Height          =   2295
74       Left            =   6480
75       TabIndex        =   1
76       Top             =   4200
77       Width           =   2655
78       _Version        =   65536
79       _ExtentX        =   4683
80       _ExtentY        =   4048
81       _StockProps     =   15
82       Caption         =   $"CITUSER.frx":0000
83       BackColor       =   12632256
84       BevelWidth      =   4
85       BorderWidth     =   5
86       BevelOuter      =   1
87    End
88    Begin VB.CommandButton newuser_button 
89       Appearance      =   0  'Flat
90       BackColor       =   &H80000005&
91       Caption         =   "New User"
92       Height          =   375
93       Left            =   6480
94       TabIndex        =   9
95       Top             =   1680
96       Width           =   1335
97    End
98    Begin VB.CommandButton disc_button 
99       Appearance      =   0  'Flat
100       BackColor       =   &H80000005&
101       Caption         =   "Disconnect"
102       Height          =   375
103       Left            =   7920
104       TabIndex        =   5
105       Top             =   1680
106       Width           =   1215
107    End
108    Begin VB.CommandButton login_button 
109       Appearance      =   0  'Flat
110       BackColor       =   &H80000005&
111       Caption         =   "Log In"
112       Height          =   375
113       Left            =   6480
114       TabIndex        =   4
115       Top             =   1200
116       Width           =   1335
117    End
118    Begin VB.TextBox Password 
119       Alignment       =   2  'Center
120       Appearance      =   0  'Flat
121       BackColor       =   &H00C0C0C0&
122       BorderStyle     =   0  'None
123       BeginProperty Font 
124          name            =   "Wingdings"
125          charset         =   2
126          weight          =   700
127          size            =   12
128          underline       =   0   'False
129          italic          =   0   'False
130          strikethrough   =   0   'False
131       EndProperty
132       Height          =   525
133       Left            =   240
134       TabIndex        =   3
135       Top             =   2400
136       Width           =   6015
137    End
138    Begin VB.TextBox UserName 
139       Alignment       =   2  'Center
140       Appearance      =   0  'Flat
141       BackColor       =   &H00C0C0C0&
142       BorderStyle     =   0  'None
143       BeginProperty Font 
144          name            =   "MS Sans Serif"
145          charset         =   0
146          weight          =   700
147          size            =   18
148          underline       =   0   'False
149          italic          =   0   'False
150          strikethrough   =   0   'False
151       EndProperty
152       Height          =   495
153       Left            =   240
154       TabIndex        =   0
155       Top             =   1440
156       Width           =   6015
157    End
158    Begin Threed.SSFrame Frame3D2 
159       Height          =   855
160       Left            =   120
161       TabIndex        =   8
162       Top             =   2160
163       Width           =   6255
164       _Version        =   65536
165       _ExtentX        =   11033
166       _ExtentY        =   1508
167       _StockProps     =   14
168       Caption         =   "Password:"
169    End
170    Begin Threed.SSFrame Frame3D1 
171       Height          =   855
172       Left            =   120
173       TabIndex        =   2
174       Top             =   1200
175       Width           =   6255
176       _Version        =   65536
177       _ExtentX        =   11033
178       _ExtentY        =   1508
179       _StockProps     =   14
180       Caption         =   "User Name:"
181    End
182    Begin VB.Label BBScity 
183       Alignment       =   2  'Center
184       Appearance      =   0  'Flat
185       BackColor       =   &H00C00000&
186       BeginProperty Font 
187          name            =   "MS Sans Serif"
188          charset         =   0
189          weight          =   700
190          size            =   12
191          underline       =   0   'False
192          italic          =   0   'False
193          strikethrough   =   0   'False
194       EndProperty
195       ForeColor       =   &H0000FFFF&
196       Height          =   375
197       Left            =   120
198       TabIndex        =   7
199       Top             =   720
200       Width           =   9015
201    End
202    Begin VB.Label BBSname 
203       Alignment       =   2  'Center
204       Appearance      =   0  'Flat
205       BackColor       =   &H00C00000&
206       BeginProperty Font 
207          name            =   "MS Sans Serif"
208          charset         =   0
209          weight          =   700
210          size            =   18
211          underline       =   0   'False
212          italic          =   0   'False
213          strikethrough   =   0   'False
214       EndProperty
215       ForeColor       =   &H0000FFFF&
216       Height          =   495
217       Left            =   120
218       TabIndex        =   6
219       Top             =   120
220       Width           =   9015
221    End
222 End
223 Attribute VB_Name = "CitUser"
224 Attribute VB_Creatable = False
225 Attribute VB_Exposed = False
226
227 Private Sub check_buttons()
228     If UserName.Text <> "" And Password.Text <> "" Then
229         login_button.Enabled = True
230         newuser_button.Enabled = True
231     Else
232         login_button.Enabled = False
233         newuser_button.Enabled = False
234         End If
235 End Sub
236
237 Private Sub disc_button_Click()
238     
239
240         Call serv_puts("QUIT")
241         dummy$ = serv_gets()
242
243     Unload CitUser
244     Unload IPC
245     Load SelectBBS
246
247 End Sub
248
249 Private Sub form_activate()
250     CitUser.WindowState = 0
251     CitUser.Left = Int((MainWin.Width - CitUser.Width) / 2)
252     CitUser.Top = Int((MainWin.Height - CitUser.Height) / 3)
253 End Sub
254
255 Private Sub Form_Load()
256     CitUser.WindowState = 0
257     CitUser.Left = Int((MainWin.Width - CitUser.Width) / 2)
258     CitUser.Top = Int((MainWin.Height - CitUser.Height) / 3)
259     Call check_buttons
260     Show
261     SaveOldCount = 0
262     SaveNewCount = 0
263     CurrRoomName$ = ""
264
265     ' Use the INFO command to retrieve global server information
266     ' (This could probably get moved to the IPC module)
267     '
268     If begin_trans() = False Then GoTo skipcitu
269
270     serv_puts ("IDEN 0|2|100|WinCit")
271     buf$ = serv_gets()
272
273     serv_puts ("INFO")
274     buf$ = serv_gets()
275     If Left$(buf$, 1) = "1" Then
276         a% = 0
277         buf$ = ""
278         Do
279             buf$ = serv_gets()
280             If buf$ = "000" Then Exit Do
281             a% = a% + 1
282             Select Case a%
283                 Case 1
284                     serv_pid% = Val(buf$)
285                 Case 2
286                     serv_nodename$ = buf$
287                 Case 3
288                     serv_humannode$ = buf$
289                 Case 4
290                     serv_fqdn$ = buf$
291                 Case 5
292                     serv_software$ = buf$
293                 Case 6
294                     serv_rev_level! = CDbl(buf$) / 100
295                 Case 7
296                     serv_bbs_city$ = buf$
297                 Case 8
298                     serv_sysadm$ = buf$
299                 End Select
300             Loop
301         Call end_trans
302         BBSname.Caption = serv_humannode$
303         BBScity.Caption = serv_bbs_city$
304         End If
305
306     MainWin.Caption = serv_humannode$
307 skipcitu:
308     
309     If begin_trans() = False Then GoTo skiphello
310     serv_puts ("MESG hello")
311     c$ = serv_gets()
312     If (Left$(c$, 1) = "1") Then
313         b$ = ""
314         Do
315             c$ = serv_gets()
316             If (c$ <> "000") Then
317                 Do While Left$(c$, 2) = "  "
318                     c$ = Right$(c$, Len(c$) - 1)
319                     Loop
320                 b$ = b$ + c$ + Chr$(13) + Chr$(10)
321                 End If
322             Loop Until c$ = "000"
323         hello.Text = Cit_Format(b$)
324     Else
325         hello.Text = c$
326         End If
327     Call end_trans
328
329
330 skiphello:
331     Call form_activate
332     CitUser.SetFocus
333     UserName.SetFocus
334
335 End Sub
336
337 ' begin_trans() will already have been called before get_uparms()
338 '
339 Private Sub get_uparms(loginstr As String)
340
341     p$ = Right$(loginstr, Len(loginstr) - 4)
342     axlevel% = Val(extract(p$, 1))
343
344     serv_puts ("CHEK")
345     a$ = serv_gets()
346     If Left$(a$, 1) = "2" Then
347         a$ = Right$(a$, Len(a$) - 4)
348         m$ = ""
349         nm% = Val(extract(a$, 0))
350         If nm% = 1 Then m$ = m$ + "You have a new private message in Mail>" + Chr$(13) + Chr$(10)
351         If nm% > 1 Then m$ = m$ + "You have " + Str$(nm%) + " new private messages in Mail>" + Chr$(13) + Chr$(10)
352
353         If axlevel >= 6 And Val(extract(a$, 2)) > 0 Then m$ = m$ + "Users need validation" + Chr$(13) + Chr$(10)
354
355         If Len(m$) > 0 Then MsgBox m$, 64
356         
357         need_regis% = Val(extract(a$, 1))
358
359         End If
360
361
362
363 End Sub
364
365 Private Sub Login_Button_Click()
366     
367     If begin_trans() = True Then
368         serv_puts ("USER " + UserName.Text)
369         buf$ = serv_gets()
370         Call end_trans
371         If Left$(buf$, 1) <> "3" Then
372             MsgBox Right$(buf$, Len(buf$) - 4), 16
373             End If
374         If Left$(buf$, 1) = "3" Then
375             serv_puts ("PASS " + Password.Text)
376             buf$ = serv_gets()
377             If Left$(buf$, 1) <> "2" Then
378                 MsgBox Right$(buf$, Len(buf$) - 4), 16
379                 End If
380             If Left$(buf$, 1) = "2" Then
381                 get_uparms (buf$)
382                 Unload CitUser
383                 If need_regis% = 1 Then
384                     Load Registration
385                 Else
386                     Load RoomPrompt
387                     End If
388                 End If
389             End If
390         End If
391
392
393 End Sub
394
395 Private Sub newuser_button_Click()
396     If begin_trans() = True Then
397         serv_puts ("NEWU " + UserName.Text)
398         buf$ = serv_gets()
399         If Left$(buf$, 1) = "2" Then
400             serv_puts ("SETP " + Password.Text)
401             buf$ = serv_gets()
402             Call end_trans
403             If Left$(buf$, 1) <> "2" Then
404                 MsgBox Right$(buf$, Len(buf$) - 4), 16
405                 End If
406             get_uparms (buf$)
407             Unload CitUser
408                 If need_regis% = 1 Then
409                     Load Registration
410                 Else
411                     Load RoomPrompt
412                     End If
413         Else
414             MsgBox Right$(buf$, Len(buf$) - 4), 16
415             End If
416         Call end_trans
417         End If
418 End Sub
419
420 Private Sub Password_Change()
421     Call check_buttons
422 End Sub
423
424 Private Sub Password_Click()
425
426 Rem
427
428 End Sub
429
430
431 Private Sub Password_KeyPress(keyascii As Integer)
432     If keyascii = 13 Then Call Login_Button_Click
433 End Sub
434
435 Private Sub UserName_Change()
436     Call check_buttons
437 End Sub
438
439 Private Sub UserName_KeyPress(keyascii As Integer)
440     If keyascii = 13 Then Call Password_Click
441 End Sub
442