aboutsummaryrefslogtreecommitdiff
path: root/restapi
diff options
context:
space:
mode:
authorJulien Dessaux2019-08-06 19:55:31 +0200
committerJulien Dessaux2019-08-06 19:55:31 +0200
commita753a35c37ac9b01f7e22912f8cad50603fc5ec0 (patch)
tree6758289f6456b116a25fa1aa476d9746d5d247b7 /restapi
parentHave the login function return the authToken (diff)
downloadrocket-cli-client-a753a35c37ac9b01f7e22912f8cad50603fc5ec0.tar.gz
rocket-cli-client-a753a35c37ac9b01f7e22912f8cad50603fc5ec0.tar.bz2
rocket-cli-client-a753a35c37ac9b01f7e22912f8cad50603fc5ec0.zip
Have the subscription struct hold the unread counters
Diffstat (limited to '')
-rw-r--r--restapi/subscriptions.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/restapi/subscriptions.c b/restapi/subscriptions.c
index b52ea9a..e41cf95 100644
--- a/restapi/subscriptions.c
+++ b/restapi/subscriptions.c
@@ -41,8 +41,9 @@ restapi_subscriptions_get(void)
const cJSON* name = cJSON_GetObjectItemCaseSensitive(update, "name");
const cJSON* type = cJSON_GetObjectItemCaseSensitive(update, "t");
const cJSON* open = cJSON_GetObjectItemCaseSensitive(update, "open");
+ const cJSON* unread = cJSON_GetObjectItemCaseSensitive(update, "unread");
enum subscription_type etype;
- if (!cJSON_IsString(id) || id->valuestring == NULL || !cJSON_IsString(name) || name->valuestring == NULL || !cJSON_IsString(type) || type->valuestring == NULL || !cJSON_IsTrue(open))
+ if (!cJSON_IsString(id) || id->valuestring == NULL || !cJSON_IsString(name) || name->valuestring == NULL || !cJSON_IsString(type) || type->valuestring == NULL || !cJSON_IsTrue(open) || !cJSON_IsNumber(unread))
continue;
if (strcmp(type->valuestring, "c") == 0)
etype = SUBSCRIPTION_CHANNEL;
@@ -54,7 +55,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, id->valuestring, name->valuestring, etype);
+ common_subscription_add(&subscriptions, id->valuestring, name->valuestring, etype, unread->valueint);
}
}
get_json_cleanup: