slave: user-notifications: emit errors first, then warnings and last deprecations

This commit is contained in:
Daniel Eklöf 2020-07-31 17:10:39 +02:00
parent 9b0376efc3
commit b661513245
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

23
slave.c
View file

@ -102,9 +102,28 @@ emit_one_notification(int fd, const struct user_notification *notif)
static bool
emit_notifications(int fd, const user_notifications_t *notifications)
{
/* Errors first */
tll_foreach(*notifications, it) {
if (!emit_one_notification(fd, &it->item))
return false;
if (it->item.kind == USER_NOTIFICATION_ERROR) {
if (!emit_one_notification(fd, &it->item))
return false;
}
}
/* Then warnings */
tll_foreach(*notifications, it) {
if (it->item.kind == USER_NOTIFICATION_WARNING) {
if (!emit_one_notification(fd, &it->item))
return false;
}
}
/* Finally deprecation messages */
tll_foreach(*notifications, it) {
if (it->item.kind == USER_NOTIFICATION_DEPRECATED) {
if (!emit_one_notification(fd, &it->item))
return false;
}
}
return true;