void DeleteServInfo(ServInfo **FreeMe)
{
+ if (*FreeMe == NULL)
+ return;
FreeStrBuf(&(*FreeMe)->serv_nodename);
FreeStrBuf(&(*FreeMe)->serv_humannode);
FreeStrBuf(&(*FreeMe)->serv_fqdn);
/** Activate embedded URL's */
url(buf, sizeof(buf));
- escputs(buf);/*/ TODO: Target */
+ escputs(buf);
StrBufAppendBufPlain(Target, HKEY("\n"), 0);
}
if (bq == 1) {
long len;
int intext = 0;
- StrBufAppendPrintf(Target, "<div class=\"fmout\">\n", align);
+ StrBufAppendPrintf(Target, "<div class=\"fmout-%s\">\n", align);
while ((n = StrBufSipLine(Line, Source, &BufPtr), n >= 0) && !done)
{
done = n == 0;
* server READ commands.
* \return the read content as StrBuf
*/
-int read_server_binary(StrBuf *Ret, size_t total_len)
+int read_server_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf)
{
char buf[SIZ];
size_t bytes = 0;
size_t thisblock = 0;
- StrBuf *Buf;
- Buf = NewStrBuf();
if (Ret == NULL)
return -1;
{
if (GetServerStatus(Buf, NULL) == 6)
{
- StrBufCutLeft(Buf, 4); /*/ TODO : thisblock = (size_t)atoi(&buf[4]); */
+ StrBufCutLeft(Buf, 4);
thisblock = StrTol(Buf);
if (!WC->connected) {
FlushStrBuf(Ret);
FreeStrBuf(&Buf);
return -1;
}
- StrBuf_ServGetBLOB(Ret, thisblock);
+ StrBuf_ServGetBLOBBuffered(Ret, thisblock);
bytes += thisblock;
}
else {
}
}
}
- FreeStrBuf(&Buf);
return StrLength(Ret);
}
void tmplput_serv_nodename(StrBuf *Target, WCTemplputParams *TP)
{
- StrBufAppendTemplate(Target, TP, WC->serv_info->serv_nodename, 0);
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_nodename, 0);
}
void tmplput_serv_humannode(StrBuf *Target, WCTemplputParams *TP)
{
- StrBufAppendTemplate(Target, TP, WC->serv_info->serv_humannode, 0);
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_humannode, 0);
}
void tmplput_serv_fqdn(StrBuf *Target, WCTemplputParams *TP)
{
- StrBufAppendTemplate(Target, TP, WC->serv_info->serv_fqdn, 0);
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_fqdn, 0);
}
void tmplput_serv_software(StrBuf *Target, WCTemplputParams *TP)
{
- StrBufAppendTemplate(Target, TP, WC->serv_info->serv_software, 0);
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return;
+ StrBufAppendTemplate(Target, TP, WCC->serv_info->serv_software, 0);
}
void tmplput_serv_rev_level(StrBuf *Target, WCTemplputParams *TP)
{
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return;
StrBufAppendPrintf(Target, "%d.%02d",
- WC->serv_info->serv_rev_level / 100,
- WC->serv_info->serv_rev_level % 100);
+ WCC->serv_info->serv_rev_level / 100,
+ WCC->serv_info->serv_rev_level % 100);
}
int conditional_serv_newuser_disabled(StrBuf *Target, WCTemplputParams *TP)
{
- return WC->serv_info->serv_newuser_disabled != 0;
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return 0;
+ return WCC->serv_info->serv_newuser_disabled != 0;
}
int conditional_serv_supports_openid(StrBuf *Target, WCTemplputParams *TP)
{
- return WC->serv_info->serv_supports_openid != 0;
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return 0;
+ return WCC->serv_info->serv_supports_openid != 0;
}
void tmplput_serv_bbs_city(StrBuf *Target, WCTemplputParams *TP)
{
+ wcsession *WCC = WC;
+ if (WCC->serv_info == NULL)
+ return;
StrBufAppendTemplate(Target, TP, WC->serv_info->serv_bbs_city, 0);
}
Buf = NewStrBuf();
Line = NewStrBuf();
serv_printf("MESG %s", TP->Tokens->Params[0]->Start);
+
StrBuf_ServGetln(Line);
- 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);
+ 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++;
}
- n++;
+
+ FlushStrBuf(Line);
+ FmOut(Line, "center", Buf);
+ StrBufAppendTemplate(Target, TP, Line, 1);
}
- FlushStrBuf(Line);
- FmOut(Line, "center", Buf);
- StrBufAppendTemplate(Target, TP, Line, 1);
FreeStrBuf(&Buf);
FreeStrBuf(&Line);
}