From 8296dc56304e294966f34b8c777c6010d7f4e376 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 24 Jul 2014 17:30:37 -0400 Subject: [PATCH] beginning topic searching + new hook --- src/socket.io/topics.js | 4 ++++ src/topics.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index 274950d455..c00745d2ae 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -417,4 +417,8 @@ SocketTopics.searchTags = function(socket, data, callback) { topics.searchTags(data, callback); }; +SocketTopics.search = function(socket, data, callback) { + topics.search(data.tid, data.term, callback); +}; + module.exports = SocketTopics; diff --git a/src/topics.js b/src/topics.js index addde2cdda..c4f784b811 100644 --- a/src/topics.js +++ b/src/topics.js @@ -446,4 +446,15 @@ var async = require('async'), }); }; + Topics.search = function(tid, term, callback) { + if (plugins.hasListeners('filter:topic.search')) { + plugins.fireHook('filter:topic.search', { + tid: tid, + term: term + }, callback); + } else { + callback(undefined, []); + } + }; + }(exports));