}
-int GetWholistSection(HashList *List, time_t now)
+int GetWholistSection(HashList *List, time_t now, StrBuf *Buf)
{
- StrBuf *Buf;
wcsession *WCC = WC;
UserStateStruct *User, *OldUser;
void *VOldUser;
size_t BufLen;
- char buf[SIZ];
const char *Pos;
serv_puts("RWHO");
- serv_getln(buf, sizeof buf);
- if (buf[0] == '1') {
- Buf = NewStrBuf();
- while (BufLen = StrBuf_ServGetlnBuffered(Buf), strcmp(ChrPtr(Buf), "000")) {
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 1) {
+ while (BufLen = StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
if (BufLen <= 0)
continue;
Pos = NULL;
User, DestroyUserStruct);
}
SortByPayload(List, CompareUserStruct);
-
- FreeStrBuf(&Buf);
return 1;
}
- else
+ else {
return 0;
+ }
}
/*
HashList *GetWholistHash(StrBuf *Target, WCTemplputParams *TP)
{
+ StrBuf *Buf;
HashList *List;
- char buf[SIZ];
time_t now;
+ Buf = NewStrBuf();
+
serv_puts("TIME");
- serv_getln(buf, sizeof buf);
- if (buf[0] == '2') {
- now = extract_long(&buf[4], 0);
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 2) {
+ const char *pos = ChrPtr(Buf) + 4;
+ now = StrBufExtractNext_long(Buf, &pos, '|');
}
else {
now = time(NULL);
}
List = NewHash(1, NULL);
- GetWholistSection(List, now);
+ GetWholistSection(List, now, Buf);
+ FreeStrBuf(&Buf);
return List;
}