File: Services.cc

package info (click to toggle)
postman 2.1-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,248 kB
  • ctags: 3,249
  • sloc: cpp: 33,376; ansic: 2,014; sh: 768; makefile: 300
file content (592 lines) | stat: -rw-r--r-- 31,361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
/*                               
Services.cc
*/

#include "Services.h"

//main         --> Service for display login page
//cclient      --> Service for imap
//nntp         --> Service for nntp (virtual, depends of cclient)
//poppass      --> Service for change password
//databases    --> Service for databases
//finger       --> Service for finger other hosts
//secvirtual   --> Service for students administrative questions (University of Valencia)
//filebrowser  --> Service for File Explorer (in server disk or samba mounted disk, by example)
//personaldata --> Service for retrieve Personal Data
//useraccounts --> Service for user account administration (University of Valencia)
//config       --> Service for handle Postman Configuration
//sieve        --> Service for mail: filters, vacation.
//calendar     --> Service for calendar
//dotlearn     --> Service for students and teachers: frontend to elearning  (University of Valencia)
//ldap         --> Service for LDAP actions: authenticate, ...

int TranslateService (const char *stservice)
  {
  if (IsEmpty(stservice))                         {return iSERVICE_MAIN;}
  TBuffer uplinea;
  xstrncpy (uplinea, CMAXBUFFER, stservice); xucase (uplinea);
  if (IsEmpty(uplinea) == true)                   {return iSERVICE_MAIN;}
  if (strcmp (uplinea, "MAIN")   == 0)            {return iSERVICE_MAIN;}  
  if (strcmp (uplinea, "CCLIENT")== 0)            {return iSERVICE_CCLIENT;}
  if (strcmp (uplinea, "POPPASS")== 0)            {return iSERVICE_POPPASS;}  
  if (strcmp (uplinea, "DATABASES")== 0)          {return iSERVICE_DATABASES;}    
  if (strcmp (uplinea, "FINGER")== 0)             {return iSERVICE_FINGER;}    
  if (strcmp (uplinea, "FILEBROWSER")== 0)        {return iSERVICE_FILEBROWSER;}    
  if (strcmp (uplinea, "FORWARDMAIL")== 0)        {return iSERVICE_FORWARDMAIL;}      
  if (strcmp (uplinea, "SECVIRTUAL")== 0)         {return iSERVICE_SECVIRTUAL;}          
  if (strcmp (uplinea, "PERSONALDATA")== 0)       {return iSERVICE_PERSONALDATA;}      
  if (strcmp (uplinea, "USERACCOUNTS")== 0)       {return iSERVICE_USERACCOUNTS;}              
  if (strcmp (uplinea, "CONFIG")== 0)             {return iSERVICE_CONFIG;}                
  if (strcmp (uplinea, "SIEVE")== 0)              {return iSERVICE_SIEVE;}                  
  if (strcmp (uplinea, "CALENDAR")== 0)           {return iSERVICE_CALENDAR;}          
  if (strcmp (uplinea, "DOTLEARN")== 0)           {return iSERVICE_DOTLEARN;}
  if (strcmp (uplinea, "LDAP")== 0)               {return iSERVICE_LDAP;}
  return iSERVICE_INVALID;                
  }

const char *TranslateServiceR (int service)
  {
  switch (service)
    {
    case iSERVICE_MAIN:          return SERVICE_MAIN; break;
    case iSERVICE_CCLIENT:       return SERVICE_CCLIENT; break;
    case iSERVICE_POPPASS:       return SERVICE_POPPASS; break;    
    case iSERVICE_DATABASES:     return SERVICE_DATABASES; break;        
    case iSERVICE_FINGER:        return SERVICE_FINGER; break;        
    case iSERVICE_FILEBROWSER:   return SERVICE_FILEBROWSER; break; 
    case iSERVICE_FORWARDMAIL:   return SERVICE_FORWARDMAIL; break;            
    case iSERVICE_SECVIRTUAL:    return SERVICE_SECVIRTUAL; break; 
    case iSERVICE_PERSONALDATA:  return SERVICE_PERSONALDATA; break;     
    case iSERVICE_USERACCOUNTS:  return SERVICE_USERACCOUNTS; break;         
    case iSERVICE_CONFIG:        return SERVICE_CONFIG; break;             
    case iSERVICE_SIEVE:         return SERVICE_SIEVE; break;                 
    case iSERVICE_CALENDAR:      return SERVICE_CALENDAR; break;                     
    case iSERVICE_DOTLEARN:      return SERVICE_DOTLEARN; break; 
    case iSERVICE_LDAP:          return SERVICE_LDAP; break;     
    default:                     return SERVICE_MAIN; break;
    }
  }

