From: Darren Date: Sat, 18 Oct 2014 17:41:20 +0000 (+0100) Subject: Removing unneeded plugin callbacks X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7854356b140a5f6a24db496a73d92dbd19158788;p=KiwiIRC.git Removing unneeded plugin callbacks --- diff --git a/client/assets/plugins/textstyle.html b/client/assets/plugins/textstyle.html index 39ac9d0..4fc54ca 100644 --- a/client/assets/plugins/textstyle.html +++ b/client/assets/plugins/textstyle.html @@ -140,8 +140,6 @@ if (data.params[1]) { data.params[1] = style_codes + data.params[1]; } - - event.callback(); }); diff --git a/client/src/helpers/plugininterface.js b/client/src/helpers/plugininterface.js index 0c2782a..44f1598 100644 --- a/client/src/helpers/plugininterface.js +++ b/client/src/helpers/plugininterface.js @@ -111,7 +111,14 @@ if (typeof module === 'object' && typeof module.exports !== 'undefined') { var p = new PluginInterface(); p.on('test', function (event, data) { data.a += '!'; - event.callback(); +}); + +p.on('test', function (event, data) { + data.wait = true; + setTimeout(function() { + data.a += '!'; + event.callback(); + }, 1000); }); p.emit('test', {a: 'hello world'}).then(function (data) { diff --git a/server/plugininterface.js b/server/plugininterface.js index e9ec2f9..9bfed5f 100644 --- a/server/plugininterface.js +++ b/server/plugininterface.js @@ -114,7 +114,14 @@ if (typeof module === 'object' && typeof module.exports !== 'undefined') { var p = new PluginInterface(); p.on('test', function (event, data) { data.a += '!'; - event.callback(); +}); + +p.on('test', function (event, data) { + data.wait = true; + setTimeout(function() { + data.a += '!'; + event.callback(); + }, 1000); }); p.emit('test', {a: 'hello world'}).then(function (data) { diff --git a/server_modules/example.js b/server_modules/example.js index a12f8dd..d880c19 100644 --- a/server_modules/example.js +++ b/server_modules/example.js @@ -6,26 +6,22 @@ var module = new kiwiModules.Module('Example Module'); // A web client is connected module.on('client created', function(event, data) { console.log('[client connection]', data); - event.callback(); }); // The Client recieves a IRC PRIVMSG command module.on('irc message', function(event, data) { console.log('[MESSAGE]', data.irc_event); - event.callback(); }); // The Client recieves a IRC USER NOTICE command module.on('irc user notice', function(event, data) { console.log('[NOTICE]', data.irc_event); - event.callback(); }); // The client recieves an IRC JOIN command module.on('irc channel join', function(event, data) { console.log('[JOIN]', data.irc_event); - event.callback(); }); @@ -36,5 +32,4 @@ module.on('client command', function(event, data) { console.log('[CLIENT COMMAND]', client_method); console.log(' ', client_args); - event.callback(); }); diff --git a/server_modules/stats.js b/server_modules/stats.js index 6922c0f..736ba17 100644 --- a/server_modules/stats.js +++ b/server_modules/stats.js @@ -22,11 +22,9 @@ module.on('stat counter', function (event, event_data) { ignored_events.push('http.request'); if (ignored_events.indexOf(stat_name) > -1) { - return event.callback(); + return; } timestamp = Math.floor((new Date()).getTime() / 1000); stats_file.write(timestamp.toString() + ' ' + stat_name + '\n'); - - event.callback(); });