function onJoin(event) {
- this.irc_connection.clientEvent('join', {
- channel: this.name,
- nick: event.nick,
- ident: event.ident,
- hostname: event.hostname,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc channel join', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('join', {
+ channel: that.name,
+ nick: event.nick,
+ ident: event.ident,
+ hostname: event.hostname,
+ time: event.time
+ });
});
}
function onPart(event) {
- this.irc_connection.clientEvent('part', {
- nick: event.nick,
- ident: event.ident,
- hostname: event.hostname,
- channel: this.name,
- message: event.message,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc channel part', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('part', {
+ nick: event.nick,
+ ident: event.ident,
+ hostname: event.hostname,
+ channel: that.name,
+ message: event.message,
+ time: event.time
+ });
});
}
function onKick(event) {
- this.irc_connection.clientEvent('kick', {
- kicked: event.kicked, // Nick of the kicked
- nick: event.nick, // Nick of the kicker
- ident: event.ident,
- hostname: event.hostname,
- channel: this.name,
- message: event.message,
- time: event.time
+ global.modules.emit('irc channel kick', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ this.irc_connection.clientEvent('kick', {
+ kicked: event.kicked, // Nick of the kicked
+ nick: event.nick, // Nick of the kicker
+ ident: event.ident,
+ hostname: event.hostname,
+ channel: this.name,
+ message: event.message,
+ time: event.time
+ });
});
}
function onQuit(event) {
- this.irc_connection.clientEvent('quit', {
- nick: event.nick,
- ident: event.ident,
- hostname: event.hostname,
- message: event.message,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc channel quit', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('quit', {
+ nick: event.nick,
+ ident: event.ident,
+ hostname: event.hostname,
+ message: event.message,
+ time: event.time
+ });
});
}
function onMsg(event) {
- this.irc_connection.clientEvent('msg', {
- nick: event.nick,
- ident: event.ident,
- hostname: event.hostname,
- channel: this.name,
- msg: event.msg,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc message', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('msg', {
+ nick: event.nick,
+ ident: event.ident,
+ hostname: event.hostname,
+ channel: that.name,
+ msg: event.msg,
+ time: event.time
+ });
});
}
function onNotice(event) {
- this.irc_connection.clientEvent('notice', {
- from_server: event.from_server,
- nick: event.nick,
- ident: event.ident,
- hostname: event.hostname,
- target: event.target,
- msg: event.msg,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc channel notice', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('notice', {
+ from_server: event.from_server,
+ nick: event.nick,
+ ident: event.ident,
+ hostname: event.hostname,
+ target: event.target,
+ msg: event.msg,
+ time: event.time
+ });
});
}
function onTopic(event) {
- this.irc_connection.clientEvent('topic', {
- nick: event.nick,
- channel: this.name,
- topic: event.topic,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc channel topic', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('topic', {
+ nick: event.nick,
+ channel: that.name,
+ topic: event.topic,
+ time: event.time
+ });
});
}
this.ban_list_buffer = [];
}
-function onTopic(event) {
- this.irc_connection.clientEvent('topic', {
- channel: event.channel,
- topic: event.topic
- });
-}
-
function onTopicSetBy(event) {
this.irc_connection.clientEvent('topicsetby', {
nick: event.nick,
}
function onMode(event) {
- this.irc_connection.clientEvent('mode', {
- target: event.target,
- nick: event.nick,
- modes: event.modes,
- time: event.time
+ var that = this;
+
+ global.modules.emit('irc channel mode', {
+ channel: this,
+ connection: this.irc_connection,
+ irc_event: event
+ })
+ .done(function() {
+ that.irc_connection.clientEvent('mode', {
+ target: event.target,
+ nick: event.nick,
+ modes: event.modes,
+ time: event.time
+ });
});
}
var module = new kiwiModules.Module('Example Module');
-module.on('client connected', function(event, data) {
- console.log('Client connection:', data);
+// A web client is connected
+module.on('client created', function(event, data) {
+ console.log('[client connection]', data);
});
-module.on('client commands msg', function(event, data) {
- console.log('Client msg:', data.args.target, ': ', data.args.msg);
- data.args.msg += ' - modified!';
-});
\ No newline at end of file
+// The Client recieves a IRC PRIVMSG command
+module.on('irc message', function(event, data) {
+ console.log('[MESSAGE]', data.irc_event);
+});
+
+
+// The client recieves an IRC JOIN command
+module.on('irc channel join', function(event, data) {
+ console.log('[JOIN]', data.irc_event);
+});
+
+
+// A command has been sent from the client
+module.on('client command', function(event, data) {
+ var client_method = data.command.method;
+ var client_args = data.command.args;
+
+ console.log('[CLIENT COMMAND]', client_method);
+ console.log(' ', client_args);
+});