int TranslateCmd (int service, const char *stcmd)
  {
  if ((service == iSERVICE_INVALID) || (IsEmpty(stcmd))) return CMD_SPECIAL_INVALID;
  TBuffer uplinea;
  xstrncpy (uplinea, CMAXBUFFER, stcmd); xucase (uplinea);

  if (IsEmpty(uplinea)                   == true) {return CMD_SPECIAL_INVALID;}
  if (strcmp (uplinea, "CHECK_COOKIE")   == 0)    {return CMD_SPECIAL_CHECK_COOKIE;}  
  if (strcmp (uplinea, "CONF_ACT")       == 0)    {return CMD_MAIN_CONF_ACT;}
  if (strcmp (uplinea, "HOME")           == 0)    {return CMD_MAIN_HOME;}  
  if (strcmp (uplinea, "ROOT")           == 0)    {return CMD_MAIN_ROOT;}  
  if (strcmp (uplinea, "LOGIN")          == 0)    {return CMD_MAIN_LOGIN;}
  if (strcmp (uplinea, "LOGOUT")         == 0)    {return CMD_MAIN_LOGOUT;}
  if (strcmp (uplinea, "HELP")           == 0)    {return CMD_MAIN_HELP;}
  if (strcmp (uplinea, "ABOUT")          == 0)    {return CMD_MAIN_ABOUT;}
  if (strcmp (uplinea, "RECONNECT")      == 0)    {return CMD_MAIN_RECONNECT;}
    
  switch (service)
    {
    case iSERVICE_CCLIENT:  
      if (strcmp (uplinea, "MG_DUMPFULLMSG") == 0)    {return CMD_CCLIENT_MG_DUMPFULLMSG;}
      if (strcmp (uplinea, "MG_DUMPFULLHEADER") == 0) {return CMD_CCLIENT_MG_DUMPFULLHEADER;} 
      if (strcmp (uplinea, "MG_DISPLAY")     == 0)    {return CMD_CCLIENT_MG_DISPLAY;}
      if (strcmp (uplinea, "MG_COPY")        == 0)    {return CMD_CCLIENT_MG_COPY;}
      if (strcmp (uplinea, "MG_MOVE")        == 0)    {return CMD_CCLIENT_MG_MOVE;}
      if (strcmp (uplinea, "MG_DELDISPLAY")  == 0)    {return CMD_CCLIENT_MG_DELDISPLAY;}
      if (strcmp (uplinea, "MG_UNDELDISPLAY")== 0)    {return CMD_CCLIENT_MG_UNDELDISPLAY;}  
      if (strcmp (uplinea, "MB_INDEX")       == 0)    {return CMD_CCLIENT_MB_INDEX;}
      if (strcmp (uplinea, "MB_SHOW")        == 0)    {return CMD_CCLIENT_MB_SHOW;}
      if (strcmp (uplinea, "MB_CHANGE")      == 0)    {return CMD_CCLIENT_MB_CHANGE;}
      if (strcmp (uplinea, "MB_CREATE")      == 0)    {return CMD_CCLIENT_MB_CREATE;}
      if (strcmp (uplinea, "MB_DELETE")      == 0)    {return CMD_CCLIENT_MB_DELETE;}
      if (strcmp (uplinea, "MB_CLEAR")       == 0)    {return CMD_CCLIENT_MB_CLEAR;}      
      if (strcmp (uplinea, "MB_RENAME")      == 0)    {return CMD_CCLIENT_MB_RENAME;}
      if (strcmp (uplinea, "MB_EXPUNGE")     == 0)    {return CMD_CCLIENT_MB_EXPUNGE;}
      if (strcmp (uplinea, "MB_DUMP")        == 0)    {return CMD_CCLIENT_MB_DUMP;}  
      if (strcmp (uplinea, "MB_SEARCH")      == 0)    {return CMD_CCLIENT_MB_SEARCH;}    
      if (strcmp (uplinea, "FG_DELETE")      == 0)    {return CMD_CCLIENT_FG_DELETE;}
      if (strcmp (uplinea, "FG_UNDELETE")    == 0)    {return CMD_CCLIENT_FG_UNDELETE;}
      if (strcmp (uplinea, "FG_ANSWERED")    == 0)    {return CMD_CCLIENT_FG_ANSWERED;}
      if (strcmp (uplinea, "FG_UNANSWERED")  == 0)    {return CMD_CCLIENT_FG_UNANSWERED;}
      if (strcmp (uplinea, "FG_FLAGGED")     == 0)    {return CMD_CCLIENT_FG_FLAGGED;}
      if (strcmp (uplinea, "FG_UNFLAGGED")   == 0)    {return CMD_CCLIENT_FG_UNFLAGGED;}
      if (strcmp (uplinea, "FG_SEEN")        == 0)    {return CMD_CCLIENT_FG_SEEN;}
      if (strcmp (uplinea, "FG_UNSEEN")      == 0)    {return CMD_CCLIENT_FG_UNSEEN;}
      if (strcmp (uplinea, "CM")             == 0)    {return CMD_CCLIENT_CM;}
      if (strcmp (uplinea, "CMNNTP")         == 0)    {return CMD_CCLIENT_CMNNTP;}  
      if (strcmp (uplinea, "CM_SEND")        == 0)    {return CMD_CCLIENT_CM_SEND;}
      if (strcmp (uplinea, "CM_SENDNNTP")    == 0)    {return CMD_CCLIENT_CM_SENDNNTP;}  
      if (strcmp (uplinea, "CM_CANCEL")      == 0)    {return CMD_CCLIENT_CM_CANCEL;}
      if (strcmp (uplinea, "CM_REPLY")       == 0)    {return CMD_CCLIENT_CM_REPLY;}
      if (strcmp (uplinea, "CM_REPLYALL")    == 0)    {return CMD_CCLIENT_CM_REPLYALL;}
      if (strcmp (uplinea, "CM_REPLYGROUP")  == 0)    {return CMD_CCLIENT_CM_REPLYGROUP;}  
      if (strcmp (uplinea, "CM_FORWARD")     == 0)    {return CMD_CCLIENT_CM_FORWARD;}
      if (strcmp (uplinea, "CM_CLEANALL")    == 0)    {return CMD_CCLIENT_CM_CLEANALL;}
      if (strcmp (uplinea, "CM_SAVE")        == 0)    {return CMD_CCLIENT_CM_SAVE;}  
      if (strcmp (uplinea, "AT_SHOW")        == 0)    {return CMD_CCLIENT_AT_SHOW;}
      if (strcmp (uplinea, "AT_DUMP")        == 0)    {return CMD_CCLIENT_AT_DUMP;}
      if (strcmp (uplinea, "AT_SAVE")        == 0)    {return CMD_CCLIENT_AT_SAVE;}  
      if (strcmp (uplinea, "AT_ERASE")       == 0)    {return CMD_CCLIENT_AT_ERASE;}
      if (strcmp (uplinea, "AB")             == 0)    {return CMD_CCLIENT_AB;}
      if (strcmp (uplinea, "AB_SHOWALL")     == 0)    {return CMD_CCLIENT_AB_SHOWALL;}
      if (strcmp (uplinea, "AB_SAVEENTRY")   == 0)    {return CMD_CCLIENT_AB_SAVEENTRY;}
      if (strcmp (uplinea, "AB_EDITENTRY")   == 0)    {return CMD_CCLIENT_AB_EDITENTRY;}
      if (strcmp (uplinea, "AB_DELEENTRIES") == 0)    {return CMD_CCLIENT_AB_DELEENTRIES;}
      if (strcmp (uplinea, "AB_NEWENTRY")    == 0)    {return CMD_CCLIENT_AB_NEWENTRY;}
      if (strcmp (uplinea, "AB_SORT")        == 0)    {return CMD_CCLIENT_AB_SORT;}
      if (strcmp (uplinea, "AB_FROM_CM")     == 0)    {return CMD_CCLIENT_AB_FROM_CM;}
      if (strcmp (uplinea, "AB_TAKEADDRESS") == 0)    {return CMD_CCLIENT_AB_TAKEADDRESS;}
      if (strcmp (uplinea, "AB_ADDFIELDS")   == 0)    {return CMD_CCLIENT_AB_ADDFIELDS;}  
      if (strcmp (uplinea, "AB_DUMP")        == 0)    {return CMD_CCLIENT_AB_DUMP;}  
      if (strcmp (uplinea, "NOOP")           == 0)    {return CMD_SPECIAL_NOOP;}    
      if (strcmp (uplinea, "DEBUG")          == 0)    {return CMD_SPECIAL_DEBUG;}      
      if (strcmp (uplinea, "MB_SORT")        == 0)    {return CMD_CCLIENT_MB_SORT;}        
      if (strcmp (uplinea, "MG_FG_DELETE")    == 0)   {return CMD_CCLIENT_MG_FG_DELETE;}        
      if (strcmp (uplinea, "MG_FG_UNDELETE")  == 0)   {return CMD_CCLIENT_MG_FG_UNDELETE;}        
      if (strcmp (uplinea, "MG_FG_ANSWERED")  == 0)   {return CMD_CCLIENT_MG_FG_ANSWERED;}        
      if (strcmp (uplinea, "MG_FG_UNANSWERED")== 0)   {return CMD_CCLIENT_MG_FG_UNANSWERED;}        
      if (strcmp (uplinea, "MG_FG_FLAGGED")   == 0)   {return CMD_CCLIENT_MG_FG_FLAGGED;}        
      if (strcmp (uplinea, "MG_FG_UNFLAGGED") == 0)   {return CMD_CCLIENT_MG_FG_UNFLAGGED;}        
      if (strcmp (uplinea, "MG_FG_SEEN")      == 0)   {return CMD_CCLIENT_MG_FG_SEEN;}        
      if (strcmp (uplinea, "MG_FG_UNSEEN")    == 0)   {return CMD_CCLIENT_MG_FG_UNSEEN;}        
      if (strcmp (uplinea, "MG_FG_SEARCHED")  == 0)   {return CMD_CCLIENT_MG_FG_SEARCHED;}        
      if (strcmp (uplinea, "MG_FG_UNSEARCHED")== 0)   {return CMD_CCLIENT_MG_FG_UNSEARCHED;}          
      if (strcmp (uplinea, "BD_UUDECODE")== 0)        {return CMD_CCLIENT_BD_UUDECODE;}        
      if (strcmp (uplinea, "NW_LIST_DUMP")== 0)       {return CMD_CCLIENT_NW_LIST_DUMP;}
      if (strcmp (uplinea, "NW_SUBSCRIBED")== 0)      {return CMD_CCLIENT_NW_SUBSCRIBED;}      
      return CMD_SPECIAL_INVALID;
      break;
    case iSERVICE_POPPASS: 
      if (strcmp (uplinea, "DISPLAYPAGE")== 0)        {return CMD_POPPASS_DISPLAYPAGE;}
      if (strcmp (uplinea, "CHANGEPW")== 0)           {return CMD_POPPASS_CHANGEPW;}
      return CMD_SPECIAL_INVALID;
      break;
    case iSERVICE_DATABASES: 
      if (strcmp (uplinea, "DISPLAYPAGE")== 0)        {return CMD_DATABASES_DISPLAYPAGE;}
      if (strcmp (uplinea, "DISPLAYRECORD")== 0)      {return CMD_DATABASES_DISPLAYRECORD;}      
      if (strcmp (uplinea, "COPY")== 0)               {return CMD_DATABASES_COPY;}
      if (strcmp (uplinea, "DUPLICATE")== 0)          {return CMD_DATABASES_DUPLICATE;}      
      if (strcmp (uplinea, "CUT")== 0)                {return CMD_DATABASES_CUT;}      
      if (strcmp (uplinea, "PASTE")== 0)              {return CMD_DATABASES_PASTE;}
      if (strcmp (uplinea, "DELETE")== 0)             {return CMD_DATABASES_DELETE;}                                   
      if (strcmp (uplinea, "UNDELETE")== 0)           {return CMD_DATABASES_UNDELETE;} 
      if (strcmp (uplinea, "NEWRECORD")== 0)          {return CMD_DATABASES_NEWRECORD;}                             
      if (strcmp (uplinea, "EDIT")== 0)               {return CMD_DATABASES_EDIT;}                       
      if (strcmp (uplinea, "SYNC")== 0)               {return CMD_DATABASES_SYNC;}                             
      if (strcmp (uplinea, "EDITSAVE")== 0)           {return CMD_DATABASES_EDITSAVE;}                                   
      if (strcmp (uplinea, "EDITSHOW")== 0)           {return CMD_DATABASES_EDITSHOW;}                                         
      if (strcmp (uplinea, "SORT")== 0)               {return CMD_DATABASES_SORT;}                                               
      if (strcmp (uplinea, "SEARCH")== 0)             {return CMD_DATABASES_SEARCH;}                                  
      if (strcmp (uplinea, "DB_EXPUNGE")== 0)         {return CMD_DATABASES_DB_EXPUNGE;}
      if (strcmp (uplinea, "DB_OPEN")== 0)            {return CMD_DATABASES_DB_OPEN;}      
      if (strcmp (uplinea, "GO")== 0)                 {return CMD_DATABASES_GO;}
      if (strcmp (uplinea, "MAINPAGE")== 0)           {return CMD_DATABASES_MAINPAGE;}
      if (strcmp (uplinea, "DB_CREATE")== 0)          {return CMD_DATABASES_DB_CREATE;}
      if (strcmp (uplinea, "DB_RENAME")== 0)          {return CMD_DATABASES_DB_RENAME;}
      if (strcmp (uplinea, "DB_DELETE")== 0)          {return CMD_DATABASES_DB_DELETE;}
      if (strcmp (uplinea, "DB_CONFDELETE")== 0)      {return CMD_DATABASES_DB_CONFDELETE;}      
      if (strcmp (uplinea, "DB_DUMP")== 0)            {return CMD_DATABASES_DB_DUMP;}
      if (strcmp (uplinea, "DB_IMPORT")== 0)          {return CMD_DATABASES_DB_IMPORT;}
      if (strcmp (uplinea, "DB_EXPORT")== 0)          {return CMD_DATABASES_DB_EXPORT;}    
      if (strcmp (uplinea, "DB_DEFINE")== 0)          {return CMD_DATABASES_DB_DEFINE;}          
      if (strcmp (uplinea, "DELETESEARCH")== 0)       {return CMD_DATABASES_DELETESEARCH;}                
      return CMD_SPECIAL_INVALID;
      break;      
    case iSERVICE_FINGER: 
      if (strcmp (uplinea, "DISPLAYPAGE")== 0)        {return CMD_FINGER_DISPLAYPAGE;}
      if (strcmp (uplinea, "GO")== 0)                 {return CMD_FINGER_GO;}
      return CMD_SPECIAL_INVALID;
      break;            
    case iSERVICE_FILEBROWSER: 
      if (strcmp (uplinea, "DISPLAYPAGE")== 0)        {return CMD_FILEBROWSER_DISPLAYPAGE;}
      if (strcmp (uplinea, "CWDUP")== 0)              {return CMD_FILEBROWSER_CWDUP;}      
      if (strcmp (uplinea, "CWD")== 0)                {return CMD_FILEBROWSER_CWD;}            
      if (strcmp (uplinea, "DUMP")== 0)               {return CMD_FILEBROWSER_DUMP;}                  
      if (strcmp (uplinea, "EDITSHOW")== 0)           {return CMD_FILEBROWSER_EDITSHOW;}                       
      if (strcmp (uplinea, "EDITSAVE")== 0)           {return CMD_FILEBROWSER_EDITSAVE;}                             
      if (strcmp (uplinea, "EDITCANCEL")== 0)         {return CMD_FILEBROWSER_EDITCANCEL;}                             
      if (strcmp (uplinea, "CREATEITEM")== 0)         {return CMD_FILEBROWSER_CREATEITEM;}                             
      if (strcmp (uplinea, "DELETEITEM")== 0)         {return CMD_FILEBROWSER_DELETEITEM;}                                   
      if (strcmp (uplinea, "DELETEITEM_CONF")== 0)    {return CMD_FILEBROWSER_DELETEITEM_CONF;}                                   
      if (strcmp (uplinea, "LOADFILE")== 0)           {return CMD_FILEBROWSER_LOADFILE;}                                       
      if (strcmp (uplinea, "COPY")== 0)               {return CMD_FILEBROWSER_COPY;}
      if (strcmp (uplinea, "CUT")== 0)                {return CMD_FILEBROWSER_CUT;}    
      if (strcmp (uplinea, "PASTE")== 0)              {return CMD_FILEBROWSER_PASTE;}
      if (strcmp (uplinea, "RENAME")== 0)             {return CMD_FILEBROWSER_RENAME;}  
      if (strcmp (uplinea, "CWDF")== 0)               {return CMD_FILEBROWSER_CWDF;}     
      if (strcmp (uplinea, "RENAMEOK")== 0)           {return CMD_FILEBROWSER_RENAMEOK;}           
      if (strcmp (uplinea, "RENAMECANCEL")== 0)       {return CMD_FILEBROWSER_RENAMECANCEL;}        
      if (strcmp (uplinea, "SORTNAME")== 0)           {return CMD_FILEBROWSER_SORTNAME;}
      if (strcmp (uplinea, "SORTDATE")== 0)           {return CMD_FILEBROWSER_SORTDATE;}
      if (strcmp (uplinea, "SORTSIZE")== 0)           {return CMD_FILEBROWSER_SORTSIZE;}
      if (strcmp (uplinea, "CHANGEDISK")== 0)         {return CMD_FILEBROWSER_CHANGEDISK;}      
      return CMD_SPECIAL_INVALID;
      break;                  
    case iSERVICE_FORWARDMAIL: 
      if (strcmp (uplinea, "DISPLAYPAGE")== 0)        {return CMD_FORWARDMAIL_DISPLAYPAGE;}
      if (strcmp (uplinea, "ERASEALL")== 0)           {return CMD_FORWARDMAIL_ERASEALL;}
      if (strcmp (uplinea, "SET")== 0)                {return CMD_FORWARDMAIL_SET;}      
      return CMD_SPECIAL_INVALID;
      break;            
    case iSERVICE_SECVIRTUAL:
      if (strcmp (uplinea, "GOTO")== 0)               {return CMD_SECVIRTUAL_GOTO;}
      return CMD_SPECIAL_INVALID;
      break;                
    case iSERVICE_PERSONALDATA:
      return CMD_SPECIAL_INVALID;
      break;                
    case iSERVICE_USERACCOUNTS:
      if (strcmp (uplinea, "GOTO")== 0)               {return CMD_USERACCOUNTS_GOTO;}
      return CMD_SPECIAL_INVALID;
      break;                            
    case iSERVICE_CONFIG:
      if (strcmp (uplinea, "CONFIG")                  == 0) {return CMD_CONFIG;}
      if (strcmp (uplinea, "CONFIG_CANCEL")           == 0) {return CMD_CONFIG_CANCEL;}
      if (strcmp (uplinea, "CONFIG_CCLIENT")          == 0) {return CMD_CONFIG_CCLIENT;}      
      if (strcmp (uplinea, "CONFIG_CCLIENT_SAVE")     == 0) {return CMD_CONFIG_CCLIENT_SAVE;}
      if (strcmp (uplinea, "CONFIG_NNTP")             == 0) {return CMD_CONFIG_NNTP;}        
      if (strcmp (uplinea, "CONFIG_NNTP_SAVE")        == 0) {return CMD_CONFIG_NNTP_SAVE;}        
      if (strcmp (uplinea, "CONFIG_NNTP_SEARCH")      == 0) {return CMD_CONFIG_NNTP_SEARCH;}        
      if (strcmp (uplinea, "CONFIG_NNTP_ADDSELECTED") == 0) {return CMD_CONFIG_NNTP_ADDSELECTED;}        
      if (strcmp (uplinea, "CONFIG_APPEARANCE")       == 0) {return CMD_CONFIG_APPEARANCE;}      
      if (strcmp (uplinea, "CONFIG_APPEARANCE_SAVE")  == 0) {return CMD_CONFIG_APPEARANCE_SAVE;}
      return CMD_SPECIAL_INVALID;
      break;
    case iSERVICE_SIEVE: 
      if (strcmp (uplinea, "FILTERS_SHOW")== 0)             {return CMD_SIEVE_FILTERS_SHOW;}
      if (strcmp (uplinea, "FILTERS_EDIT")== 0)             {return CMD_SIEVE_FILTERS_EDIT;}
      if (strcmp (uplinea, "FILTERS_CREATE")== 0)           {return CMD_SIEVE_FILTERS_CREATE;}
      if (strcmp (uplinea, "FILTERS_DO")== 0)               {return CMD_SIEVE_FILTERS_DO;}
      if (strcmp (uplinea, "FILTERS_DELETE")== 0)           {return CMD_SIEVE_FILTERS_DELETE;}
      if (strcmp (uplinea, "FILTERS_SAVE")== 0)             {return CMD_SIEVE_FILTERS_SAVE;}
      if (strcmp (uplinea, "FILTERS_CANCEL")== 0)           {return CMD_SIEVE_FILTERS_CANCEL;}            
      if (strcmp (uplinea, "FILTERS_UP")== 0)               {return CMD_SIEVE_FILTERS_UP;}            
      if (strcmp (uplinea, "FILTERS_DOWN")== 0)             {return CMD_SIEVE_FILTERS_DOWN;}            
      if (strcmp (uplinea, "FILTERS_CONFDELETE")== 0)       {return CMD_SIEVE_FILTERS_CONFDELETE;}                  
      if (strcmp (uplinea, "FILTERS_PREDEFSPAM")== 0)       {return CMD_SIEVE_FILTERS_PREDEFSPAM;}                        
      if (strcmp (uplinea, "FILTERS_PREDEFSPAM2")== 0)      {return CMD_SIEVE_FILTERS_PREDEFSPAM2;}                              
      if (strcmp (uplinea, "VACATIONS_SHOW")== 0)           {return CMD_SIEVE_VACATIONS_SHOW;}            
      if (strcmp (uplinea, "VACATIONS_DO")== 0)             {return CMD_SIEVE_VACATIONS_DO;}            
      if (strcmp (uplinea, "VACATIONS_SAVE")== 0)           {return CMD_SIEVE_VACATIONS_SAVE;}            
      if (strcmp (uplinea, "VACATIONS_CANCEL")== 0)         {return CMD_SIEVE_VACATIONS_CANCEL;}            
      return CMD_SPECIAL_INVALID;
      break;
    case iSERVICE_CALENDAR:      
      if (strcmp (uplinea, "YEAR_SHOW")== 0)                {return CMD_CALENDAR_YEAR_SHOW;}    
      if (strcmp (uplinea, "MONTH_SHOW")== 0)               {return CMD_CALENDAR_MONTH_SHOW;}
      if (strcmp (uplinea, "WEEK_SHOW")== 0)                {return CMD_CALENDAR_WEEK_SHOW;}
      if (strcmp (uplinea, "DAY_SHOW")== 0)                 {return CMD_CALENDAR_DAY_SHOW;}
      if (strcmp (uplinea, "TODAY")== 0)                    {return CMD_CALENDAR_TODAY;}
      if (strcmp (uplinea, "EVENTS_CREATE")== 0)            {return CMD_CALENDAR_EVENTS_CREATE;}            
      if (strcmp (uplinea, "EVENTS_ADD")== 0)               {return CMD_CALENDAR_EVENTS_ADD;}      
      if (strcmp (uplinea, "EVENTS_MODIFY")== 0)            {return CMD_CALENDAR_EVENTS_MODIFY;}            
      if (strcmp (uplinea, "EVENTS_DELETE")== 0)            {return CMD_CALENDAR_EVENTS_DELETE;}                  
      if (strcmp (uplinea, "TOMORROW")== 0)                 {return CMD_CALENDAR_TOMORROW;}
      if (strcmp (uplinea, "YESTERDAY")== 0)                {return CMD_CALENDAR_YESTERDAY;}      
      return CMD_SPECIAL_INVALID;
      break;      
    case iSERVICE_DOTLEARN:
      if (strcmp (uplinea, "GOTO")== 0)                     {return CMD_DOTLEARN_GOTO;}
      return CMD_SPECIAL_INVALID;
      break;               
    case iSERVICE_LDAP:       
      return CMD_SPECIAL_INVALID;
      break;                   
    default:
      return CMD_SPECIAL_INVALID;
      break;
    }
  return CMD_SPECIAL_INVALID;                
  }
  
bool is_CMD_ALLOWED_ACTION (int ACTION, int service, int cmd)
  {
  switch (ACTION)
    {
    case ACTION_RECONNECT:
      {
      switch (service)
        {
        case iSERVICE_CCLIENT:
          {
          switch (cmd)
            {                             
            case CMD_CCLIENT_MG_DISPLAY: case CMD_CCLIENT_MB_INDEX: case CMD_CCLIENT_MB_CHANGE: case CMD_CCLIENT_CM:
                     {return true; break;}
            default: {return false; break;}
            }
          break;
          }
        case iSERVICE_FILEBROWSER: 
          {
          switch (cmd)
            {
            case CMD_FILEBROWSER_DISPLAYPAGE: case CMD_FILEBROWSER_CWD:                
                     {return true; break;}
            default: {return false; break;}            
            }
          break; 
          }
        case iSERVICE_USERACCOUNTS:   {return true; break;}  
        case iSERVICE_SECVIRTUAL:     {return false; break;}
        case iSERVICE_MAIN:           {return false; break;}
        case iSERVICE_POPPASS:        {return false; break;}    
        case iSERVICE_DATABASES:      {return false; break;}       
        case iSERVICE_PERSONALDATA:   {return false; break;}               
        case iSERVICE_FINGER:         {return false; break;}     
        case iSERVICE_FORWARDMAIL:    {return false; break;}
        case iSERVICE_CONFIG:         {return false; break;}        
        case iSERVICE_SIEVE:          {return false; break;}                
        case iSERVICE_CALENDAR:       {return false; break;}                        
        case iSERVICE_DOTLEARN:       {return false; break;}
        default:                      {return false; break;}                  
        }
      break;
      }
    default:
      {
      return false;
      break;  
      }
    }
  return false;
  }
  
