Commits (1)
......@@ -2482,7 +2482,7 @@ void output_thread(void* arg)
}
/* Spy on the user remotely */
if(sbbs->cfg.mqtt.enabled) {
int result = mqtt_pub_message(&mqtt, TOPIC_BBS, spy_topic, buf+bufbot, i);
int result = mqtt_pub_message(&mqtt, TOPIC_BBS, spy_topic, buf+bufbot, i, /* retain: */false);
if(result != MQTT_SUCCESS)
lprintf(LOG_WARNING, "%s ERROR %d (%d) publishing node output (%u bytes): %s"
,node, result, errno, i, spy_topic);
......
......@@ -174,7 +174,7 @@ int mqtt_lputs(struct mqtt* mqtt, enum topic_depth depth, int level, const char*
/* payloadlen */strlen(str),
/* payload */str,
/* qos */mqtt->cfg->mqtt.publish_qos,
/* retain */false,
/* retain */true,
/* properties */NULL);
mqtt_topic(mqtt, depth, sub, sizeof(sub), "log");
mosquitto_property* props = NULL;
......@@ -185,7 +185,7 @@ int mqtt_lputs(struct mqtt* mqtt, enum topic_depth depth, int level, const char*
/* payloadlen */strlen(str),
/* payload */str,
/* qos */mqtt->cfg->mqtt.publish_qos,
/* retain */false,
/* retain */true,
/* properties */props);
mosquitto_property_free_all(&props);
return result;
......@@ -266,7 +266,7 @@ int mqtt_pub_uintval(struct mqtt* mqtt, enum topic_depth depth, const char* key,
return MQTT_FAILURE;
}
int mqtt_pub_message(struct mqtt* mqtt, enum topic_depth depth, const char* key, const void* buf, size_t len)
int mqtt_pub_message(struct mqtt* mqtt, enum topic_depth depth, const char* key, const void* buf, size_t len, BOOL retain)
{
if(mqtt == NULL || mqtt->cfg == NULL)
return MQTT_FAILURE;
......@@ -282,7 +282,7 @@ int mqtt_pub_message(struct mqtt* mqtt, enum topic_depth depth, const char* key,
/* payloadlen */len,
/* payload */buf,
/* qos */mqtt->cfg->mqtt.publish_qos,
/* retain */false,
/* retain */retain,
/* properties */NULL);
}
#endif
......
......@@ -53,14 +53,14 @@ struct mqtt {
enum topic_depth {
TOPIC_OTHER,
TOPIC_ROOT, // sbbs/*
TOPIC_BBS, // sbbs/BBS-ID/*
TOPIC_BBS_LEVEL, // sbbs/BBS-ID
TOPIC_HOST, // sbbs/BBS-ID/hostname/*
TOPIC_HOST_LEVEL, // sbbs/BBS-DI/hostname
TOPIC_EVENT, // sbbs/BBS-ID/event/*
TOPIC_SERVER, // sbbs/BBS-ID/server/*
TOPIC_SERVER_LEVEL, // sbbs/BBS-ID/server
TOPIC_ROOT, // sbbs/*
TOPIC_BBS, // sbbs/BBSID/*
TOPIC_BBS_LEVEL, // sbbs/BBSID
TOPIC_HOST, // sbbs/BBSID/host/HOSTNAME/*
TOPIC_HOST_LEVEL, // sbbs/BBSID/host/HOSTNAME
TOPIC_EVENT, // sbbs/BBSID/event/*
TOPIC_SERVER, // sbbs/BBSID/server/SERVER/*
TOPIC_SERVER_LEVEL, // sbbs/BBSID/server/SERVER
};
#define MQTT_SUCCESS 0 // Same as MOSQ_ERR_SUCCESS
......@@ -85,7 +85,7 @@ DLLEXPORT int mqtt_lputs(struct mqtt*, enum topic_depth, int level, const char*
DLLEXPORT int mqtt_pub_noval(struct mqtt*, enum topic_depth, const char* key);
DLLEXPORT int mqtt_pub_strval(struct mqtt*, enum topic_depth, const char* key, const char* str);
DLLEXPORT int mqtt_pub_uintval(struct mqtt*, enum topic_depth, const char* key, ulong value);
DLLEXPORT int mqtt_pub_message(struct mqtt*, enum topic_depth, const char* key, const void* buf, size_t len);
DLLEXPORT int mqtt_pub_message(struct mqtt*, enum topic_depth, const char* key, const void* buf, size_t len, BOOL retain);
DLLEXPORT int mqtt_open(struct mqtt*);
DLLEXPORT void mqtt_close(struct mqtt*);
DLLEXPORT int mqtt_connect(struct mqtt*, const char* bind_address);
......