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 /common | |
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 'common')
-rw-r--r-- | common/subscriptions.c | 7 | ||||
-rw-r--r-- | common/subscriptions.h | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/common/subscriptions.c b/common/subscriptions.c index 529c339..60ce002 100644 --- a/common/subscriptions.c +++ b/common/subscriptions.c @@ -1,12 +1,12 @@ #include "subscriptions.h" -void common_subscription_add(struct subscription** subscriptions, const char* rid, const char* name, enum subscription_type type, size_t unread) +void common_subscription_add(struct subscription** subscriptions, const char* rid, const char* name, enum subscription_type type, size_t unread, char alert) { - struct subscription * subscription = common_subscription_new(rid, name, type, unread); + struct subscription * subscription = common_subscription_new(rid, name, type, unread, alert); HASH_ADD_KEYPTR(hh, *subscriptions, subscription->rid, strlen(rid), subscription); } -struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread) +struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread, char alert) { struct subscription* subscription = malloc(sizeof(struct subscription)); subscription->rid = malloc(strlen(rid) + 1); @@ -15,6 +15,7 @@ struct subscription* common_subscription_new(const char* rid, const char* name, strcpy(subscription->name, name); subscription->type = type; subscription->unread = unread; + subscription->alert = alert; return subscription; } diff --git a/common/subscriptions.h b/common/subscriptions.h index e6f4771..1c42ad0 100644 --- a/common/subscriptions.h +++ b/common/subscriptions.h @@ -14,11 +14,12 @@ struct subscription { char* name; enum subscription_type type; size_t unread; + char alert; UT_hash_handle hh; }; -void common_subscription_add(struct subscription** subscriptions, const char* id, const char* name, enum subscription_type type, size_t unread); -struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread); +void common_subscription_add(struct subscription** subscriptions, const char* id, const char* name, enum subscription_type type, size_t unread, char alert); +struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread, char alert); void common_subscriptions_free(struct subscription* subscriptions); void common_subscriptions_const_walk(const struct subscription* subscriptions, void (*func)(const struct subscription*)); size_t common_subscriptions_count(const struct subscription* subscriptions); |