Created
January 19, 2014 08:11
-
-
Save Havvy/8501851 to your computer and use it in GitHub Desktop.
Ah, the difference a year makes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| var util = require('util'); | |
| var ServerModule = function () { | |
| this.capabilities = {}; | |
| }; | |
| ServerModule.prototype.getModule = function () { | |
| return { | |
| name: "server", | |
| exports: { | |
| "capabilities" : this.capabilities | |
| }, | |
| handlers: { | |
| "005" : this.isupportHandler.bind(this) | |
| }, | |
| help: "Internal module. Right now only grabs the isupport info." | |
| }; | |
| }; | |
| ServerModule.prototype.isupportHandler = function (e) { | |
| // First parameter is my nickname! | |
| // Last parameter is plain text. | |
| for (var ix = 1; ix < e.args.length - 1; ix++) { | |
| var capability = e.args[ix].split("="); | |
| switch (capability.length) { | |
| case 1: | |
| this.capabilities[capability[0]] = true; | |
| break; | |
| case 2: | |
| this.capabilities[capability[0]] = capability[1]; | |
| } | |
| } | |
| }; | |
| module.exports = function (nrc) { | |
| return (new ServerModule()).getModule(); | |
| }; | |
| */ | |
| module.exports = { | |
| init: function (client, imports) { | |
| const isupport = {}; | |
| return { | |
| handlers: { | |
| '005': function (isupport) { | |
| isupport.params.map(function (param) { | |
| return param.split('='); | |
| }.forEach(function { | |
| (supported, undefined) => isupport[supported] = true; | |
| (supported, value) => isupport[supported] = value; | |
| }); | |
| } | |
| }, | |
| exports: { | |
| isupport: isupport | |
| } | |
| }; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment