Initial revision
[citadel.git] / wincit / editroom.frm
1 VERSION 4.00
2 Begin VB.Form EditRoom 
3    Appearance      =   0  'Flat
4    BackColor       =   &H00C0C0C0&
5    BorderStyle     =   3  'Fixed Dialog
6    Caption         =   "Edit this room"
7    ClientHeight    =   6105
8    ClientLeft      =   105
9    ClientTop       =   2340
10    ClientWidth     =   7410
11    ClipControls    =   0   'False
12    ControlBox      =   0   'False
13    BeginProperty Font 
14       name            =   "MS Sans Serif"
15       charset         =   0
16       weight          =   700
17       size            =   8.25
18       underline       =   0   'False
19       italic          =   0   'False
20       strikethrough   =   0   'False
21    EndProperty
22    ForeColor       =   &H80000008&
23    Height          =   6510
24    Left            =   45
25    LinkTopic       =   "Form1"
26    MaxButton       =   0   'False
27    MDIChild        =   -1  'True
28    MinButton       =   0   'False
29    ScaleHeight     =   6105
30    ScaleWidth      =   7410
31    Top             =   1995
32    Width           =   7530
33    Begin VB.CheckBox check_ReadOnly 
34       Appearance      =   0  'Flat
35       BackColor       =   &H00C0C0C0&
36       Caption         =   "Read-only room"
37       ForeColor       =   &H80000008&
38       Height          =   255
39       Left            =   3840
40       TabIndex        =   29
41       Top             =   4920
42       Width           =   3375
43    End
44    Begin VB.TextBox DirName 
45       Alignment       =   2  'Center
46       Appearance      =   0  'Flat
47       BackColor       =   &H00C0C0C0&
48       BorderStyle     =   0  'None
49       BeginProperty Font 
50          name            =   "MS Sans Serif"
51          charset         =   0
52          weight          =   700
53          size            =   9.75
54          underline       =   0   'False
55          italic          =   0   'False
56          strikethrough   =   0   'False
57       EndProperty
58       Height          =   285
59       Left            =   3840
60       TabIndex        =   28
61       Text            =   "Directory"
62       Top             =   2880
63       Width           =   3375
64    End
65    Begin Threed.SSFrame Frame3D9 
66       Height          =   1215
67       Left            =   3720
68       TabIndex        =   2
69       Top             =   4200
70       Width           =   3615
71       _Version        =   65536
72       _ExtentX        =   6376
73       _ExtentY        =   2143
74       _StockProps     =   14
75       Caption         =   "Other options"
76       ForeColor       =   0
77       Begin VB.CheckBox check_netroom 
78          Appearance      =   0  'Flat
79          BackColor       =   &H00C0C0C0&
80          Caption         =   "Network shared room"
81          ForeColor       =   &H80000008&
82          Height          =   255
83          Left            =   120
84          TabIndex        =   3
85          Top             =   360
86          Width           =   3375
87       End
88    End
89    Begin Threed.SSFrame Frame3D8 
90       Height          =   1215
91       Left            =   120
92       TabIndex        =   24
93       Top             =   4200
94       Width           =   3495
95       _Version        =   65536
96       _ExtentX        =   6165
97       _ExtentY        =   2143
98       _StockProps     =   14
99       Caption         =   "Anonymous messages"
100       ForeColor       =   0
101       Begin VB.OptionButton radio_anonoption 
102          Appearance      =   0  'Flat
103          BackColor       =   &H00C0C0C0&
104          Caption         =   "Prompt users for anonymity"
105          ForeColor       =   &H80000008&
106          Height          =   255
107          Left            =   120
108          TabIndex        =   27
109          Top             =   840
110          Width           =   3255
111       End
112       Begin VB.OptionButton radio_anononly 
113          Appearance      =   0  'Flat
114          BackColor       =   &H00C0C0C0&
115          Caption         =   "All messages anonymous"
116          ForeColor       =   &H80000008&
117          Height          =   255
118          Left            =   120
119          TabIndex        =   26
120          Top             =   600
121          Width           =   3255
122       End
123       Begin VB.OptionButton radio_noAnon 
124          Appearance      =   0  'Flat
125          BackColor       =   &H00C0C0C0&
126          Caption         =   "No anonymous messages"
127          ForeColor       =   &H80000008&
128          Height          =   255
129          Left            =   120
130          TabIndex        =   25
131          Top             =   360
132          Width           =   3255
133       End
134    End
135    Begin VB.TextBox RoomAide 
136       Alignment       =   2  'Center
137       Appearance      =   0  'Flat
138       BackColor       =   &H00C0C0C0&
139       BorderStyle     =   0  'None
140       BeginProperty Font 
141          name            =   "MS Sans Serif"
142          charset         =   0
143          weight          =   700
144          size            =   9.75
145          underline       =   0   'False
146          italic          =   0   'False
147          strikethrough   =   0   'False
148       EndProperty
149       Height          =   285
150       Left            =   3840
151       TabIndex        =   23
152       Text            =   "Room Aide"
153       Top             =   3720
154       Width           =   3375
155    End
156    Begin Threed.SSFrame Frame3D7 
157       Height          =   615
158       Left            =   3720
159       TabIndex        =   22
160       Top             =   3480
161       Width           =   3615
162       _Version        =   65536
163       _ExtentX        =   6376
164       _ExtentY        =   1085
165       _StockProps     =   14
166       Caption         =   "Room Aide"
167       ForeColor       =   0
168    End
169    Begin Threed.SSFrame Frame3D6 
170       Height          =   615
171       Left            =   3720
172       TabIndex        =   21
173       Top             =   2640
174       Width           =   3615
175       _Version        =   65536
176       _ExtentX        =   6376
177       _ExtentY        =   1085
178       _StockProps     =   14
179       Caption         =   "Directory name"
180       ForeColor       =   0
181    End
182    Begin Threed.SSFrame Frame3D5 
183       Height          =   1455
184       Left            =   120
185       TabIndex        =   16
186       Top             =   2640
187       Width           =   3495
188       _Version        =   65536
189       _ExtentX        =   6165
190       _ExtentY        =   2566
191       _StockProps     =   14
192       Caption         =   "Directory options"
193       ForeColor       =   0
194       Begin VB.CheckBox check_visdir 
195          Appearance      =   0  'Flat
196          BackColor       =   &H00C0C0C0&
197          Caption         =   "Visible directory"
198          ForeColor       =   &H80000008&
199          Height          =   255
200          Left            =   120
201          TabIndex        =   20
202          Top             =   1080
203          Width           =   3255
204       End
205       Begin VB.CheckBox check_download 
206          Appearance      =   0  'Flat
207          BackColor       =   &H00C0C0C0&
208          Caption         =   "Downloading allowed"
209          ForeColor       =   &H80000008&
210          Height          =   255
211          Left            =   120
212          TabIndex        =   19
213          Top             =   840
214          Width           =   3255
215       End
216       Begin VB.CheckBox check_uploading 
217          Appearance      =   0  'Flat
218          BackColor       =   &H00C0C0C0&
219          Caption         =   "Uploading allowed"
220          ForeColor       =   &H80000008&
221          Height          =   255
222          Left            =   120
223          TabIndex        =   18
224          Top             =   600
225          Width           =   3255
226       End
227       Begin VB.CheckBox check_directory 
228          Appearance      =   0  'Flat
229          BackColor       =   &H00C0C0C0&
230          Caption         =   "Enable as a directory room"
231          ForeColor       =   &H80000008&
232          Height          =   255
233          Left            =   120
234          TabIndex        =   17
235          Top             =   360
236          Width           =   3255
237       End
238    End
239    Begin Threed.SSFrame Frame3D4 
240       Height          =   975
241       Left            =   3720
242       TabIndex        =   13
243       Top             =   1560
244       Width           =   3615
245       _Version        =   65536
246       _ExtentX        =   6376
247       _ExtentY        =   1720
248       _StockProps     =   14
249       Caption         =   "Access options"
250       ForeColor       =   0
251       Begin VB.CheckBox CurrForget 
252          Appearance      =   0  'Flat
253          BackColor       =   &H00C0C0C0&
254          Caption         =   "Cause users to forget room"
255          ForeColor       =   &H80000008&
256          Height          =   255
257          Left            =   120
258          TabIndex        =   15
259          Top             =   600
260          Width           =   3375
261       End
262       Begin VB.CheckBox PrefOnly 
263          Appearance      =   0  'Flat
264          BackColor       =   &H00C0C0C0&
265          Caption         =   "Preferred users only"
266          ForeColor       =   &H80000008&
267          Height          =   255
268          Left            =   120
269          TabIndex        =   14
270          Top             =   360
271          Width           =   3375
272       End
273    End
274    Begin Threed.SSFrame PWframe 
275       Height          =   615
276       Left            =   3720
277       TabIndex        =   11
278       Top             =   840
279       Width           =   3615
280       _Version        =   65536
281       _ExtentX        =   6376
282       _ExtentY        =   1085
283       _StockProps     =   14
284       Caption         =   "Password"
285       ForeColor       =   0
286       Begin VB.TextBox Password 
287          Alignment       =   2  'Center
288          Appearance      =   0  'Flat
289          BackColor       =   &H00C0C0C0&
290          BorderStyle     =   0  'None
291          BeginProperty Font 
292             name            =   "MS Sans Serif"
293             charset         =   0
294             weight          =   700
295             size            =   9.75
296             underline       =   0   'False
297             italic          =   0   'False
298             strikethrough   =   0   'False
299          EndProperty
300          Height          =   285
301          Left            =   120
302          TabIndex        =   12
303          Text            =   "Password"
304          Top             =   240
305          Width           =   3375
306       End
307    End
308    Begin Threed.SSFrame Frame3D2 
309       Height          =   1695
310       Left            =   120
311       TabIndex        =   6
312       Top             =   840
313       Width           =   3495
314       _Version        =   65536
315       _ExtentX        =   6165
316       _ExtentY        =   2990
317       _StockProps     =   14
318       Caption         =   "Access"
319       ForeColor       =   0
320       Begin VB.OptionButton radio_invonly 
321          Appearance      =   0  'Flat
322          BackColor       =   &H00C0C0C0&
323          Caption         =   "Invitation only"
324          ForeColor       =   &H80000008&
325          Height          =   255
326          Left            =   120
327          TabIndex        =   10
328          Top             =   1080
329          Width           =   1935
330       End
331       Begin VB.OptionButton radio_passworded 
332          Appearance      =   0  'Flat
333          BackColor       =   &H00C0C0C0&
334          Caption         =   "Accessible using a password"
335          ForeColor       =   &H80000008&
336          Height          =   255
337          Left            =   120
338          TabIndex        =   9
339          Top             =   840
340          Width           =   3255
341       End
342       Begin VB.OptionButton radio_guessname 
343          Appearance      =   0  'Flat
344          BackColor       =   &H00C0C0C0&
345          Caption         =   "Accessible by guessing room name"
346          ForeColor       =   &H80000008&
347          Height          =   255
348          Left            =   120
349          TabIndex        =   8
350          Top             =   600
351          Width           =   3255
352       End
353       Begin VB.OptionButton radio_public 
354          Appearance      =   0  'Flat
355          BackColor       =   &H00C0C0C0&
356          Caption         =   "Public"
357          ForeColor       =   &H80000008&
358          Height          =   255
359          Left            =   120
360          TabIndex        =   7
361          Top             =   360
362          Width           =   1935
363       End
364    End
365    Begin VB.CommandButton cancel_button 
366       Appearance      =   0  'Flat
367       BackColor       =   &H80000005&
368       Caption         =   "&Cancel"
369       Height          =   492
370       Left            =   6120
371       TabIndex        =   0
372       Top             =   5520
373       Width           =   1212
374    End
375    Begin VB.CommandButton save_button 
376       Appearance      =   0  'Flat
377       BackColor       =   &H80000005&
378       Caption         =   "&Save"
379       Height          =   492
380       Left            =   4800
381       TabIndex        =   1
382       Top             =   5520
383       Width           =   1212
384    End
385    Begin Threed.SSFrame Frame3D1 
386       Height          =   735
387       Left            =   120
388       TabIndex        =   4
389       Top             =   0
390       Width           =   7215
391       _Version        =   65536
392       _ExtentX        =   12726
393       _ExtentY        =   1296
394       _StockProps     =   14
395       Caption         =   "Room Name"
396       ForeColor       =   0
397       Begin VB.TextBox RoomName 
398          Alignment       =   2  'Center
399          Appearance      =   0  'Flat
400          BackColor       =   &H00C0C0C0&
401          BorderStyle     =   0  'None
402          BeginProperty Font 
403             name            =   "MS Sans Serif"
404             charset         =   0
405             weight          =   700
406             size            =   12
407             underline       =   0   'False
408             italic          =   0   'False
409             strikethrough   =   0   'False
410          EndProperty
411          Height          =   375
412          Left            =   120
413          TabIndex        =   5
414          Text            =   "Room Name"
415          Top             =   240
416          Width           =   6975
417       End
418    End
419 End
420 Attribute VB_Name = "EditRoom"
421 Attribute VB_Creatable = False
422 Attribute VB_Exposed = False
423 Dim roomFlags&
424
425 Private Sub cancel_button_Click()
426     Unload EditRoom
427     Load RoomPrompt
428 End Sub
429
430 Private Sub check_directory_Click()
431         If check_directory.Value = 1 Then
432             check_uploading.Enabled = True
433             check_download.Enabled = True
434             check_visdir.Enabled = True
435             DirName.Enabled = True
436         Else
437             check_uploading.Enabled = False
438             check_download.Enabled = False
439             check_visdir.Enabled = False
440             DirName.Enabled = True
441             End If
442
443 End Sub
444
445 Private Sub DirName_Change()
446
447 If Len(DirName.Text) > 14 Then DirName.Text = Left$(DirName.Text, 14)
448
449 End Sub
450
451 Private Sub Form_Load()
452     Show
453     EditRoom.WindowState = 0
454     EditRoom.Top = Int((MainWin.Height - EditRoom.Height) / 3)
455     EditRoom.Left = Int((MainWin.Width - EditRoom.Width) / 2)
456     DoEvents
457
458     a$ = "        "
459
460     If begin_trans() = True Then
461         serv_puts ("GETR")
462         a$ = serv_gets()
463         serv_puts ("GETA")
464         b$ = serv_gets()
465         Call end_trans
466
467         If Left$(a$, 1) <> "2" Then GoTo no_access
468         a$ = Right$(a$, Len(a$) - 4)
469         RoomName.Text = extract$(a$, 0)
470         Password.Text = extract$(a$, 1)
471         DirName.Text = extract$(a$, 2)
472         roomFlags& = Val(extract$(a$, 3))
473         
474         If Left$(b$, 1) = "2" Then
475             b$ = Right$(b$, Len(b$) - 4)
476             RoomAide.Text = extract$(b$, 0)
477         Else
478             RoomAide.Text = ""
479             End If
480
481         pr& = roomFlags& And 4      ' Private
482         gn& = roomFlags& And 16     ' GuessName
483         pw& = roomFlags& And 8      ' Passworded
484
485         Radio_Public.Value = False
486         Radio_Guessname.Value = False
487         Radio_Passworded.Value = False
488         Radio_InvOnly.Value = False
489
490         If pr& = 0 Then Radio_Public.Value = True
491         If pr& = 4 And gn& = 16 Then Radio_Guessname.Value = True
492         If pr& = 4 And pw& = 8 Then
493             Radio_Passworded.Value = True
494             Password.Enabled = True
495         Else
496             Password.Enabled = False
497             End If
498         If pr& = 4 And gn& = 0 And pw& = 0 Then Radio_InvOnly.Value = True
499
500         If roomFlags& And 4096 Then
501             PrefOnly.Value = 1
502         Else
503             PrefOnly.Value = 0
504             End If
505
506         If roomFlags& And 2048 Then
507             check_netroom.Value = 1
508         Else
509             check_netroom.Value = 0
510             End If
511
512         If roomFlags& And 32 Then
513             check_directory.Value = 1
514             check_uploading.Enabled = True
515             check_download.Enabled = True
516             check_visdir.Enabled = True
517             DirName.Enabled = True
518         Else
519             check_directory.Value = 0
520             check_uploading.Enabled = False
521             check_download.Enabled = False
522             check_visdir.Enabled = False
523             DirName.Enabled = True
524             End If
525         check_uploading.Value = (roomFlags& And 64) / 64
526         check_download.Value = (roomFlags& And 128) / 128
527         check_visdir.Value = (roomFlags& And 256) / 256
528
529         If roomFlags& And 512 Then Radio_AnonOnly.Value = True
530         If roomFlags& And 1024 Then Radio_AnonOption.Value = True
531         If (roomFlags& And (512 Or 1024)) = 0 Then radio_NoAnon.Value = True
532
533         check_readonly.Value = (roomFlags& And 8192) / 8192
534
535         save_button_enabled = True
536         End If
537         GoTo end_load_edit
538 no_access:
539         save_button.Enabled = False
540         MsgBox Right$(a$, Len(a$) - 4), 16, "Error"
541 end_load_edit:
542
543 End Sub
544
545 Private Sub Password_Change()
546 If Len(Password.Text) > 9 Then Password.Text = Left$(Password.Text, 9)
547 End Sub
548
549 Private Sub radio_guessname_Click()
550     If Radio_Public.Value = False Then
551         CurrForget.Enabled = True
552     Else
553         CurrForget.Value = 0
554         CurrForget.Enabled = False
555         End If
556
557 End Sub
558
559 Private Sub radio_invonly_Click()
560     If Radio_Public.Value = False Then
561         CurrForget.Enabled = True
562     Else
563         CurrForget.Value = 0
564         CurrForget.Enabled = False
565         End If
566
567 End Sub
568
569 Private Sub radio_passworded_Click()
570     
571     pwframe.Enabled = Radio_Passworded.Value
572     Password.Enabled = Radio_Passworded.Value
573     If Radio_Public.Value = False Then
574         CurrForget.Enabled = True
575     Else
576         CurrForget.Value = 0
577         CurrForget.Enabled = False
578         End If
579
580 End Sub
581
582 Private Sub radio_public_Click()
583
584     If Radio_Public.Value = False Then
585         CurrForget.Enabled = True
586     Else
587         CurrForget.Value = 0
588         CurrForget.Enabled = False
589         End If
590
591 End Sub
592
593 Private Sub RoomName_Change()
594
595 If Len(RoomName.Text) > 19 Then RoomName.Text = Left$(RoomName.Text, 19)
596
597 End Sub
598
599 Private Sub save_button_Click()
600
601     unload_ok% = 0
602
603     roomFlags& = roomFlags& Or 4 Or 8 Or 16
604     If Radio_Public.Value = True Then roomFlags& = roomFlags& - 4 - 8 - 16
605     If Radio_Guessname.Value = True Then roomFlags& = roomFlags& - 8
606     If Radio_Passworded.Value = True Then roomFlags& = roomFlags& - 16
607     If Radio_InvOnly.Value = True Then roomFlags& = roomFlags& - 8 - 16
608
609     roomFlags& = (roomFlags& Or 32 Or 64 Or 128 Or 256) - 32 - 64 - 128 - 256
610     roomFlags& = roomFlags& Or (check_directory.Value * 32)
611     roomFlags& = roomFlags& Or (check_uploading.Value * 64)
612     roomFlags& = roomFlags& Or (check_download.Value * 128)
613     roomFlags& = roomFlags& Or (check_visdir.Value * 256)
614
615     roomFlags& = (roomFlags& Or 512 Or 1024) - 512 - 1024
616     If Radio_AnonOnly.Value = True Then roomFlags& = roomFlags& Or 512
617     If Radio_AnonOption.Value = True Then roomFlags& = roomFlags& Or 1024
618
619     roomFlags& = (roomFlags& Or 2048) - 2048
620     roomFlags& = roomFlags& Or (check_netroom.Value * 2048)
621
622     roomFlags& = (roomFlags& Or 4096) - 4096
623     roomFlags& = roomFlags& Or (PrefOnly.Value * 4096)
624
625     roomFlags& = (roomFlags& Or 8192) - 8192
626     roomFlags& = roomFlags& Or (check_readonly.Value * 8192)
627
628     If begin_trans() = True Then
629         unload_ok% = 1
630         rf$ = Str$(roomFlags&)
631         rf$ = Right$(rf$, Len(rf$) - 1)
632         cf$ = Str$(CurrForget.Value)
633         cf$ = Right$(cf$, Len(cf$) - 1)
634         a$ = "SETR " + RoomName.Text + "|" + Password.Text + "|" + DirName.Text + "|" + rf$ + "|" + cf$
635         serv_puts (a$)
636         a$ = serv_gets()
637         
638         serv_puts ("SETA " + RoomAide.Text)
639         b$ = serv_gets()
640         Call end_trans
641
642         If Left$(a$, 1) <> "2" Then
643             unload_ok% = 0
644             MsgBox Right$(a$, Len(a$) - 4), 16, "Error"
645         Else
646             CurrRoomName$ = RoomName.Text
647             End If
648
649         If Left$(b$, 1) <> "2" Then
650             unload_ok% = 0
651             MsgBox Right$(b$, Len(b$) - 4), 16, "Error"
652             End If
653         End If
654
655     If unload_ok% = 1 Then
656         Unload EditRoom
657         Load RoomPrompt
658         End If
659
660 End Sub
661