war on BSD style curly braces
[citadel.git] / webcit / serv_func.c
1 /*
2  * Functions which handle communication with the Citadel server.
3  *
4  * Copyright (c) 1996-2018 by the citadel.org team
5  *
6  * This program is open source software.  You can redistribute it and/or
7  * modify it under the terms of the GNU General Public License, version 3.
8  */
9
10 #include "webcit.h"
11 #include "webserver.h"
12
13 int is_uds = 0;
14 char serv_sock_name[PATH_MAX] = "";
15
16 HashList *EmbeddableMimes = NULL;
17 StrBuf *EmbeddableMimeStrs = NULL;
18
19
20 void SetInlinMimeRenderers(void)
21 {
22         StrBuf *Buf;
23
24         Buf = NewStrBuf();
25
26         /* Tell the server what kind of richtext we prefer */
27         serv_putbuf(EmbeddableMimeStrs);
28         StrBuf_ServGetln(Buf);
29
30         FreeStrBuf(&Buf);
31 }
32
33
34 void DeleteServInfo(ServInfo **FreeMe)
35 {
36         if (*FreeMe == NULL)
37                 return;
38         FreeStrBuf(&(*FreeMe)->serv_nodename);
39         FreeStrBuf(&(*FreeMe)->serv_humannode);
40         FreeStrBuf(&(*FreeMe)->serv_fqdn);
41         FreeStrBuf(&(*FreeMe)->serv_software);
42         FreeStrBuf(&(*FreeMe)->serv_bbs_city);
43         FreeStrBuf(&(*FreeMe)->serv_sysadm);
44         FreeStrBuf(&(*FreeMe)->serv_default_cal_zone);
45         FreeStrBuf(&(*FreeMe)->serv_svn_revision);
46         free(*FreeMe);
47         *FreeMe = NULL;
48 }
49
50 /*
51  * get info about the server we've connected to
52  *
53  * browser_host         the citadel we want to connect to
54  * user_agent           which browser uses our client?
55  */
56 ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
57 {
58         ServInfo *info;
59         StrBuf *Buf;
60         int a;
61         int rc;
62
63         Buf = NewStrBuf();
64
65         /* Tell the server what kind of client is connecting */
66         serv_printf("IDEN %d|%d|%d|%s|%s",
67                     DEVELOPER_ID,
68                     CLIENT_ID,
69                     CLIENT_VERSION,
70                     ChrPtr(user_agent),
71                     ChrPtr(browser_host)
72         );
73         StrBuf_ServGetln(Buf);
74         if (GetServerStatus(Buf, NULL) != 2) {
75                 syslog(LOG_WARNING, "get_serv_info(IDEN): unexpected answer [%s]\n",
76                         ChrPtr(Buf));
77                 FreeStrBuf(&Buf);
78                 return NULL;
79         }
80
81         /*
82          * Tell the server that when we save a calendar event, we
83          * want invitations to be generated by the Citadel server
84          * instead of by the client.
85          */
86         serv_puts("ICAL sgi|1");
87         StrBuf_ServGetln(Buf);
88         if (GetServerStatus(Buf, NULL) != 2) {
89                 syslog(LOG_WARNING, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n",
90                         ChrPtr(Buf));
91                 FreeStrBuf(&Buf);
92                 return NULL;
93         }
94
95         /* Now ask the server to tell us a little bit about itself... */
96         serv_puts("INFO");
97         StrBuf_ServGetln(Buf);
98         if (GetServerStatus(Buf, NULL) != 1) {
99                 syslog(LOG_WARNING, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n",
100                         ChrPtr(Buf));
101                 FreeStrBuf(&Buf);
102                 return NULL;
103         }
104
105         info = (ServInfo*)malloc(sizeof(ServInfo));
106         memset(info, 0, sizeof(ServInfo));
107         a = 0;
108         while (rc = StrBuf_ServGetln(Buf),
109                (rc >= 0) &&
110                ((rc != 3) || 
111                 strcmp(ChrPtr(Buf), "000")))
112         {
113                 switch (a) {
114                 case 0:
115                         info->serv_pid = StrToi(Buf);
116                         WC->ctdl_pid = info->serv_pid;
117                         break;
118                 case 1:
119                         info->serv_nodename = NewStrBufDup(Buf);
120                         break;
121                 case 2:
122                         info->serv_humannode = NewStrBufDup(Buf);
123                         break;
124                 case 3:
125                         info->serv_fqdn = NewStrBufDup(Buf);
126                         break;
127                 case 4:
128                         info->serv_software = NewStrBufDup(Buf);
129                         break;
130                 case 5:
131                         info->serv_rev_level = StrToi(Buf);
132                         break;
133                 case 6:
134                         info->serv_bbs_city = NewStrBufDup(Buf);
135                         break;
136                 case 7:
137                         info->serv_sysadm = NewStrBufDup(Buf);
138                         break;
139                 case 14:
140                         info->serv_supports_ldap = StrToi(Buf);
141                         break;
142                 case 15:
143                         info->serv_newuser_disabled = StrToi(Buf);
144                         break;
145                 case 16:
146                         info->serv_default_cal_zone = NewStrBufDup(Buf);
147                         break;
148                 case 20:
149                         info->serv_supports_sieve = StrToi(Buf);
150                         break;
151                 case 21:
152                         info->serv_fulltext_enabled = StrToi(Buf);
153                         break;
154                 case 22:
155                         info->serv_svn_revision = NewStrBufDup(Buf);
156                         break;
157                 case 23:
158                         info->serv_supports_openid = StrToi(Buf);
159                         break;
160                 case 24:
161                         info->serv_supports_guest = StrToi(Buf);
162                         break;
163                 }
164                 ++a;
165         }
166         FreeStrBuf(&Buf);
167         return info;
168 }
169
170 int GetConnected (void)
171 {
172         StrBuf *Buf;
173         wcsession *WCC = WC;
174
175         if (WCC->ReadBuf == NULL)
176                 WCC->ReadBuf = NewStrBufPlain(NULL, SIZ * 4);
177         if (is_uds) /* unix domain socket */
178                 WCC->serv_sock = uds_connectsock(serv_sock_name);
179         else        /* tcp socket */
180                 WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
181         
182         if (WCC->serv_sock < 0) {
183                 WCC->connected = 0;
184                 FreeStrBuf(&WCC->ReadBuf);
185                 return 1;
186         }
187         else {
188                 long Status;
189                 int short_status;
190                 Buf = NewStrBuf();
191                 WCC->connected = 1;
192                 StrBuf_ServGetln(Buf);  /* get the server greeting */
193                 short_status = GetServerStatus(Buf, &Status);
194                 FreeStrBuf(&Buf);
195
196                 /* Server isn't ready for us? */
197                 if (short_status != 2) {
198                         if (Status == 551) {
199                                 hprintf("HTTP/1.1 503 Service Unavailable\r\n");
200                                 hprintf("Content-type: text/plain; charset=utf-8\r\n");
201                                 wc_printf(_("This server is already serving its maximum number of users and cannot accept any additional logins at this time.  Please try again later or contact your system administrator."));
202                         }
203                         else {
204                                 wc_printf("%ld %s\n",
205                                         Status,
206                                         _("Received unexpected answer from Citadel server; bailing out.")
207                                 );
208                                 hprintf("HTTP/1.1 502 Bad Gateway\r\n");
209                                 hprintf("Content-type: text/plain; charset=utf-8\r\n");
210                         }
211                         end_burst();
212                         end_webcit_session();
213                         return 1;
214                 }
215
216                 /*
217                  * From what host is our user connecting?  Go with
218                  * the host at the other end of the HTTP socket,
219                  * unless we are following X-Forwarded-For: headers
220                  * and such a header has already turned up something.
221                  */
222                 if ( (!follow_xff) || (StrLength(WCC->Hdr->HR.browser_host) == 0) ) {
223                         if (WCC->Hdr->HR.browser_host == NULL) {
224                                 WCC->Hdr->HR.browser_host = NewStrBuf();
225                                 Put(WCC->Hdr->HTTPHeaders, HKEY("FreeMeWithTheOtherHeaders"), 
226                                     WCC->Hdr->HR.browser_host, HFreeStrBuf);
227                         }
228                         locate_host(WCC->Hdr->HR.browser_host, WCC->Hdr->http_sock);
229                 }
230                 if (WCC->serv_info == NULL) {
231                         WCC->serv_info = get_serv_info(WCC->Hdr->HR.browser_host, WCC->Hdr->HR.user_agent);
232                 }
233                 if (WCC->serv_info == NULL){
234                         begin_burst();
235                         wc_printf(_("Received unexpected answer from Citadel server; bailing out."));
236                         hprintf("HTTP/1.1 502 Bad Gateway\r\n");
237                         hprintf("Content-type: text/plain; charset=utf-8\r\n");
238                         end_burst();
239                         end_webcit_session();
240                         return 1;
241                 }
242                 if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
243                         begin_burst();
244                         wc_printf(_("You are connected to a Citadel "
245                                   "server running Citadel %d.%02d. \n"
246                                   "In order to run this version of WebCit "
247                                   "you must also have Citadel %d.%02d or"
248                                   " newer.\n\n\n"),
249                                 WCC->serv_info->serv_rev_level / 100,
250                                 WCC->serv_info->serv_rev_level % 100,
251                                 MINIMUM_CIT_VERSION / 100,
252                                 MINIMUM_CIT_VERSION % 100
253                                 );
254                         hprintf("HTTP/1.1 200 OK\r\n");
255                         hprintf("Content-type: text/plain; charset=utf-8\r\n");
256                         end_burst();
257                         end_webcit_session();
258                         return 1;
259                 }
260                 SetInlinMimeRenderers();
261         }
262         return 0;
263 }
264
265
266 void FmOut(StrBuf *Target, const char *align, const StrBuf *Source)
267 {
268         const char *ptr, *pte;
269         const char *BufPtr = NULL;
270         StrBuf *Line = NewStrBufPlain(NULL, SIZ);
271         StrBuf *Line1 = NewStrBufPlain(NULL, SIZ);
272         StrBuf *Line2 = NewStrBufPlain(NULL, SIZ);
273         int bn = 0;
274         int bq = 0;
275         int i;
276         long len;
277         int intext = 0;
278
279         StrBufAppendPrintf(Target, "<div class=\"fmout-%s\">\n", align);
280
281         if (StrLength(Source) > 0) 
282                 do 
283                 {
284                         StrBufSipLine(Line, Source, &BufPtr);
285                         bq = 0;
286                         i = 0;
287                         ptr = ChrPtr(Line);
288                         len = StrLength(Line);
289                         pte = ptr + len;
290
291                         if ((intext == 1) && (isspace(*ptr))) {
292                                 StrBufAppendBufPlain(Target, HKEY("<br>"), 0);
293                         }
294                         intext = 1;
295                         if (isspace(*ptr)) while ((ptr < pte) &&
296                                                   ((*ptr == '>') ||
297                                                    isspace(*ptr)))
298                                            {
299                                                    if (*ptr == '>')
300                                                            bq++;
301                                                    ptr ++;
302                                                    i++;
303                                            }
304
305                         /*
306                          * Quoted text should be displayed in italics and in a
307                          * different colour.  This code understands Citadel-style
308                          * " >" quotes and will convert to <BLOCKQUOTE> tags.
309                          */
310                         if (i > 0) StrBufCutLeft(Line, i);
311                 
312
313                         for (i = bn; i < bq; i++)                               
314                                 StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
315                         for (i = bq; i < bn; i++)                               
316                                 StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
317                         bn = bq;
318
319                         if (StrLength(Line) == 0)
320                                 continue;
321
322                         /* Activate embedded URL's */
323                         UrlizeText(Line1, Line, Line2);
324
325                         StrEscAppend(Target, Line1, NULL, 0, 0);
326
327                         StrBufAppendBufPlain(Target, HKEY("\n"), 0);
328                 }
329                 while ((BufPtr != StrBufNOTNULL) &&
330                        (BufPtr != NULL));
331
332         for (i = 0; i < bn; i++) {
333                 StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
334         }
335         StrBufAppendBufPlain(Target, HKEY("</div><br>\n"), 0);
336         FreeStrBuf(&Line);
337         FreeStrBuf(&Line1);
338         FreeStrBuf(&Line2);
339 }
340
341
342
343 /*
344  *  Transmit message text (in memory) to the server.
345  */
346 void text_to_server(char *ptr)
347 {
348         char buf[256];
349         int ch, a, pos, len;
350
351         pos = 0;
352         buf[0] = 0;
353
354         while (ptr[pos] != 0) {
355                 ch = ptr[pos++];
356                 if (ch == 10) {
357                         len = strlen(buf);
358                         while ( (isspace(buf[len - 1]))
359                                 && (buf[0] !=  '\0') 
360                                 && (buf[1] !=  '\0') )
361                                 buf[--len] = 0;
362                         serv_puts(buf);
363                         buf[0] = 0;
364                         if (ptr[pos] != 0) strcat(buf, " ");
365                 } else {
366                         a = strlen(buf);
367                         buf[a + 1] = 0;
368                         buf[a] = ch;
369                         if ((ch == 32) && (strlen(buf) > 200)) {
370                                 buf[a] = 0;
371                                 serv_puts(buf);
372                                 buf[0] = 0;
373                         }
374                         if (strlen(buf) > 250) {
375                                 serv_puts(buf);
376                                 buf[0] = 0;
377                         }
378                 }
379         }
380         serv_puts(buf);
381 }
382
383
384 /*
385  * Transmit message text (in memory) to the server, converting to Quoted-Printable encoding as we go.
386  */
387 void text_to_server_qp(const StrBuf *SendMeEncoded)
388 {
389         StrBuf *ServBuf;
390
391         ServBuf = StrBufRFC2047encodeMessage(SendMeEncoded);
392         serv_putbuf(ServBuf);
393         FreeStrBuf(&ServBuf);
394 }
395
396
397
398
399 /*
400  * translate server message output to text (used for editing room info files and such)
401  */
402 void server_to_text()
403 {
404         char buf[SIZ];
405
406         int count = 0;
407
408         while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
409                 if ((buf[0] == 32) && (count > 0)) {
410                         wc_printf("\n");
411                 }
412                 wc_printf("%s", buf);
413                 ++count;
414         }
415 }
416
417
418
419
420 /*
421  * Read text from server, appending to a string buffer until the
422  * usual 000 terminator is found.  Caller is responsible for freeing
423  * the returned pointer.
424  */
425 int read_server_text(StrBuf *Buf, long *nLines)
426 {
427         wcsession *WCC = WC;
428         StrBuf *ReadBuf;
429         long nRead;
430         long nTotal = 0;
431         long nlines;
432         
433         nlines = 0;
434         ReadBuf = NewStrBuf();
435         while ((WCC->serv_sock!=-1) &&
436                (nRead = StrBuf_ServGetln(ReadBuf), (nRead >= 0) &&
437                 ((nRead != 3)||(strcmp(ChrPtr(ReadBuf), "000") != 0))))
438         {
439                 StrBufAppendBuf(Buf, ReadBuf, 0);
440                 StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
441                 nTotal += nRead;
442                 nlines ++;
443         }
444         FreeStrBuf(&ReadBuf);
445         *nLines = nlines;
446         return nTotal;
447 }
448
449
450 int GetServerStatusMsg(StrBuf *Line, long* FullState, int PutImportantMessage, int MajorOK)
451 {
452         int rc;
453         if (FullState != NULL)
454                 *FullState = StrTol(Line);
455         rc = ChrPtr(Line)[0] - 48;
456         if ((!PutImportantMessage) || 
457             (MajorOK == rc)||
458             (StrLength(Line) <= 4))
459                 return rc;
460
461         AppendImportantMessage(ChrPtr(Line) + 4, StrLength(Line) - 4);
462         return rc;
463 }
464
465
466 void tmplput_serv_ip(StrBuf *Target, WCTemplputParams *TP)
467 {
468         StrBufAppendPrintf(Target, "%d", WC->ctdl_pid);
469 }
470
471 void tmplput_serv_admin(StrBuf *Target, WCTemplputParams *TP)
472 {
473         wcsession *WCC = WC;
474         if (WCC->serv_info == NULL)
475                 return;
476         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_sysadm, 0);
477 }
478
479 void tmplput_serv_nodename(StrBuf *Target, WCTemplputParams *TP)
480 {
481         wcsession *WCC = WC;
482         if (WCC->serv_info == NULL)
483                 return;
484         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_nodename, 0);
485 }
486
487 void tmplput_serv_humannode(StrBuf *Target, WCTemplputParams *TP)
488 {
489         wcsession *WCC = WC;
490         if (WCC->serv_info == NULL)
491                 return;
492         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_humannode, 0);
493 }
494
495 void tmplput_serv_fqdn(StrBuf *Target, WCTemplputParams *TP)
496 {
497         wcsession *WCC = WC;
498         if (WCC->serv_info == NULL)
499                 return;
500         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_fqdn, 0);
501 }
502
503 void tmplput_serv_software(StrBuf *Target, WCTemplputParams *TP)
504 {
505         wcsession *WCC = WC;
506         if (WCC->serv_info == NULL)
507                 return;
508         StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_software, 0);
509 }
510
511 void tmplput_serv_rev_level(StrBuf *Target, WCTemplputParams *TP)
512 {
513         if (WC->serv_info == NULL) return;
514         StrBufAppendPrintf(Target, "%d", WC->serv_info->serv_rev_level);
515 }
516 int conditional_serv_newuser_disabled(StrBuf *Target, WCTemplputParams *TP)
517 {
518         wcsession *WCC = WC;
519         if (WCC->serv_info == NULL)
520                 return 0;
521         return WCC->serv_info->serv_newuser_disabled != 0;
522 }
523
524 int conditional_serv_supports_guest(StrBuf *Target, WCTemplputParams *TP)                                                                                                                                       
525 {
526         wcsession *WCC = WC;
527         if (WCC->serv_info == NULL)
528                 return 0;
529         return WCC->serv_info->serv_supports_guest != 0;
530 }
531
532 int conditional_serv_supports_openid(StrBuf *Target, WCTemplputParams *TP)
533 {
534         wcsession *WCC = WC;
535         if (WCC->serv_info == NULL)
536                 return 0;
537         return WCC->serv_info->serv_supports_openid != 0;
538 }
539
540 int conditional_serv_fulltext_enabled(StrBuf *Target, WCTemplputParams *TP)
541 {
542         wcsession *WCC = WC;
543         if (WCC->serv_info == NULL)
544                 return 0;
545         return WCC->serv_info->serv_fulltext_enabled != 0;
546 }
547
548 int conditional_serv_ldap_enabled(StrBuf *Target, WCTemplputParams *TP)
549 {
550         wcsession *WCC = WC;
551         if (WCC->serv_info == NULL)
552                 return 0;
553         return WCC->serv_info->serv_supports_ldap != 0;
554 }
555
556 void tmplput_serv_bbs_city(StrBuf *Target, WCTemplputParams *TP)
557 {
558         wcsession *WCC = WC;
559         if (WCC->serv_info == NULL)
560                 return;
561         StrBufAppendTemplate(Target, TP, WC->serv_info->serv_bbs_city, 0);
562 }
563
564 void tmplput_mesg(StrBuf *Target, WCTemplputParams *TP)
565 {
566         int n = 0;
567         int Done = 0;
568         StrBuf *Line;
569         StrBuf *Buf;
570
571         Buf = NewStrBuf();
572         Line = NewStrBuf();
573         serv_printf("MESG %s", TP->Tokens->Params[0]->Start);
574
575         StrBuf_ServGetln(Line);
576         if (GetServerStatus(Line, NULL) == 1) {
577                 while (!Done &&  (StrBuf_ServGetln(Line)>=0)) {
578                         if ( (StrLength(Line)==3) && 
579                              !strcmp(ChrPtr(Line), "000")) 
580                                 Done = 1;
581                         else
582                         {
583                                 if (n > 0)
584                                         StrBufAppendBufPlain(Buf, "\n", 1, 0);
585                                 StrBufAppendBuf(Buf, Line, 0);
586                         }
587                         n++;
588                 }
589         
590                 FlushStrBuf(Line);
591                 FmOut(Line, "center", Buf);
592                 StrBufAppendTemplate(Target, TP, Line, 1);
593         }
594         FreeStrBuf(&Buf);
595         FreeStrBuf(&Line);
596 }
597
598 void tmplput_site_prefix(StrBuf *Target, WCTemplputParams *TP) {
599         wcsession *WCC = WC;
600         if ((WCC != NULL) && (WCC->Hdr->HostHeader != NULL)) {
601                 StrBufAppendTemplate(Target, TP, WCC->Hdr->HostHeader, 0);
602         }
603 }
604
605 void RegisterEmbeddableMimeType(const char *MimeType, long MTLen, int Priority)
606 {
607         StrBuf *MT;
608         MT = NewStrBufPlain(MimeType, MTLen);
609         Put(EmbeddableMimes, IKEY(Priority), MT, HFreeStrBuf);
610 }
611
612 void CreateMimeStr(void)
613 {
614         HashPos  *it;
615         void *vMime;
616         long len = 0;
617         const char *Key;
618
619         it = GetNewHashPos(EmbeddableMimes, 0);
620         while (GetNextHashPos(EmbeddableMimes, it, &len, &Key, &vMime) &&
621                (vMime != NULL)) {
622                 if (StrLength(EmbeddableMimeStrs) > 0)
623                         StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("|"), 0);
624                 else 
625                         StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("MSGP "), 0);
626                 StrBufAppendBuf(EmbeddableMimeStrs, (StrBuf*) vMime, 0);
627         }
628         DeleteHashPos(&it);
629 }
630
631 void
632 ServerStartModule_SERV_FUNC
633 (void)
634 {
635         EmbeddableMimes = NewHash(1, Flathash);
636         EmbeddableMimeStrs = NewStrBuf();
637 }
638
639
640 void
641 ServerShutdownModule_SERV_FUNC
642 (void)
643 {
644         FreeStrBuf(&EmbeddableMimeStrs);
645         DeleteHash(&EmbeddableMimes);
646 }
647
648 void 
649 InitModule_SERVFUNC
650 (void)
651 {
652         is_uds = strcasecmp(ctdlhost, "uds") == 0;
653         if (is_uds)
654                 snprintf(serv_sock_name, PATH_MAX, "%s/citadel.socket", ctdlport);
655
656         RegisterConditional("COND:SERV:OPENID", 2, conditional_serv_supports_openid, CTX_NONE);
657         RegisterConditional("COND:SERV:NEWU", 2, conditional_serv_newuser_disabled, CTX_NONE);
658         RegisterConditional("COND:SERV:FULLTEXT_ENABLED", 2, conditional_serv_fulltext_enabled, CTX_NONE);
659         RegisterConditional("COND:SERV:LDAP_ENABLED", 2, conditional_serv_ldap_enabled, CTX_NONE);
660         RegisterConditional("COND:SERV:SUPPORTS_GUEST", 2, conditional_serv_supports_guest, CTX_NONE);
661         RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, NULL, CTX_NONE);
662         RegisterNamespace("SERV:NODENAME", 0, 1, tmplput_serv_nodename, NULL, CTX_NONE);
663         RegisterNamespace("SERV:HUMANNODE", 0, 1, tmplput_serv_humannode, NULL, CTX_NONE);
664         RegisterNamespace("SERV:FQDN", 0, 1, tmplput_serv_fqdn, NULL, CTX_NONE);
665         
666         RegisterNamespace("SERV:SOFTWARE", 0, 1, tmplput_serv_software, NULL, CTX_NONE);
667         RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, NULL, CTX_NONE);
668         RegisterNamespace("SERV:BBS_CITY", 0, 1, tmplput_serv_bbs_city, NULL, CTX_NONE);
669         RegisterNamespace("SERV:MESG", 1, 2, tmplput_mesg, NULL, CTX_NONE);
670         RegisterNamespace("SERV:ADMIN", 0, 1, tmplput_serv_admin, NULL, CTX_NONE);
671
672         RegisterNamespace("SERV:SITE:PREFIX", 0, 1, tmplput_site_prefix, NULL, CTX_NONE);
673
674
675 }
676
677
678
679 void 
680 SessionDestroyModule_SERVFUNC
681 (wcsession *sess)
682 {
683         DeleteServInfo(&sess->serv_info);
684 }