2013-08-20 22:05:56 +02:00
|
|
|
var muting = (function () {
|
|
|
|
|
|
|
|
var exports = {};
|
|
|
|
|
|
|
|
var muted_topics = new Dict();
|
|
|
|
|
|
|
|
exports.mute_topic = function (stream, topic) {
|
|
|
|
var sub_dict = muted_topics.get(stream);
|
|
|
|
if (!sub_dict) {
|
|
|
|
sub_dict = new Dict();
|
|
|
|
muted_topics.set(stream, sub_dict);
|
|
|
|
}
|
|
|
|
sub_dict.set(topic, true);
|
|
|
|
};
|
|
|
|
|
2013-09-09 20:33:25 +02:00
|
|
|
exports.unmute_topic = function (stream, topic) {
|
|
|
|
var sub_dict = muted_topics.get(stream);
|
|
|
|
if (sub_dict) {
|
|
|
|
sub_dict.del(topic);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-08-20 22:05:56 +02:00
|
|
|
exports.is_topic_muted = function (stream, topic) {
|
|
|
|
var sub_dict = muted_topics.get(stream);
|
|
|
|
return sub_dict && sub_dict.get(topic);
|
|
|
|
};
|
|
|
|
|
|
|
|
return exports;
|
|
|
|
}());
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = muting;
|
|
|
|
}
|