Skip to content

Node.js based forum software built for the modern web

updated filter:sockets.sendNewPostToUids and added type

psychobunny9e7f92902969
diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js
index d3b772052e..aaee8a1500 100644
--- a/src/socket.io/posts.js
+++ b/src/socket.io/posts.js
@@ -52,7 +52,9 @@ SocketPosts.reply = function(socket, data, callback) {
return;
}
- plugins.fireHook('filter:sockets.sendNewPostsToUids', {uidsTo: uids, uidFrom: data.uid}, function(err, uids) {
+ plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: data.uid, type: "newPost"}, function(err, data) {
+ uids = data.uids;
+
for(var i=0; i<uids.length; ++i) {
if (parseInt(uids[i], 10) !== socket.uid) {
websockets.in('uid_' + uids[i]).emit('event:new_post', result);
diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js
index 44f78efcbe..4b2f50b021 100644
--- a/src/socket.io/topics.js
+++ b/src/socket.io/topics.js
@@ -47,12 +47,16 @@ SocketTopics.post = function(socket, data, callback) {
return;
}
- for(var i=0; i<uids.length; ++i) {
- if (parseInt(uids[i], 10) !== socket.uid) {
- websockets.in('uid_' + uids[i]).emit('event:new_post', {posts: result.postData});
- websockets.in('uid_' + uids[i]).emit('event:new_topic', result.topicData);
+ plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: data.uid, type: "newTopic"}, function(err, data) {
+ uids = data.uids;
+
+ for(var i=0; i<uids.length; ++i) {
+ if (parseInt(uids[i], 10) !== socket.uid) {
+ websockets.in('uid_' + uids[i]).emit('event:new_post', {posts: result.postData});
+ websockets.in('uid_' + uids[i]).emit('event:new_topic', result.topicData);
+ }
}
- }
+ });
});
websockets.emitTopicPostStats();