mirror of
https://github.com/owntracks/recorder.git
synced 2026-02-13 20:49:51 +00:00
add (empty for now) monitoring hook
This commit is contained in:
10
misc.c
10
misc.c
@@ -21,3 +21,13 @@ char *bindump(char *buf, long buflen)
|
||||
}
|
||||
return (utstring_body(out));
|
||||
}
|
||||
|
||||
/*
|
||||
* At each received message, the recorder invokes this function with the
|
||||
* current epoch time and the topic being handled. Use this to update
|
||||
* a monitoring hoook.
|
||||
*/
|
||||
|
||||
void monitorhook(time_t now, char *topic)
|
||||
{
|
||||
}
|
||||
|
||||
7
misc.h
7
misc.h
@@ -1 +1,8 @@
|
||||
#ifndef MISC_H_INCLUDED
|
||||
# define MISC_H_INCLUDED
|
||||
|
||||
#include <time.h>
|
||||
char *bindump(char *buf, long buflen);
|
||||
void monitorhook(time_t now, char *topic);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -388,6 +388,8 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
|
||||
time(&now);
|
||||
|
||||
monitorhook(now, m->topic);
|
||||
|
||||
/* FIXME: handle null leading topic `/` */
|
||||
utstring_printf(basetopic, "%s/%s/%s", topics[0], topics[1], topics[2]);
|
||||
utstring_printf(username, "%s", topics[1]);
|
||||
|
||||
Reference in New Issue
Block a user