#define CHAT_PORT 531
static void log_message(meshlink_handle_t *mesh, meshlink_log_level_t level, const char *text) {
- const char *levelstr[] = {
+ (void) mesh;
+
+ static const char *levelstr[] = {
[MESHLINK_DEBUG] = "\x1b[34mDEBUG",
[MESHLINK_INFO] = "\x1b[32mINFO",
[MESHLINK_WARNING] = "\x1b[33mWARNING",
}
static bool channel_accept(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint16_t port, const void *data, size_t len) {
+ (void)data;
+ (void)len;
+
// Only accept connections to the chat port
if(port != CHAT_PORT) {
fprintf(stderr, "Rejected incoming channel from '%s' to port %u\n", channel->node->name, port);
}
static void channel_poll(meshlink_handle_t *mesh, meshlink_channel_t *channel, size_t len) {
+ (void)len;
+
fprintf(stderr, "Channel to '%s' connected\n", channel->node->name);
meshlink_set_channel_poll_cb(mesh, channel, NULL);
}
static void node_status(meshlink_handle_t *mesh, meshlink_node_t *node, bool reachable) {
+ (void)mesh;
+
if(reachable) {
printf("%s joined.\n", node->name);
} else {
} else {
printf("%zu known nodes:", nnodes);
- for(int i = 0; i < nnodes; i++) {
+ for(size_t i = 0; i < nnodes; i++) {
printf(" %s", nodes[i]->name);
}
// Commands start with '/'
if(*buf == '/') {
- return parse_command(mesh, buf + 1);
+ parse_command(mesh, buf + 1);
+ return;
}
// Lines in the form "name: message..." set the destination node.