Allow for status telling other end is going offline
This commit is contained in:
parent
f678c5054f
commit
87d0b33b3b
1 changed files with 7 additions and 2 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Reference in a new issue