diff options
author | Julien Dessaux | 2020-08-14 11:22:10 +0200 |
---|---|---|
committer | Julien Dessaux | 2020-08-14 11:22:10 +0200 |
commit | 0327cba62d6e32d47a249ef10dd56baa421b6f8a (patch) | |
tree | c014dd2900374eb4ef033f870cdb2f5a53a0fc43 /restapi | |
parent | Removed useless type (diff) | |
download | rocket-cli-client-0327cba62d6e32d47a249ef10dd56baa421b6f8a.tar.gz rocket-cli-client-0327cba62d6e32d47a249ef10dd56baa421b6f8a.tar.bz2 rocket-cli-client-0327cba62d6e32d47a249ef10dd56baa421b6f8a.zip |
Handle the alert flag in subscriptions
Diffstat (limited to 'restapi')
-rw-r--r-- | restapi/subscriptions.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/restapi/subscriptions.c b/restapi/subscriptions.c index 5a1abe6..a296b1c 100644 --- a/restapi/subscriptions.c +++ b/restapi/subscriptions.c @@ -42,8 +42,9 @@ restapi_subscriptions_get(void) const cJSON* type = cJSON_GetObjectItemCaseSensitive(update, "t"); const cJSON* open = cJSON_GetObjectItemCaseSensitive(update, "open"); const cJSON* unread = cJSON_GetObjectItemCaseSensitive(update, "unread"); + const cJSON* alert = cJSON_GetObjectItemCaseSensitive(update, "alert"); enum subscription_type etype; - if (!cJSON_IsString(rid) || rid->valuestring == NULL || !cJSON_IsString(name) || name->valuestring == NULL || !cJSON_IsString(type) || type->valuestring == NULL || !cJSON_IsTrue(open) || !cJSON_IsNumber(unread)) + if (!cJSON_IsString(rid) || rid->valuestring == NULL || !cJSON_IsString(name) || name->valuestring == NULL || !cJSON_IsString(type) || type->valuestring == NULL || !cJSON_IsTrue(open) || !cJSON_IsNumber(unread) || !(cJSON_IsTrue(alert) || cJSON_IsFalse(alert))) continue; if (strcmp(type->valuestring, "c") == 0) etype = SUBSCRIPTION_CHANNEL; @@ -55,7 +56,7 @@ restapi_subscriptions_get(void) fprintf(stderr, "Bug found : Unknown subscription type %s\n%s\n", type->valuestring, buffer); exit(999); } - common_subscription_add(&subscriptions, rid->valuestring, name->valuestring, etype, unread->valueint); + common_subscription_add(&subscriptions, rid->valuestring, name->valuestring, etype, unread->valueint, cJSON_IsTrue(alert)); } } get_json_cleanup: |