summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/post-smtp-hooks.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/script/post-smtp-hooks.js b/script/post-smtp-hooks.js
new file mode 100644
index 0000000..092f024
--- /dev/null
+++ b/script/post-smtp-hooks.js
@@ -0,0 +1,15 @@
+var Hook = {
+ hooks: [],
+
+ register: function ( name, callback ) {
+ if( 'undefined' == typeof( Hook.hooks[name] ) )
+ Hook.hooks[name] = []
+ Hook.hooks[name].push( callback )
+ },
+
+ call: function ( name, arguments ) {
+ if( 'undefined' != typeof( Hook.hooks[name] ) )
+ for( i = 0; i < Hook.hooks[name].length; ++i )
+ if( true != Hook.hooks[name][i]( arguments ) ) { break; }
+ }
+} \ No newline at end of file