-/**
- * Read binary data from server into memory using a series of
- * server READ commands.
- * \param buffer the output buffer
- * \param total_len the maximal length of buffer
- */
-void read_server_binary(char *buffer, size_t total_len) {
- char buf[SIZ];
- size_t bytes = 0;
- size_t thisblock = 0;
-
- memset(buffer, 0, total_len);
- while (bytes < total_len) {
- thisblock = 4095;
- if ((total_len - bytes) < thisblock) {
- thisblock = total_len - bytes;
- if (thisblock == 0) return;
- }
- serv_printf("READ %d|%d", (int)bytes, (int)thisblock);
- serv_getln(buf, sizeof buf);
- if (buf[0] == '6') {
- thisblock = (size_t)atoi(&buf[4]);
- if (!WC->connected) return;
- serv_read(&buffer[bytes], thisblock);
- bytes += thisblock;
- }
- else {
- lprintf(3, "Error: %s\n", &buf[4]);
- return;
+void tmplput_serv_fqdn(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WC->serv_info->serv_fqdn, 0);
+}
+
+void tmplput_serv_software(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WC->serv_info->serv_software, 0);
+}
+
+void tmplput_serv_rev_level(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL) return;
+ StrBufAppendPrintf(Target, "%d", WC->serv_info->serv_rev_level);
+}
+int conditional_serv_newuser_disabled(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return 0;
+ return WC->serv_info->serv_newuser_disabled != 0;
+}
+
+int conditional_serv_supports_guest(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return 0;
+ return WC->serv_info->serv_supports_guest != 0;
+}
+
+int conditional_serv_supports_openid(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return 0;
+ return WC->serv_info->serv_supports_openid != 0;
+}
+
+int conditional_serv_fulltext_enabled(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return 0;
+ return WC->serv_info->serv_fulltext_enabled != 0;
+}
+
+int conditional_serv_ldap_enabled(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return 0;
+ return WC->serv_info->serv_supports_ldap != 0;
+}
+
+void tmplput_serv_bbs_city(StrBuf *Target, WCTemplputParams *TP) {
+ if (WC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WC->serv_info->serv_bbs_city, 0);
+}
+
+void tmplput_mesg(StrBuf *Target, WCTemplputParams *TP) {
+ int n = 0;
+ int Done = 0;
+ StrBuf *Line;
+ StrBuf *Buf;
+
+ Buf = NewStrBuf();
+ Line = NewStrBuf();
+ serv_printf("MESG %s", TP->Tokens->Params[0]->Start);
+
+ StrBuf_ServGetln(Line);
+ if (GetServerStatus(Line, NULL) == 1) {
+ while (!Done && (StrBuf_ServGetln(Line)>=0)) {
+ if ( (StrLength(Line)==3) &&
+ !strcmp(ChrPtr(Line), "000"))
+ Done = 1;
+ else
+ {
+ if (n > 0)
+ StrBufAppendBufPlain(Buf, "\n", 1, 0);
+ StrBufAppendBuf(Buf, Line, 0);
+ }
+ n++;