int getiServiceFromCmd (int cmd)
  {  
  switch (cmd)
    {
    case CMD_MAIN_CONF_ACT:
    case CMD_MAIN_HOME:
    case CMD_MAIN_ROOT:
    case CMD_MAIN_LOGIN:
    case CMD_MAIN_LOGOUT:
    case CMD_MAIN_HELP:
    case CMD_MAIN_ABOUT:
    case CMD_MAIN_RECONNECT:
      {
      return iSERVICE_MAIN;
      break;
      }
    case CMD_CCLIENT_MG_DUMPFULLMSG:
    case CMD_CCLIENT_MG_DUMPFULLHEADER: 
    case CMD_CCLIENT_MG_DISPLAY:
    case CMD_CCLIENT_MG_COPY:
    case CMD_CCLIENT_MG_MOVE:
    case CMD_CCLIENT_MG_DELDISPLAY:
    case CMD_CCLIENT_MG_UNDELDISPLAY:  
    case CMD_CCLIENT_MB_INDEX:
    case CMD_CCLIENT_MB_SHOW:
    case CMD_CCLIENT_MB_CHANGE:
    case CMD_CCLIENT_MB_CREATE:
    case CMD_CCLIENT_MB_DELETE:
    case CMD_CCLIENT_MB_CLEAR:
    case CMD_CCLIENT_MB_RENAME:
    case CMD_CCLIENT_MB_EXPUNGE:
    case CMD_CCLIENT_MB_DUMP:  
    case CMD_CCLIENT_MB_SEARCH:    
    case CMD_CCLIENT_FG_DELETE:
    case CMD_CCLIENT_FG_UNDELETE:
    case CMD_CCLIENT_FG_ANSWERED:
    case CMD_CCLIENT_FG_UNANSWERED:
    case CMD_CCLIENT_FG_FLAGGED:
    case CMD_CCLIENT_FG_UNFLAGGED:
    case CMD_CCLIENT_FG_SEEN:
    case CMD_CCLIENT_FG_UNSEEN:
    case CMD_CCLIENT_CM:
    case CMD_CCLIENT_CMNNTP:  
    case CMD_CCLIENT_CM_SEND:
    case CMD_CCLIENT_CM_SENDNNTP:  
    case CMD_CCLIENT_CM_CANCEL:
    case CMD_CCLIENT_CM_REPLY:
    case CMD_CCLIENT_CM_REPLYALL:
    case CMD_CCLIENT_CM_REPLYGROUP:  
    case CMD_CCLIENT_CM_FORWARD:
    case CMD_CCLIENT_CM_CLEANALL:
    case CMD_CCLIENT_CM_SAVE:  
    case CMD_CCLIENT_AT_SHOW:
    case CMD_CCLIENT_AT_DUMP:
    case CMD_CCLIENT_AT_SAVE:  
    case CMD_CCLIENT_AT_ERASE:
    case CMD_CCLIENT_AB:
    case CMD_CCLIENT_AB_SHOWALL:
    case CMD_CCLIENT_AB_SAVEENTRY:
    case CMD_CCLIENT_AB_EDITENTRY:
    case CMD_CCLIENT_AB_DELEENTRIES:
    case CMD_CCLIENT_AB_NEWENTRY:
    case CMD_CCLIENT_AB_SORT:
    case CMD_CCLIENT_AB_FROM_CM:
    case CMD_CCLIENT_AB_TAKEADDRESS:
    case CMD_CCLIENT_AB_ADDFIELDS:  
    case CMD_CCLIENT_AB_DUMP:  
    case CMD_SPECIAL_NOOP:    
    case CMD_SPECIAL_DEBUG:      
    case CMD_CCLIENT_MB_SORT:        
    case CMD_CCLIENT_MG_FG_DELETE:        
    case CMD_CCLIENT_MG_FG_UNDELETE:        
    case CMD_CCLIENT_MG_FG_ANSWERED:        
    case CMD_CCLIENT_MG_FG_UNANSWERED:        
    case CMD_CCLIENT_MG_FG_FLAGGED:        
    case CMD_CCLIENT_MG_FG_UNFLAGGED:        
    case CMD_CCLIENT_MG_FG_SEEN:        
    case CMD_CCLIENT_MG_FG_UNSEEN:        
    case CMD_CCLIENT_MG_FG_SEARCHED:        
    case CMD_CCLIENT_MG_FG_UNSEARCHED:          
    case CMD_CCLIENT_BD_UUDECODE:        
    case CMD_CCLIENT_NW_LIST_DUMP:
      {
      return iSERVICE_CCLIENT;
      break;
      }
    case CMD_POPPASS_DISPLAYPAGE:
    case CMD_POPPASS_CHANGEPW:
      {
      return iSERVICE_POPPASS;
      break;
      }
    case CMD_DATABASES_DISPLAYPAGE:
    case CMD_DATABASES_DISPLAYRECORD:      
    case CMD_DATABASES_COPY:
    case CMD_DATABASES_DUPLICATE:      
    case CMD_DATABASES_CUT:      
    case CMD_DATABASES_PASTE:
    case CMD_DATABASES_DELETE:                                   
    case CMD_DATABASES_UNDELETE: 
    case CMD_DATABASES_NEWRECORD:                             
    case CMD_DATABASES_EDIT:                       
    case CMD_DATABASES_SYNC:                             
    case CMD_DATABASES_EDITSAVE:                                   
    case CMD_DATABASES_EDITSHOW:                                         
    case CMD_DATABASES_SORT:                                               
    case CMD_DATABASES_SEARCH:                                  
    case CMD_DATABASES_DB_EXPUNGE:
    case CMD_DATABASES_DB_OPEN:      
    case CMD_DATABASES_GO:
    case CMD_DATABASES_MAINPAGE:
    case CMD_DATABASES_DB_CREATE:
    case CMD_DATABASES_DB_RENAME:
    case CMD_DATABASES_DB_DELETE:
    case CMD_DATABASES_DB_CONFDELETE:      
    case CMD_DATABASES_DB_DUMP:
    case CMD_DATABASES_DB_IMPORT:
    case CMD_DATABASES_DB_EXPORT:    
    case CMD_DATABASES_DB_DEFINE:          
    case CMD_DATABASES_DELETESEARCH:                
      {
      return iSERVICE_DATABASES;
      break;      
      }
    case CMD_FINGER_DISPLAYPAGE:
    case CMD_FINGER_GO:
      {
      return iSERVICE_FINGER;
      break;     
      }       
    case CMD_FILEBROWSER_DISPLAYPAGE:
    case CMD_FILEBROWSER_CWDUP:      
    case CMD_FILEBROWSER_CWD:            
    case CMD_FILEBROWSER_DUMP:                  
    case CMD_FILEBROWSER_EDITSHOW:                       
    case CMD_FILEBROWSER_EDITSAVE:                             
    case CMD_FILEBROWSER_EDITCANCEL:                             
    case CMD_FILEBROWSER_CREATEITEM:                             
    case CMD_FILEBROWSER_DELETEITEM:                                   
    case CMD_FILEBROWSER_DELETEITEM_CONF:                                   
    case CMD_FILEBROWSER_LOADFILE:                                       
    case CMD_FILEBROWSER_COPY:
    case CMD_FILEBROWSER_CUT:    
    case CMD_FILEBROWSER_PASTE:
    case CMD_FILEBROWSER_RENAME:  
    case CMD_FILEBROWSER_CWDF:     
    case CMD_FILEBROWSER_RENAMEOK:           
    case CMD_FILEBROWSER_RENAMECANCEL:        
    case CMD_FILEBROWSER_SORTNAME:
    case CMD_FILEBROWSER_SORTDATE:
    case CMD_FILEBROWSER_SORTSIZE:
    case CMD_FILEBROWSER_CHANGEDISK:      
      {
      return iSERVICE_FILEBROWSER;
      break; 
      }                 
    case CMD_FORWARDMAIL_DISPLAYPAGE:
    case CMD_FORWARDMAIL_ERASEALL:
    case CMD_FORWARDMAIL_SET:      
      {
      return iSERVICE_FORWARDMAIL;
      break;            
      }
    case CMD_SECVIRTUAL_GOTO:
      {
      return iSERVICE_SECVIRTUAL;
      break; 
      }               
    case CMD_USERACCOUNTS_GOTO:
      {
      return iSERVICE_USERACCOUNTS;
      break;                            
      }
    case CMD_DOTLEARN_GOTO:
      {
      return iSERVICE_DOTLEARN;
      break; 
      }               
    case CMD_CONFIG:
    case CMD_CONFIG_CANCEL:
    case CMD_CONFIG_CCLIENT:      
    case CMD_CONFIG_CCLIENT_SAVE:
    case CMD_CONFIG_NNTP:        
    case CMD_CONFIG_NNTP_SAVE:        
    case CMD_CONFIG_NNTP_SEARCH:        
    case CMD_CONFIG_NNTP_ADDSELECTED:        
    case CMD_CONFIG_APPEARANCE:      
    case CMD_CONFIG_APPEARANCE_SAVE:
      {
      return iSERVICE_CONFIG;
      break;
      }
    case CMD_SIEVE_FILTERS_SHOW:
    case CMD_SIEVE_FILTERS_EDIT:
    case CMD_SIEVE_FILTERS_CREATE:
    case CMD_SIEVE_FILTERS_DO:
    case CMD_SIEVE_FILTERS_DELETE:
    case CMD_SIEVE_FILTERS_SAVE:
    case CMD_SIEVE_FILTERS_CANCEL:    
    case CMD_SIEVE_FILTERS_UP:    
    case CMD_SIEVE_FILTERS_DOWN:    
    case CMD_SIEVE_FILTERS_CONFDELETE:
    case CMD_SIEVE_FILTERS_PREDEFSPAM:
    case CMD_SIEVE_FILTERS_PREDEFSPAM2:    
    case CMD_SIEVE_VACATIONS_SHOW:
    case CMD_SIEVE_VACATIONS_DO:            
    case CMD_SIEVE_VACATIONS_SAVE:  
    case CMD_SIEVE_VACATIONS_CANCEL:            
      {
      return iSERVICE_SIEVE;
      break;
      }      
    case CMD_CALENDAR_YEAR_SHOW:                  
    case CMD_CALENDAR_MONTH_SHOW:            
    case CMD_CALENDAR_WEEK_SHOW:                
    case CMD_CALENDAR_DAY_SHOW:            
    case CMD_CALENDAR_TODAY:
    case CMD_CALENDAR_TOMORROW:    
    case CMD_CALENDAR_YESTERDAY:    
    case CMD_CALENDAR_EVENTS_CREATE:                    
    case CMD_CALENDAR_EVENTS_ADD:                
    case CMD_CALENDAR_EVENTS_MODIFY:                    
    case CMD_CALENDAR_EVENTS_DELETE:                        
      {
      return iSERVICE_CALENDAR;
      break;
      }            
    case CMD_SPECIAL_INVALID: 
    case CMD_SPECIAL_CHECK_COOKIE:
    default:
      {
      return iSERVICE_INVALID;
      break;
      }
    }
  return iSERVICE_INVALID;
  }