Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
db640272
Commit
db640272
authored
2 years ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Add a public "no value" function
This can be used to clear a 'retained' topic (of any type).
parent
4908a388
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/mqtt.c
+24
-0
24 additions, 0 deletions
src/sbbs3/mqtt.c
src/sbbs3/mqtt.h
+1
-0
1 addition, 0 deletions
src/sbbs3/mqtt.h
with
25 additions
and
0 deletions
src/sbbs3/mqtt.c
+
24
−
0
View file @
db640272
...
@@ -148,6 +148,30 @@ int mqtt_lputs(struct mqtt* mqtt, enum topic_depth depth, int level, const char*
...
@@ -148,6 +148,30 @@ int mqtt_lputs(struct mqtt* mqtt, enum topic_depth depth, int level, const char*
return
MQTT_FAILURE
;
return
MQTT_FAILURE
;
}
}
int
mqtt_pub_noval
(
struct
mqtt
*
mqtt
,
enum
topic_depth
depth
,
const
char
*
key
)
{
if
(
mqtt
==
NULL
||
mqtt
->
cfg
==
NULL
)
return
MQTT_FAILURE
;
if
(
!
mqtt
->
cfg
->
mqtt
.
enabled
)
return
MQTT_SUCCESS
;
#ifdef USE_MOSQUITTO
if
(
mqtt
!=
NULL
&&
mqtt
->
handle
!=
NULL
)
{
char
sub
[
128
];
mqtt_topic
(
mqtt
,
depth
,
sub
,
sizeof
(
sub
),
"%s"
,
key
);
return
mosquitto_publish_v5
(
mqtt
->
handle
,
/* mid: */
NULL
,
/* topic: */
sub
,
/* payloadlen */
0
,
/* payload */
NULL
,
/* qos */
mqtt
->
cfg
->
mqtt
.
publish_qos
,
/* retain */
true
,
/* properties */
NULL
);
}
#endif
return
MQTT_FAILURE
;
}
int
mqtt_pub_strval
(
struct
mqtt
*
mqtt
,
enum
topic_depth
depth
,
const
char
*
key
,
const
char
*
str
)
int
mqtt_pub_strval
(
struct
mqtt
*
mqtt
,
enum
topic_depth
depth
,
const
char
*
key
,
const
char
*
str
)
{
{
if
(
mqtt
==
NULL
||
mqtt
->
cfg
==
NULL
)
if
(
mqtt
==
NULL
||
mqtt
->
cfg
==
NULL
)
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/mqtt.h
+
1
−
0
View file @
db640272
...
@@ -62,6 +62,7 @@ DLLEXPORT char* mqtt_libver(char* str, size_t size);
...
@@ -62,6 +62,7 @@ DLLEXPORT char* mqtt_libver(char* str, size_t size);
DLLEXPORT
char
*
mqtt_topic
(
struct
mqtt
*
,
enum
topic_depth
,
char
*
str
,
size_t
size
,
const
char
*
fmt
,
...);
DLLEXPORT
char
*
mqtt_topic
(
struct
mqtt
*
,
enum
topic_depth
,
char
*
str
,
size_t
size
,
const
char
*
fmt
,
...);
DLLEXPORT
int
mqtt_subscribe
(
struct
mqtt
*
,
enum
topic_depth
,
char
*
str
,
size_t
size
,
const
char
*
fmt
,
...);
DLLEXPORT
int
mqtt_subscribe
(
struct
mqtt
*
,
enum
topic_depth
,
char
*
str
,
size_t
size
,
const
char
*
fmt
,
...);
DLLEXPORT
int
mqtt_lputs
(
struct
mqtt
*
,
enum
topic_depth
,
int
level
,
const
char
*
str
);
DLLEXPORT
int
mqtt_lputs
(
struct
mqtt
*
,
enum
topic_depth
,
int
level
,
const
char
*
str
);
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_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_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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment