1- /**
2- *
3- * The public contract of the Client object is documented by readme.md.
4- *
5- * Public Methods:
6- * connect() -> void
7- * disconnect() -> void
8- * Configuration Storage iface
9- * IrcOutputSocket iface
10- * Bisubscriber iface
11- * Modules iface
12- */
13-
14- /*
15- I should see if there's a better way to make this class than
16- all of these wrapped methods.
17- */
18-
19- const util = require ( 'util' ) ;
201const lodash = require ( 'lodash' ) ;
212
223const defaultFactoryConfiguration = {
@@ -119,7 +100,7 @@ const delegate = function (property, method) {
119100 client . say ( config . nickserv , 'identify ' + config . password ) ;
120101 }
121102
122- if ( util . isArray ( config . channels ) ) {
103+ if ( Array . isArray ( config . channels ) ) {
123104 client . notice ( 'Joining default channels.' ) ;
124105 config . channels . forEach ( function ( channel ) {
125106 client . join ( channel ) ;
@@ -136,6 +117,8 @@ const delegate = function (property, method) {
136117 client . notice ( 'Closing IRC Connection.' ) ;
137118 client . disconnect ( ) ;
138119 } ) ;
120+ // End of Startup stuff
121+
139122
140123 client . out = client . _outputSocket ;
141124 client . events = client . _subscriber ;
@@ -218,21 +201,14 @@ Client.prototype.nick = function () {
218201Client . prototype . on = delegate ( '_subscriber' , 'on' ) ;
219202Client . prototype . once = delegate ( '_subscriber' , 'once' ) ;
220203
221- // partially implements ModuleSubscriber
222-
223- Client . prototype . load = function ( module ) {
224- return this . _modules . load ( module ) ;
225- } ;
226-
227- Client . prototype . require = function ( module ) {
228- return this . _modules . require ( module ) ;
229- } ;
204+ // implements ModuleSystem
230205
231- Client . prototype . exports = Client . prototype . require ;
232-
233- Client . prototype . loaded = function ( ) {
234- return this . _modules . loadedModules ( )
235- } ;
206+ Client . prototype . use = delegate ( 'modules' , 'use' ) ;
207+ Client . prototype . getModule = delegate ( 'modules' , 'getModule' ) ;
208+ Client . prototype . getRole = delegate ( 'modules' , 'getRole' ) ;
209+ Client . prototype . initialize = delegate ( 'modules' , 'initialize' ) ;
210+ Client . prototype . isInitializable = delegate ( 'modules' , 'isInitializable' ) ;
211+ Client . prototype . addHook = delegate ( 'modules' , 'addHook' ) ;
236212
237213// implements Logger
238214Client . prototype . debug = delegate ( '_logger' , 'debug' ) ;
0 commit comments