aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/subscriptions.c7
-rw-r--r--common/subscriptions.h5
2 files changed, 7 insertions, 5 deletions
diff --git a/common/subscriptions.c b/common/subscriptions.c
index d6d15aa..0874cb0 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* id, const char* name, enum subscription_type type)
+void common_subscription_add(struct subscription** subscriptions, const char* id, const char* name, enum subscription_type type, size_t unread)
{
- struct subscription * subscription = common_subscription_new(id, name, type);
+ struct subscription * subscription = common_subscription_new(id, name, type, unread);
HASH_ADD_KEYPTR(hh, *subscriptions, subscription->id, strlen(id), subscription);
}
-struct subscription* common_subscription_new(const char* id, const char* name, enum subscription_type type)
+struct subscription* common_subscription_new(const char* id, const char* name, enum subscription_type type, size_t unread)
{
struct subscription* subscription = malloc(sizeof(struct subscription));
subscription->id = malloc(strlen(id) + 1);
@@ -14,6 +14,7 @@ struct subscription* common_subscription_new(const char* id, const char* name, e
subscription->name = malloc(strlen(name) + 1);
strcpy(subscription->name, name);
subscription->type = type;
+ subscription->unread = unread;
return subscription;
}
diff --git a/common/subscriptions.h b/common/subscriptions.h
index 6c10a24..a152345 100644
--- a/common/subscriptions.h
+++ b/common/subscriptions.h
@@ -17,11 +17,12 @@ struct subscription {
char* id;
char* name;
enum subscription_type type;
+ size_t unread;
UT_hash_handle hh;
};
-void common_subscription_add(struct subscription** subscriptions, const char* id, const char* name, enum subscription_type type);
-struct subscription* common_subscription_new(const char* id, const char* name, enum subscription_type type);
+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* id, const char* name, enum subscription_type type, size_t unread);
void common_subscriptions_free(struct subscription* subscriptions);
void common_subscriptions_const_walk(const struct subscription* subscriptions, void (*func)(const struct subscription*));