Commits (2)
......@@ -573,7 +573,7 @@ bool sbbs_t::update_nodeterm(void)
if(cfg.mqtt.enabled) {
char str[256];
char topic[128];
SAFEPRINTF(topic, "nodes/%u/terminal", cfg.node_num);
SAFEPRINTF(topic, "node/%u/terminal", cfg.node_num);
snprintf(str, sizeof(str), "%lu\t%lu\t%s\t%s\t%s\t%lx\t%lx\t%lx"
,cols
,rows
......
......@@ -2292,7 +2292,7 @@ void output_thread(void* arg)
if(sbbs->cfg.node_num) {
SAFEPRINTF(node,"Node %d",sbbs->cfg.node_num);
SAFEPRINTF(spy_topic, "nodes/%d/output", sbbs->cfg.node_num);
SAFEPRINTF(spy_topic, "node/%d/output", sbbs->cfg.node_num);
} else
SAFECOPY(node,sbbs->client_name);
#ifdef _DEBUG
......@@ -4413,7 +4413,7 @@ void node_thread(void* arg)
long tused = (long)(now - sbbs->logontime);
if(tused < 0)
tused = 0;
SAFEPRINTF(topic, "nodes/%u/laston", sbbs->cfg.node_num);
SAFEPRINTF(topic, "node/%u/laston", sbbs->cfg.node_num);
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);
}
......@@ -4993,7 +4993,8 @@ void bbs_thread(void* arg)
startup->last_node=scfg.sys_nodes;
}
mqtt_pub_uintval(&mqtt, TOPIC_BBS, "nodes", scfg.sys_nodes);
SAFEPRINTF(str, "%u total", scfg.sys_nodes);
mqtt_pub_strval(&mqtt, TOPIC_BBS, "node", str);
/* Create missing directories */
lprintf(LOG_INFO,"Verifying/creating data directories");
......
......@@ -94,10 +94,10 @@ static char* format_topic(struct mqtt* mqtt, enum server_type type, enum topic_d
safe_snprintf(str, size, "sbbs/%s/%s", mqtt->cfg->sys_id, mqtt->host);
break;
case TOPIC_SERVER:
safe_snprintf(str, size, "sbbs/%s/%s/%s/%s", mqtt->cfg->sys_id, mqtt->host, server_type_desc(type), sbuf);
safe_snprintf(str, size, "sbbs/%s/%s/server/%s/%s", mqtt->cfg->sys_id, mqtt->host, server_type_desc(type), sbuf);
break;
case TOPIC_SERVER_LEVEL:
safe_snprintf(str, size, "sbbs/%s/%s/%s", mqtt->cfg->sys_id, mqtt->host, server_type_desc(type));
safe_snprintf(str, size, "sbbs/%s/%s/server/%s", mqtt->cfg->sys_id, mqtt->host, server_type_desc(type));
break;
case TOPIC_EVENT:
safe_snprintf(str, size, "sbbs/%s/%s/event/%s", mqtt->cfg->sys_id, mqtt->host, sbuf);
......@@ -457,7 +457,7 @@ static void mqtt_message_received(struct mosquitto* mosq, void* cbdata, const st
if(mqtt->startup->type == SERVER_TERM) {
bbs_startup_t* bbs_startup = (bbs_startup_t*)mqtt->startup;
for(int i = bbs_startup->first_node; i <= bbs_startup->last_node; i++) {
mqtt_topic(mqtt, TOPIC_BBS, topic, sizeof(topic), "nodes/%d/input", i);
mqtt_topic(mqtt, TOPIC_BBS, topic, sizeof(topic), "node/%d/input", i);
if(strcmp(msg->topic, topic) != 0)
continue;
if(bbs_startup->node_inbuf != NULL && bbs_startup->node_inbuf[i - 1] != NULL)
......@@ -523,7 +523,7 @@ int mqtt_startup(struct mqtt* mqtt, scfg_t* cfg, struct startup* startup, const
bbs_startup_t* bbs_startup = (bbs_startup_t*)startup;
char str[128];
for(int i = bbs_startup->first_node; i <= bbs_startup->last_node; i++) {
mqtt_subscribe(mqtt, TOPIC_BBS, str, sizeof(str), "nodes/%d/input", i);
mqtt_subscribe(mqtt, TOPIC_BBS, str, sizeof(str), "node/%d/input", i);
}
}
mqtt_pub_noval(mqtt, TOPIC_SERVER, "recycle");
......
......@@ -102,10 +102,10 @@ int sbbs_t::putnodedat(uint number, node_t* node)
,node->extaux
,node->errors
);
SAFEPRINTF(topic, "nodes/%u/status", number + 1);
SAFEPRINTF(topic, "node/%u/status", number + 1);
int result = mqtt_pub_strval(mqtt, TOPIC_BBS, topic, str);
if(result == MQTT_SUCCESS && cfg.mqtt.verbose) {
SAFEPRINTF(topic, "nodes/%u", number + 1);
SAFEPRINTF(topic, "node/%u", number + 1);
result = mqtt_pub_strval(mqtt, TOPIC_BBS, topic
,nodestatus(&cfg, node, str, sizeof(str), number + 1));
}
......