caffeinery/coffea

View on GitHub
lib/plugins/cap-account-notify.js

Summary

Maintainability
A
1 hr
Test Coverage
/*jslint node: true*/
"use strict";

var utils = require('../utils');

module.exports = function () {
    return function (irc) {
        irc.on('data', function (err, msg) {
            var network = msg.network;
            if (msg.command === 'ACCOUNT') {
                irc.getUser(utils.nick(msg), network).accountname = msg.params === "*" ? null : msg.params;
                utils.emit(irc, network, 'account-login', {
                    "user": irc.getUser(utils.nick(msg), network),
                    "account": msg.params === "*" ? null : msg.params,
                    "tags": msg.tags ? msg.tags : []
                });
            }
        });
    };
};