+ StrBufAppendPrintf(Target, "%d", ul->UID, 0);
+}
+
+void tmplput_USERLIST_LastLogonNo(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ StrBufAppendPrintf(Target,"%ld", ul->LastLogonT, 0);
+}
+void tmplput_USERLIST_LastLogonStr(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+ StrEscAppend(Target, NULL, asctime(localtime(&ul->LastLogonT)), 0, 0);
+}
+
+void tmplput_USERLIST_nLogons(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ StrBufAppendPrintf(Target, "%d", ul->nLogons, 0);
+}
+
+void tmplput_USERLIST_nPosts(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ StrBufAppendPrintf(Target, "%d", ul->nPosts, 0);
+}
+
+void tmplput_USERLIST_Flags(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ StrBufAppendPrintf(Target, "%d", ul->Flags, 0);
+}
+
+void tmplput_USERLIST_DaysTillPurge(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ StrBufAppendPrintf(Target, "%d", ul->DaysTillPurge, 0);
+}
+
+int ConditionalUser(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+ if (havebstr("usernum")) {
+ return ibstr("usernum") == ul->UID;
+ }
+ else if (havebstr("username")) {
+ return strcmp(bstr("username"), ChrPtr(ul->UserName)) == 0;
+ }
+ else
+ return 0;
+}
+
+int ConditionalFlagINetEmail(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+ return (ul->Flags & US_INTERNET) != 0;
+}
+
+int ConditionalUserAccess(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ if (ul == NULL)
+ return 0;
+
+ return GetTemplateTokenNumber(Target,
+ TP,
+ 3,
+ AxNewU)
+ ==
+ ul->AccessLevel;
+}
+int ConditionalHaveBIO(StrBuf *Target, WCTemplputParams *TP)
+{
+ UserListEntry *ul = (UserListEntry*) CTX;
+
+ if (ul == NULL)
+ return 0;
+ return ul->HasBio;
+}
+
+void tmplput_USER_BIO(StrBuf *Target, WCTemplputParams *TP)
+{
+ int Done = 0;
+ StrBuf *Buf;
+ const char *who;
+ long len;
+
+ GetTemplateTokenString(Target, TP, 0, &who, &len);
+
+ Buf = NewStrBuf();
+ serv_printf("RBIO %s", who);
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 1) {
+ StrBuf *BioBuf = NewStrBufPlain(NULL, SIZ);
+ while (!Done && StrBuf_ServGetln(Buf)>=0) {
+ if ( (StrLength(Buf)==3) &&
+ !strcmp(ChrPtr(Buf), "000"))
+ Done = 1;
+ else
+ StrBufAppendBuf(BioBuf, Buf, 0);
+ }
+ StrBufAppendTemplate(Target, TP, BioBuf, 1);
+ FreeStrBuf(&BioBuf);
+ }
+ FreeStrBuf(&Buf);
+}
+
+int Conditional_USER_HAS_PIC(StrBuf *Target, WCTemplputParams *TP)
+{
+ StrBuf *Buf;
+ const char *who;
+ long len;
+ int r = 0;
+
+ GetTemplateTokenString(Target, TP, 2, &who, &len);
+
+ Buf = NewStrBuf();
+ serv_printf("OIMG _userpic_|%s", who);
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) != 2) {
+ r = 1;
+ }
+ else {
+ r = 0;
+ }
+ serv_puts("CLOS");
+ StrBuf_ServGetln(Buf);
+ GetServerStatus(Buf, NULL);
+ FreeStrBuf(&Buf);
+ return(r);
+}
+
+
+/*
+ * Locate the message number of a user's vCard in the current room
+ * Returns the message id of his vcard