diff --git a/ethermess.c b/ethermess.c index 817a22a..f59e407 100644 --- a/ethermess.c +++ b/ethermess.c @@ -33,6 +33,7 @@ #define EMS_AVAILABLE 0 #define EMS_UNAVAILABLE 1 +#define EMS_OFFLINE 2 bool running = true; @@ -283,7 +284,7 @@ void handle_status(const unsigned char source_mac[6], const unsigned char *data, unsigned char status = data[0]; - if (status != EMS_AVAILABLE && status != EMS_UNAVAILABLE) { + if (status != EMS_AVAILABLE && status != EMS_UNAVAILABLE && status != EMS_OFFLINE) { // Unknown status, throw away fprintf(stderr, "Unknown status %u\n", status); // debg return; @@ -315,11 +316,15 @@ void handle_status(const unsigned char source_mac[6], const unsigned char *data, err(1, "printf"); } + errno = 0; if (status == EMS_UNAVAILABLE) { - errno = 0; if (printf("(unavailable) ") == -1) { err(1, "printf"); } + } else if (status == EMS_OFFLINE) { + if (printf("(offline) ") == -1) { + err(1, "printf"); + } } for (size_t i = 0; i < (size_t)nick_length; i++) {