mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-27 16:57:21 +00:00
add udata to monitor hook
This commit is contained in:
@@ -15,4 +15,4 @@ base64.o: base64.h base64.c
|
||||
ghash.o: ghash.h ghash.c config.h udata.h
|
||||
safewrite.o: safewrite.h safewrite.c
|
||||
jget.o: jget.c jget.h json.h
|
||||
misc.o: misc.c misc.h
|
||||
misc.o: misc.c misc.h udata.h
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "utstring.h"
|
||||
#include "ctype.h"
|
||||
#include "udata.h"
|
||||
#include "misc.h"
|
||||
|
||||
char *bindump(char *buf, long buflen)
|
||||
@@ -28,6 +29,14 @@ char *bindump(char *buf, long buflen)
|
||||
* a monitoring hoook.
|
||||
*/
|
||||
|
||||
void monitorhook(time_t now, char *topic)
|
||||
void monitorhook(struct udata *userdata, time_t now, char *topic)
|
||||
{
|
||||
struct udata *ud = (struct udata *)userdata;
|
||||
|
||||
#ifdef HAVE_REDIS
|
||||
if (ud->useredis) {
|
||||
}
|
||||
#endif
|
||||
if (ud->usefiles) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include <time.h>
|
||||
char *bindump(char *buf, long buflen);
|
||||
void monitorhook(time_t now, char *topic);
|
||||
void monitorhook(struct udata *ud, time_t now, char *topic);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
|
||||
time(&now);
|
||||
|
||||
monitorhook(now, m->topic);
|
||||
monitorhook(ud, now, m->topic);
|
||||
|
||||
/* FIXME: handle null leading topic `/` */
|
||||
utstring_printf(basetopic, "%s/%s/%s", topics[0], topics[1], topics[2]);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef UDATA_H_INCLUDED
|
||||
# define UDATA_H_INCLUDED
|
||||
|
||||
#include "config.h"
|
||||
#include "utarray.h"
|
||||
#ifdef HAVE_REDIS
|
||||
@@ -16,3 +19,5 @@ struct udata {
|
||||
int skipdemo; /* True if _demo users are to be skipped */
|
||||
int useredis; /* True if we should do Redis (if we have it) */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user