Commits (4)
......@@ -373,7 +373,6 @@ bool sbbs_t::answer()
else
SAFECOPY(terminal,"DUMB");
}
update_nodeterm();
/* AutoLogon via IP or Caller ID here */
if(!useron.number && !(sys_status&SS_RLOGIN)
......@@ -459,6 +458,8 @@ bool sbbs_t::answer()
SAFECOPY(client_ipaddr, cid); /* Over-ride IP address with Caller-ID info */
SAFECOPY(useron.comp,client_name);
update_nodeterm();
if(!useron.number
&& rlogin_name[0]!=0
&& !(cfg.sys_misc&SM_CLOSED)
......
......@@ -553,6 +553,7 @@ bool sbbs_t::update_nodeterm(void)
str_list_t ini = strListInit();
iniSetInteger(&ini, ROOT_SECTION, "cols", cols, NULL);
iniSetInteger(&ini, ROOT_SECTION, "rows", rows, NULL);
iniSetString(&ini, ROOT_SECTION, "desc", terminal, NULL);
iniSetString(&ini, ROOT_SECTION, "type", term_type(), NULL);
iniSetString(&ini, ROOT_SECTION, "chars", term_charset(), NULL);
iniSetHexInt(&ini, ROOT_SECTION, "flags", term_supports(), NULL);
......@@ -573,9 +574,10 @@ bool sbbs_t::update_nodeterm(void)
char str[256];
char topic[128];
SAFEPRINTF(topic, "node%u/terminal", cfg.node_num);
snprintf(str, sizeof(str), "%lu\t%lu\t%s\t%s\t%lx\t%lx\t%lx"
snprintf(str, sizeof(str), "%lu\t%lu\t%s\t%s\t%s\t%lx\t%lx\t%lx"
,cols
,rows
,terminal
,term_type()
,term_charset()
,term_supports()
......
......@@ -4397,19 +4397,24 @@ void node_thread(void* arg)
if(login_success)
sbbs->logoffstats(); /* Updates both system and node dsts.ini (daily statistics) files */
time_t now = time(NULL);
SAFEPRINTF(str, "%sclient.ini", sbbs->cfg.node_dir);
FILE* fp = fopen(str, "at");
if(fp != NULL) {
fprintf(fp, "user=%u\n", sbbs->useron.number);
fprintf(fp, "name=%s\n", sbbs->useron.alias);
fprintf(fp, "done=%lu\n", (ulong)time(NULL));
fprintf(fp, "done=%lu\n", (ulong)now);
fclose(fp);
}
if(sbbs->useron.number) {
char topic[128];
char tmp[32];
long tused = (long)(now - sbbs->logontime);
if(tused < 0)
tused = 0;
SAFEPRINTF(topic, "node%u/laston", sbbs->cfg.node_num);
SAFEPRINTF2(str, "%u\t%s", sbbs->useron.number, sbbs->useron.alias);
snprintf(str, sizeof(str), "%u\t%s\t%s", sbbs->useron.number, sbbs->useron.alias, sectostr(tused, tmp));
mqtt_pub_strval(&mqtt, TOPIC_BBS, topic, str);
}
......
......@@ -104,6 +104,11 @@ int sbbs_t::putnodedat(uint number, node_t* node)
);
SAFEPRINTF(topic, "node%u/status", number + 1);
int result = mqtt_pub_strval(mqtt, TOPIC_BBS, topic, str);
if(result == MQTT_SUCCESS) {
SAFEPRINTF(topic, "node%u", number + 1);
result = mqtt_pub_strval(mqtt, TOPIC_BBS, topic
,nodestatus(&cfg, node, str, sizeof(str), number + 1));
}
if(result != MQTT_SUCCESS)
lprintf(LOG_WARNING, "ERROR %d (%d) publishing node status: %s", result, errno, topic);
}
......