Add support for "muting" accounts
Muted accounts do not update reference or subscription indexes, making
them effectively invisible, but unaware of the fact.
flock(blerg->data_fd, LOCK_UN);
flock(blerg->index_fd, LOCK_UN);
- /* Now do those dirty microblogging deeds */
- tag_scan(blerg->name, data, len, record);
- subscription_notify(blerg->name, record);
+ if (!blerg_get_mute(blerg)) {
+ /* Now do those dirty microblogging deeds */
+ tag_scan(blerg->name, data, len, record);
+ subscription_notify(blerg->name, record);
+ }
return record;
}
CHECK_VALID_BLERG(0)
return blerg->meta->subscription_mark;
}
+
+int blerg_set_mute(struct blerg *blerg, int v) {
+ CHECK_VALID_BLERG(0)
+ if (v) {
+ blerg->meta->status |= BLERGMETA_MUTED;
+ } else {
+ blerg->meta->status &= ~BLERGMETA_MUTED;
+ }
+ return 1;
+}
+
+int blerg_get_mute(struct blerg *blerg) {
+ CHECK_VALID_BLERG(0)
+ return (blerg->meta->status & BLERGMETA_MUTED) > 0;
+}
struct meta {
uint64_t sequence;
uint64_t subscription_mark;
+ uint32_t status;
};
+#define BLERGMETA_MUTED 0x00000001
+
struct blerg {
int meta_fd;
int index_fd;
time_t blerg_get_timestamp(struct blerg *blerg, int record);
int blerg_set_subscription_mark(struct blerg *blerg);
uint64_t blerg_get_subscription_mark(struct blerg *blerg);
+int blerg_set_mute(struct blerg *blerg, int v);
+int blerg_get_mute(struct blerg *blerg);
#endif //_DATABASE_H