+var _ = require('lodash');
+
var Binder = function () {};
module.exports = Binder;
Binder.prototype.bindEvents = function () {
var that = this;
- this.irc_events.forEach(function (fn, event_name, irc_events) {
+ _.each(this.irc_events, function (fn, event_name, irc_events) {
// Bind the event to `that` context, storing it with the event listing
if (!irc_events[event_name].bound_fn) {
irc_events[event_name].bound_fn = fn.bind(that);
}
- this.irc_connection.on(this.scope + ':' + event_name, irc_events[event_name].bound_fn);
+ that.irc_connection.on(that.scope + ':' + event_name, irc_events[event_name].bound_fn);
});
};
Binder.prototype.unbindEvents = function () {
- this.irc_events.forEach(function(fn, event_name, irc_events) {
+ var that = this;
+ _.each(this.irc_events, function(fn, event_name, irc_events) {
if (irc_events[event_name].bound_fn) {
- this.irc_connection.removeListener(this.scope + ':' + event_name, irc_events[event_name].bound_fn);
+ that.irc_connection.removeListener(that.scope + ':' + event_name, irc_events[event_name].bound_fn);
}
});
};
\ No newline at end of file
member_list.push({nick: member, modes: modes});
});
- that.irc_connection.emit('channel:' + command.params[2] + ':userlist', {
+ this.irc_connection.emit('channel:' + command.params[2] + ':userlist', {
users: member_list,
channel: command.params[2]
});
'RPL_ENDOFNAMES': function (command) {
- that.irc_connection.emit('channel:' + command.params[1] + ':userlist_end', {
+ this.irc_connection.emit('channel:' + command.params[1] + ':userlist_end', {
channel: command.params[1]
});
},