williamkapke / irc-connect

Minimal IRC connection that simply emits event objects. Plugin modules can do the rest.
14 stars 5 forks source link

Add SSL, expose more options, add options handler to keep options sane, add optional create() if you don't want to connect() until later #5

Closed Spudz76 closed 10 years ago

Spudz76 commented 10 years ago

Update/repair README example to document new features/usage;

Add SSL (tls) support, see README for new example/docs;

Retool options in general: Rename 'name' option to 'realname' to better match what all other irc clients call it; Add 'nick' option to avoid strange random nick at connect (if you don't want that); Add 'ident' option to override the default 'irc-cnct' Add 'secure' option for SSL (tls), can be false (default), true or 'semi' Add 'lazyCA' option but you might as well use the 'semi' trick

Add 'create()' method which takes options and constructs the Client, but does not connect. This is so one can bind all their listeners or do odd custom junk, before firing off the actual connect().

NOTE: Everything, including previous connect(host,options||realname) usage, is backward compatible;

Spudz76 commented 10 years ago

Sorry about code style I stuck to tabs not dualspace and semicolon-trailers at least! If I actually had my way it'd all have been massaged into standard npm-style rules, with no unneeded semicolons, full docblocks, linted with GJSlint and JShint (which both nearly explode with cleanup and best practice suggestions, no offense). Then again if you wouldn't mind me restyling the whole thing... I will? I'm using this as a backbone API of sorts for mesh/shared computing stuff. It wouldn't hurt if it matched my personal preferred style which is more or less the npm-style standard. Docblocks also help WebStorm and other introspective IDEs to suggest proper arguments for functions.

Spudz76 commented 10 years ago

BTW, tested against ircd-hybrid in both normal and SSL modes, and all the new options. Added message in README about the built-in nick() method not working if you don't have NickServ or such (I don't).

williamkapke commented 10 years ago

No offense taken- I move fast on things and clean up the "bad form" crap during iteration :)

I'm ok with you reformatting and adding the docblocks if you want. I prefer to keep the semicolons- but it isn't a really big deal. If you do reformat, can you add an .editorconfig to the project?

This should probably get a major version bump- right? I'll publish to NPM whenever it is ready.

Great work- thanks for giving back!

Spudz76 commented 10 years ago

OK, cool. The nick fixes are an example of such iterative cleanup. I can dig the semicolons, it's easier to always use them if you do much browser-side JS, than to forget them and wonder why things are being weird on the browser side. The V8 in Node doesn't need them except in very rare situations (or, if somehow your code lost newlines). I'm just very in the habit of not using them as I do more Node-centric backend code usually.

I will figure out an .editorconfig maybe WebStorm can make one for me. I just have twiddled the inspection and linter options in there to npm-style plus some changes, and have a .jshintrc and .gjslintrc in all my projects generally (I can add those in a PR). But WebStorm uses those 'live' so I don't put the command-line stubs in place for running a check anymore (I used to have a bunch of grunt files etc). I guess all you have to do is npm install -g jshint, and it should pick up the project root rcfile if you code from a shell environment. The gjslint is a bit more convoluted as it's a python package, but if you already have easy_install it's not too hard to set up either. Both of those help put an autopilot on code cleanup (more so if your IDE complains in realtime, but running it as a pre-commit sanity check also works well.)

Currently working on irc-connect-ctcp, v0.0.2 is up and works pretty slick. I polluted some things with circular refs like a noob so v0.1.0 is upcoming to fix that and abuse the Client object less, and rename some (most?) methods to make more sense, and add outgoing DCC. I wouldn't mind your input on if my implementation makes sense, what it emits, etc. Ignore the messy object pollution (with like client.ctcp.dcc etc and circular refs even, eww) I've already fixed that by exporting bound method accessors. But you can use() it up as-is and it replies to VERSION/TIME/PING, and adds supports for CTCP encoding of PRIVMSG and NOTICE both directions.