Newer
Older
if (strncmp(sp, "BPS:", 4) == 0) {
set_output_rate((enum output_rate)atoi(sp + 4));
return nulstr;
}
if (strncmp(sp, "TEXT:", 5) == 0) {
if (i >= 1 && i <= TOTAL_TEXT)
return text[i - 1];
return get_text(sp + 5);
/* NOSTOP */
/* STOP */
if (!strcmp(sp, "BELL") || !strcmp(sp, "BEEP"))
if (!strcmp(sp, "EVENT")) {
if (event_time == 0)
return "<none>";
return timestr(event_time);
if (strcmp(sp, "NODE_USER") == 0)
return thisnode.misc & NODE_ANON ? text[UNKNOWN_USER] : useron.alias;
if (!strncmp(sp, "NODE", 4) && IS_DIGIT(sp[4])) {
i = atoi(sp + 4);
if (i && i <= cfg.sys_nodes) {
getnodedat(i, &node);
printnodedat(i, &node);
}
if (!strcmp(sp, "WHO")) {
if (!strcmp(sp, "USER") || !strcmp(sp, "ALIAS") || !strcmp(sp, "NAME"))
return useron.alias;
if (!strcmp(sp, "FIRST")) {
safe_snprintf(str, maxlen, "%s", useron.alias);
tp = strchr(str, ' ');
if (!strcmp(sp, "USERNUM")) {
safe_snprintf(str, maxlen, "%u", useron.number);
if (!strcmp(sp, "PHONE") || !strcmp(sp, "HOMEPHONE")
|| !strcmp(sp, "DATAPHONE") || !strcmp(sp, "DATA"))
return useron.phone;
if (!strcmp(sp, "ADDR1"))
return useron.address;
if (!strcmp(sp, "FROM"))
return useron.location;
if (!strcmp(sp, "CITY")) {
safe_snprintf(str, maxlen, "%s", useron.location);
char* p = strchr(str, ',');
if (p) {
*p = 0;
}
if (!strcmp(sp, "STATE")) {
char* p = strchr(useron.location, ',');
if (p) {
}
if (!strcmp(sp, "CPU"))
if (!strcmp(sp, "HOST"))
if (!strcmp(sp, "BDATE"))
return getbirthdstr(&cfg, useron.birth, str, maxlen);
if (strcmp(sp, "BIRTH") == 0)
return format_birthdate(&cfg, useron.birth, str, maxlen);
if (strncmp(sp, "BDATE:", 6) == 0 || strncmp(sp, "BIRTH:", 6) == 0) {

Rob Swindell
committed
SAFECOPY(tmp, sp + 6);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
tm.tm_year = getbirthyear(&cfg, useron.birth) - 1900;
tm.tm_mon = getbirthmonth(&cfg, useron.birth) - 1;
tm.tm_mday = getbirthday(&cfg, useron.birth);
mktime(&tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "AGE")) {
safe_snprintf(str, maxlen, "%u", getage(&cfg, useron.birth));
if (!strcmp(sp, "CALLS") || !strcmp(sp, "NUMTIMESON")) {
safe_snprintf(str, maxlen, "%u", useron.logons);
if (strcmp(sp, "PWAGE") == 0) {
safe_snprintf(str, maxlen, "%d", (uint)(age / (24 * 60 * 60)));
if (strcmp(sp, "PWDATE") == 0 || strcmp(sp, "MEMO") == 0)
return datestr(useron.pwmod);
if (strncmp(sp, "PWDATE:", 7) == 0) {

Rob Swindell
committed
SAFECOPY(tmp, sp + 7);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
time_t date = useron.pwmod;
localtime_r(&date, &tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "SEC") || !strcmp(sp, "SECURITY")) {
safe_snprintf(str, maxlen, "%u", useron.level);
if (!strcmp(sp, "SINCE"))
return datestr(useron.firston);
if (strncmp(sp, "SINCE:", 6) == 0) {

Rob Swindell
committed
SAFECOPY(tmp, sp + 6);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
time_t date = useron.firston;
localtime_r(&date, &tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "TIMEON") || !strcmp(sp, "TIMEUSED")) {
now = time(NULL);
safe_snprintf(str, maxlen, "%u", (uint)(now - logontime) / 60);
if (!strcmp(sp, "TUSED")) { /* Synchronet only */
now = time(NULL);
return sectostr((uint)(now - logontime), str) + 1;
if (!strcmp(sp, "TLEFT")) { /* Synchronet only */
return sectostr(timeleft, str) + 1;
if (!strcmp(sp, "TPERD")) /* Synchronet only */
return sectostr(cfg.level_timeperday[useron.level], str) + 4;
if (!strcmp(sp, "TPERC")) /* Synchronet only */
return sectostr(cfg.level_timepercall[useron.level], str) + 4;
if (strcmp(sp, "MPERC") == 0 || strcmp(sp, "TIMELIMIT") == 0) {
safe_snprintf(str, maxlen, "%u", cfg.level_timepercall[useron.level]);
if (strcmp(sp, "MPERD") == 0) {
safe_snprintf(str, maxlen, "%u", cfg.level_timeperday[useron.level]);
if (strcmp(sp, "MAXCALLS") == 0) {
safe_snprintf(str, maxlen, "%u", cfg.level_callsperday[useron.level]);
if (strcmp(sp, "MAXPOSTS") == 0) {
safe_snprintf(str, maxlen, "%u", cfg.level_postsperday[useron.level]);
if (strcmp(sp, "MAXMAILS") == 0) {
safe_snprintf(str, maxlen, "%u", cfg.level_emailperday[useron.level]);
if (strcmp(sp, "MAXLINES") == 0) {
safe_snprintf(str, maxlen, "%u", cfg.level_linespermsg[useron.level]);
if (!strcmp(sp, "MINLEFT") || !strcmp(sp, "LEFT") || !strcmp(sp, "TIMELEFT")) {
safe_snprintf(str, maxlen, "%u", timeleft / 60);
if (!strcmp(sp, "LASTON"))
return timestr(useron.laston);
if (!strcmp(sp, "LASTDATEON"))
return datestr(useron.laston);
if (strncmp(sp, "LASTON:", 7) == 0) {

Rob Swindell
committed
SAFECOPY(tmp, sp + 7);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
time_t date = useron.laston;
localtime_r(&date, &tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "LASTTIMEON")) {
memset(&tm, 0, sizeof(tm));
localtime32(&useron.laston, &tm);
if (cfg.sys_misc & SM_MILITARY)
safe_snprintf(str, maxlen, "%02d:%02d:%02d"
, tm.tm_hour, tm.tm_min, tm.tm_sec);
else
safe_snprintf(str, maxlen, "%02d:%02d %s"
, tm.tm_hour == 0 ? 12
: tm.tm_hour > 12 ? tm.tm_hour - 12
: tm.tm_hour, tm.tm_min, tm.tm_hour > 11 ? "pm":"am");
if (!strcmp(sp, "FIRSTON"))
return timestr(useron.firston);
if (!strcmp(sp, "FIRSTDATEON"))
return datestr(useron.firston);
if (strncmp(sp, "FIRSTON:", 8) == 0) {

Rob Swindell
committed
SAFECOPY(tmp, sp + 8);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
time_t date = useron.firston;
localtime_r(&date, &tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "FIRSTTIMEON")) {
memset(&tm, 0, sizeof(tm));
localtime32(&useron.firston, &tm);
if (cfg.sys_misc & SM_MILITARY)
safe_snprintf(str, maxlen, "%02d:%02d:%02d"
, tm.tm_hour, tm.tm_min, tm.tm_sec);
safe_snprintf(str, maxlen, "%02d:%02d %s"
, tm.tm_hour == 0 ? 12
: tm.tm_hour > 12 ? tm.tm_hour - 12
: tm.tm_hour, tm.tm_min, tm.tm_hour > 11 ? "pm":"am");
if (strcmp(sp, "EMAILS") == 0) {
safe_snprintf(str, maxlen, "%u", useron.emails);
return str;
}
if (strcmp(sp, "FBACKS") == 0) {
safe_snprintf(str, maxlen, "%u", useron.fbacks);
return str;
}
if (strcmp(sp, "ETODAY") == 0) {
safe_snprintf(str, maxlen, "%u", useron.etoday);
return str;
}
if (strcmp(sp, "PTODAY") == 0) {
safe_snprintf(str, maxlen, "%u", useron.ptoday);
return str;
}
if (strcmp(sp, "LTODAY") == 0) {
safe_snprintf(str, maxlen, "%u", useron.ltoday);
return str;
}
if (strcmp(sp, "MTODAY") == 0) {
safe_snprintf(str, maxlen, "%u", useron.ttoday);
return str;
}
if (strcmp(sp, "MTOTAL") == 0) {
safe_snprintf(str, maxlen, "%u", useron.timeon);
return str;
}
if (strcmp(sp, "TTODAY") == 0)
if (strcmp(sp, "TTOTAL") == 0)
if (strcmp(sp, "TLAST") == 0) {
safe_snprintf(str, maxlen, "%u", useron.tlast);
return str;
}
if (strcmp(sp, "MEXTRA") == 0) {
safe_snprintf(str, maxlen, "%u", useron.textra);
return str;
}
if (strcmp(sp, "TEXTRA") == 0)
if (strcmp(sp, "MBANKED") == 0) {
safe_snprintf(str, maxlen, "%" PRIu32, useron.min);
if (strcmp(sp, "TBANKED") == 0)
if (!strcmp(sp, "MSGLEFT") || !strcmp(sp, "MSGSLEFT")) {
safe_snprintf(str, maxlen, "%u", useron.posts);
if (!strcmp(sp, "MSGREAD")) {
safe_snprintf(str, maxlen, "%u", posts_read);
if (!strcmp(sp, "FREESPACE")) {
safe_snprintf(str, maxlen, "%" PRIu64, getfreediskspace(cfg.temp_dir, 0));
}
if (!strcmp(sp, "FREESPACEK")) {
safe_snprintf(str, maxlen, "%" PRIu64, getfreediskspace(cfg.temp_dir, 1024));
if (strcmp(sp, "FREESPACEM") == 0) {
safe_snprintf(str, maxlen, "%" PRIu64, getfreediskspace(cfg.temp_dir, 1024 * 1024));
if (strcmp(sp, "FREESPACEG") == 0) {
safe_snprintf(str, maxlen, "%" PRIu64, getfreediskspace(cfg.temp_dir, 1024 * 1024 * 1024));
if (strcmp(sp, "FREESPACET") == 0) {
safe_snprintf(str, maxlen, "%" PRIu64, getfreediskspace(cfg.temp_dir, 1024 * 1024 * 1024) / 1024);
if (strcmp(sp, "MINSPACE") == 0) {
byte_count_to_str(cfg.min_dspace, str, maxlen);
return str;
}
if (!strcmp(sp, "UPBYTES")) {
safe_snprintf(str, maxlen, "%" PRIu64, useron.ulb);
if (!strcmp(sp, "UPK")) {
safe_snprintf(str, maxlen, "%" PRIu64, useron.ulb / 1024L);
if (!strcmp(sp, "UPS") || !strcmp(sp, "UPFILES")) {
safe_snprintf(str, maxlen, "%u", useron.uls);
if (!strcmp(sp, "DLBYTES")) {
safe_snprintf(str, maxlen, "%" PRIu64, useron.dlb);
if (!strcmp(sp, "DOWNK")) {
safe_snprintf(str, maxlen, "%" PRIu64, useron.dlb / 1024L);
if (!strcmp(sp, "DOWNS") || !strcmp(sp, "DLFILES")) {
safe_snprintf(str, maxlen, "%u", useron.dls);
if (strcmp(sp, "PCR") == 0) {
safe_snprintf(str, maxlen, "%u", f ? (uint)(100 / f) : 0);
return str;
}
if (strcmp(sp, "UDR") == 0) {
float f = 0;
f = (float)useron.dlb / useron.ulb;
safe_snprintf(str, maxlen, "%u", f ? (uint)(100 / f) : 0);
return str;
}
if (strcmp(sp, "UDFR") == 0) {
float f = 0;
f = (float)useron.dls / useron.uls;
safe_snprintf(str, maxlen, "%u", f ? (uint)(100 / f) : 0);
if (!strcmp(sp, "LASTNEW"))
return datestr(ns_time);
if (strncmp(sp, "LASTNEW:", 8) == 0) {

Rob Swindell
committed
SAFECOPY(tmp, sp + 8);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
time_t date = ns_time;
localtime_r(&date, &tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "NEWFILETIME"))
return timestr(ns_time);
if (!strcmp(sp, "MAXDK") || !strcmp(sp, "DLKLIMIT") || !strcmp(sp, "KBLIMIT")) {
safe_snprintf(str, maxlen, "%" PRIu64, cfg.level_freecdtperday[useron.level] / 1024L);
if (!strcmp(sp, "DAYBYTES")) { /* amt of free cdts used today */
safe_snprintf(str, maxlen, "%" PRIu64, cfg.level_freecdtperday[useron.level] - useron.freecdt);
if (!strcmp(sp, "BYTELIMIT")) {
safe_snprintf(str, maxlen, "%" PRIu64, cfg.level_freecdtperday[useron.level]);
if (!strcmp(sp, "KBLEFT")) {
safe_snprintf(str, maxlen, "%" PRIu64, user_available_credits(&useron) / 1024UL);
if (!strcmp(sp, "BYTESLEFT")) {
safe_snprintf(str, maxlen, "%" PRIu64, user_available_credits(&useron));
if (strcmp(sp, "CREDITS") == 0) {
safe_snprintf(str, maxlen, "%" PRIu64, useron.cdt);
if (strcmp(sp, "FREECDT") == 0) {
safe_snprintf(str, maxlen, "%" PRIu64, useron.freecdt);
if (!strcmp(sp, "CONF")) {
safe_snprintf(str, maxlen, "%s %s"
, usrgrps ? cfg.grp[usrgrp[curgrp]]->sname :nulstr
, usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr);
if (!strcmp(sp, "CONFNUM")) {
safe_snprintf(str, maxlen, "%u %u", curgrp + 1, cursub[curgrp] + 1);
if (!strcmp(sp, "NUMDIR")) {
safe_snprintf(str, maxlen, "%u %u", usrlibs ? curlib + 1 : 0, usrlibs ? curdir[curlib] + 1 : 0);
if (!strcmp(sp, "EXDATE") || !strcmp(sp, "EXPDATE"))
return datestr(useron.expire);
if (strncmp(sp, "EXPDATE:", 8) == 0) {
if (!useron.expire)

Rob Swindell
committed
SAFECOPY(tmp, sp + 8);
c_unescape_str(tmp);
memset(&tm, 0, sizeof(tm));
time_t date = useron.expire;
localtime_r(&date, &tm);

Rob Swindell
committed
strftime(str, maxlen, tmp, &tm);
return str;
}
if (!strcmp(sp, "EXPDAYS")) {
now = time(NULL);
l = (uint)(useron.expire - now);
if (l < 0)
l = 0;
safe_snprintf(str, maxlen, "%lu", l / (1440L * 60L));
if (strcmp(sp, "NOTE") == 0 || strcmp(sp, "MEMO1") == 0)
return useron.note;
if (strcmp(sp, "REALNAME") == 0 || !strcmp(sp, "MEMO2") || !strcmp(sp, "COMPANY"))
if (!strcmp(sp, "ZIP"))
return useron.zipcode;
if (!strcmp(sp, "HANGUP")) {
/* Synchronet Specific */
if (!strncmp(sp, "SETSTR:", 7)) {
strcpy(main_csi.str, sp + 7);
if (strcmp(sp, "STR") == 0) {
return main_csi.str;
}
if (strncmp(sp, "STRVAR:", 7) == 0) {
if (main_csi.str_var && main_csi.str_var_name) {
for (i = 0; i < main_csi.str_vars; i++)
if (main_csi.str_var_name[i] == crc)
return main_csi.str_var[i];
}
return nulstr;
}
if (strncmp(sp, "JS:", 3) == 0) {
jsval val;
if (JS_GetProperty(js_cx, obj == NULL ? js_glob : obj, sp + 3, &val))
JSVALUE_TO_STRBUF(js_cx, val, str, maxlen, NULL);
return str;
}
if (!strncmp(sp, "EXEC:", 5)) {
exec_bin(sp + 5, &main_csi);
if (!strncmp(sp, "EXEC_XTRN:", 10)) {
for (i = 0; i < cfg.total_xtrns; i++)
if (!stricmp(cfg.xtrn[i]->code, sp + 10))
break;
if (i < cfg.total_xtrns)
exec_xtrn(i);
}
if (!strncmp(sp, "MENU:", 5)) {
menu(sp + 5);
if (!strncmp(sp, "CONDMENU:", 9)) {
menu(sp + 9, P_NOERROR);
}
if (!strncmp(sp, "TYPE:", 5)) {
printfile(cmdstr(sp + 5, nulstr, nulstr, str), 0);
if (!strncmp(sp, "INCLUDE:", 8)) {
printfile(cmdstr(sp + 8, nulstr, nulstr, str), P_NOCRLF | P_SAVEATR);
}
if (!strcmp(sp, "QUESTION"))
if (!strcmp(sp, "HANDLE"))
return useron.handle;
if (strcmp(sp, "LASTIP") == 0)
return useron.ipaddr;
if (!strcmp(sp, "CID") || !strcmp(sp, "IP"))
if (!strcmp(sp, "LOCAL-IP"))
if (!strcmp(sp, "CRLF"))
if (!strcmp(sp, "PUSHXY")) {
ansi_save();
if (!strcmp(sp, "POPXY")) {
ansi_restore();
if (!strcmp(sp, "HOME")) {
if (!strcmp(sp, "CLRLINE")) {
if (!strcmp(sp, "CLR2EOL") || !strcmp(sp, "CLREOL")) {
if (!strcmp(sp, "CLR2EOS")) {
if (!strncmp(sp, "UP:", 3)) {
cursor_up(atoi(sp + 3));
if (!strncmp(sp, "DOWN:", 5)) {
cursor_down(atoi(sp + 5));
if (!strncmp(sp, "LEFT:", 5)) {
cursor_left(atoi(sp + 5));
if (!strncmp(sp, "RIGHT:", 6)) {
cursor_right(atoi(sp + 6));
if (!strncmp(sp, "GOTOXY:", 7)) {
const char* cp = strchr(sp, ',');
if (cp != NULL) {

Rob Swindell
committed
cp++;
cursor_xy(atoi(sp + 7), atoi(cp));
if (!strcmp(sp, "GRP")) {
if (SMB_IS_OPEN(&smb)) {
if (smb.subnum == INVALID_SUB)
if (subnum_is_valid(smb.subnum))
return cfg.grp[cfg.sub[smb.subnum]->grp]->sname;
return usrgrps ? cfg.grp[usrgrp[curgrp]]->sname : nulstr;
if (!strcmp(sp, "GRPL")) {
if (SMB_IS_OPEN(&smb)) {
if (smb.subnum == INVALID_SUB)
if (subnum_is_valid(smb.subnum))
return cfg.grp[cfg.sub[smb.subnum]->grp]->lname;
return usrgrps ? cfg.grp[usrgrp[curgrp]]->lname : nulstr;
if (!strcmp(sp, "GN")) {
if (SMB_IS_OPEN(&smb))
ugrp = getusrgrp(smb.subnum);
else
ugrp = usrgrps ? curgrp + 1 : 0;
safe_snprintf(str, maxlen, "%u", ugrp);
if (!strcmp(sp, "GL")) {
if (SMB_IS_OPEN(&smb))
ugrp = getusrgrp(smb.subnum);
else
ugrp = usrgrps ? curgrp + 1 : 0;
safe_snprintf(str, maxlen, "%-4u", ugrp);
if (!strcmp(sp, "GR")) {
if (SMB_IS_OPEN(&smb))
ugrp = getusrgrp(smb.subnum);
else
ugrp = usrgrps ? curgrp + 1 : 0;
safe_snprintf(str, maxlen, "%4u", ugrp);
if (!strcmp(sp, "SUB")) {
if (SMB_IS_OPEN(&smb)) {
if (smb.subnum == INVALID_SUB)
else if (subnum_is_valid(smb.subnum))
return cfg.sub[smb.subnum]->sname;
return usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->sname : nulstr;
if (!strcmp(sp, "SUBL")) {
if (SMB_IS_OPEN(&smb)) {
if (smb.subnum == INVALID_SUB)
else if (subnum_is_valid(smb.subnum))
return cfg.sub[smb.subnum]->lname;
return usrgrps ? cfg.sub[usrsub[curgrp][cursub[curgrp]]]->lname : nulstr;
if (!strcmp(sp, "SN")) {
if (SMB_IS_OPEN(&smb))
usub = getusrsub(smb.subnum);
else
usub = usrgrps ? cursub[curgrp] + 1 : 0;
safe_snprintf(str, maxlen, "%u", usub);
if (!strcmp(sp, "SL")) {
if (SMB_IS_OPEN(&smb))
usub = getusrsub(smb.subnum);
else
usub = usrgrps ? cursub[curgrp] + 1 : 0;
safe_snprintf(str, maxlen, "%-4u", usub);
if (!strcmp(sp, "SR")) {
if (SMB_IS_OPEN(&smb))
usub = getusrsub(smb.subnum);
else
usub = usrgrps ? cursub[curgrp] + 1 : 0;
safe_snprintf(str, maxlen, "%4u", usub);
if (!strcmp(sp, "LIB"))
return usrlibs ? cfg.lib[usrlib[curlib]]->sname : nulstr;
if (!strcmp(sp, "LIBL"))
return usrlibs ? cfg.lib[usrlib[curlib]]->lname : nulstr;
if (!strcmp(sp, "LN")) {
safe_snprintf(str, maxlen, "%u", usrlibs ? curlib + 1 : 0);
if (!strcmp(sp, "LL")) {
safe_snprintf(str, maxlen, "%-4u", usrlibs ? curlib + 1 : 0);
if (!strcmp(sp, "LR")) {
safe_snprintf(str, maxlen, "%4u", usrlibs ? curlib + 1 : 0);
if (!strcmp(sp, "DIR"))
return usrlibs ? cfg.dir[usrdir[curlib][curdir[curlib]]]->sname :nulstr;
if (!strcmp(sp, "DIRL"))
return usrlibs ? cfg.dir[usrdir[curlib][curdir[curlib]]]->lname : nulstr;
if (!strcmp(sp, "DN")) {
safe_snprintf(str, maxlen, "%u", usrlibs ? curdir[curlib] + 1 : 0);
if (!strcmp(sp, "DL")) {
safe_snprintf(str, maxlen, "%-4u", usrlibs ? curdir[curlib] + 1 : 0);
if (!strcmp(sp, "DR")) {
safe_snprintf(str, maxlen, "%4u", usrlibs ? curdir[curlib] + 1 : 0);
if (!strcmp(sp, "NOACCESS")) {
if (noaccess_str == text[NoAccessTime])
safe_snprintf(str, maxlen, noaccess_str, noaccess_val / 60, noaccess_val % 60);
else if (noaccess_str == text[NoAccessDay])
safe_snprintf(str, maxlen, noaccess_str, wday[noaccess_val]);
safe_snprintf(str, maxlen, noaccess_str, noaccess_val);
if (!strcmp(sp, "LAST")) {
tp = strrchr(useron.alias, ' ');
if (tp)
tp++;
else
tp = useron.alias;
if (!strcmp(sp, "REAL") || !strcmp(sp, "FIRSTREAL")) {
safe_snprintf(str, maxlen, "%s", useron.name);
tp = strchr(str, ' ');
if (!strcmp(sp, "LASTREAL")) {
tp = strrchr(useron.name, ' ');
if (tp)
tp++;
else
tp = useron.name;
if (!strcmp(sp, "MAILR")) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, useron.number, /* Sent: */ FALSE, /* attr: */ MSG_READ));
if (!strcmp(sp, "MAILU")) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, useron.number, /* Sent: */ FALSE, /* attr: */ ~MSG_READ));
if (!strcmp(sp, "MAILW")) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, useron.number, /* Sent: */ FALSE, /* attr: */ 0));
if (!strcmp(sp, "MAILP")) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, useron.number, /* Sent: */ TRUE, /* attr: */ 0));
}
if (!strcmp(sp, "SPAMW")) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, useron.number, /* Sent: */ FALSE, /* attr: */ MSG_SPAM));
if (!strncmp(sp, "MAILR:", 6) || !strncmp(sp, "MAILR#", 6)) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, atoi(sp + 6), /* Sent: */ FALSE, /* attr: */ MSG_READ));
if (!strncmp(sp, "MAILU:", 6) || !strncmp(sp, "MAILU#", 6)) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, atoi(sp + 6), /* Sent: */ FALSE, /* attr: */ ~MSG_READ));
if (!strncmp(sp, "MAILW:", 6) || !strncmp(sp, "MAILW#", 6)) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, atoi(sp + 6), /* Sent: */ FALSE, /* attr: */ 0));
if (!strncmp(sp, "MAILP:", 6) || !strncmp(sp, "MAILP#", 6)) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, atoi(sp + 6), /* Sent: */ TRUE, /* attr: */ 0));
}
if (!strncmp(sp, "SPAMW:", 6) || !strncmp(sp, "SPAMW#", 6)) {
safe_snprintf(str, maxlen, "%u", getmail(&cfg, atoi(sp + 6), /* Sent: */ FALSE, /* attr: */ MSG_SPAM));
if (!strcmp(sp, "MSGREPLY")) {
safe_snprintf(str, maxlen, "%c", cfg.sys_misc & SM_RA_EMU ? 'R' : 'A');
if (!strcmp(sp, "MSGREREAD")) {
safe_snprintf(str, maxlen, "%c", cfg.sys_misc & SM_RA_EMU ? 'A' : 'R');
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
if (!strncmp(sp, "STATS.", 6)) {
getstats(&cfg, 0, &stats);
sp += 6;
if (!strcmp(sp, "LOGONS"))
safe_snprintf(str, maxlen, "%u", stats.logons);
else if (!strcmp(sp, "LTODAY"))
safe_snprintf(str, maxlen, "%u", stats.ltoday);
else if (!strcmp(sp, "TIMEON"))
safe_snprintf(str, maxlen, "%u", stats.timeon);
else if (!strcmp(sp, "TTODAY"))
safe_snprintf(str, maxlen, "%u", stats.ttoday);
else if (!strcmp(sp, "ULS"))
safe_snprintf(str, maxlen, "%u", stats.uls);
else if (!strcmp(sp, "ULB"))
safe_snprintf(str, maxlen, "%" PRIu64, stats.ulb);
else if (!strcmp(sp, "DLS"))
safe_snprintf(str, maxlen, "%u", stats.dls);
else if (!strcmp(sp, "DLB"))
safe_snprintf(str, maxlen, "%" PRIu64, stats.dlb);
else if (!strcmp(sp, "PTODAY"))
safe_snprintf(str, maxlen, "%u", stats.ptoday);
else if (!strcmp(sp, "ETODAY"))
safe_snprintf(str, maxlen, "%u", stats.etoday);
else if (!strcmp(sp, "FTODAY"))
safe_snprintf(str, maxlen, "%u", stats.ftoday);
else if (!strcmp(sp, "NUSERS"))
safe_snprintf(str, maxlen, "%u", stats.nusers);
/* Message header codes */
if (!strcmp(sp, "MSG_TO") && current_msg != nullptr) {
if (pmode != NULL)
*pmode |= (current_msg->hdr.auxattr & MSG_HFIELDS_UTF8);
if (current_msg->to_ext != NULL)
safe_snprintf(str, maxlen, "%s #%s", current_msg_to == nullptr ? current_msg->to : current_msg_to, current_msg->to_ext);
else if (current_msg->to_net.addr != NULL) {
char tmp[128];
safe_snprintf(str, maxlen, "%s (%s)", current_msg_to == nullptr ? current_msg->to : current_msg_to
, smb_netaddrstr(¤t_msg->to_net, tmp));
} else
return current_msg_to == nullptr ? current_msg->to : current_msg_to;
if (!strcmp(sp, "MSG_TO_NAME") && current_msg != nullptr) {
if (pmode != NULL)
*pmode |= (current_msg->hdr.auxattr & MSG_HFIELDS_UTF8);
return current_msg_to == nullptr ? current_msg->to : current_msg_to;
}
if (!strcmp(sp, "MSG_TO_FIRST") && current_msg != nullptr) {
if (pmode != NULL)
*pmode |= (current_msg->hdr.auxattr & MSG_HFIELDS_UTF8);
safe_snprintf(str, maxlen, "%s", current_msg_to == nullptr ? current_msg->to : current_msg_to);
if ((tp = strchr(str, ' ')) != NULL)
*tp = '\0';
return str;
}
if (!strcmp(sp, "MSG_TO_EXT") && current_msg != NULL) {
if (current_msg->to_ext == NULL)
return nulstr;
return current_msg->to_ext;
if (!strcmp(sp, "MSG_TO_NET") && current_msg != NULL) {
if (current_msg->to_net.addr == NULL)
return smb_netaddrstr(¤t_msg->to_net, str);
if (!strcmp(sp, "MSG_TO_NETTYPE") && current_msg != NULL) {
if (current_msg->to_net.type == NET_NONE)
return smb_nettype((enum smb_net_type)current_msg->to_net.type);
if (!strcmp(sp, "MSG_CC") && current_msg != NULL)
return current_msg->cc_list == NULL ? nulstr : current_msg->cc_list;
if (!strcmp(sp, "MSG_FROM") && current_msg != nullptr) {
if (current_msg->hdr.attr & MSG_ANONYMOUS && !SYSOP)
return text[Anonymous];
*pmode |= (current_msg->hdr.auxattr & MSG_HFIELDS_UTF8);