Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEBIRC support #276

Merged
6 commits merged into from
Jan 9, 2015
Merged

WEBIRC support #276

6 commits merged into from
Jan 9, 2015

Conversation

Trinitas
Copy link
Contributor

@Trinitas Trinitas commented Jan 7, 2015

Webirc is used for multiple users to connect from your node-irc server to irc to get the clients ip.
Get the users ip and hostname and send it like this:
webirc = {"pass":"WebIrcPassWord","host":"my.host.com", "ip":"123.123.12.12"};

http://wiki.mibbit.com/index.php/Enable_Mibbit_on_Your_IRC_Server
How to configure your server for Webirc can also be found in your irc server dokumentation.

Webirc is used for multiple users to connect from your node-irc server to irc to get the clients ip.
Get the users ip and hostname and send it like this:
webirc = {"pass":"WebIrcPassWord","host":"my.host.com", "ip":"123.123.12.12"};

http://wiki.mibbit.com/index.php/Enable_Mibbit_on_Your_IRC_Server
How to configure your server for Webirc can also be found in your irc server dokumentation.
@Trinitas
Copy link
Contributor Author

Trinitas commented Jan 7, 2015

wrong branch?

@jirwin
Copy link
Collaborator

jirwin commented Jan 7, 2015

This is the wrong branch. You just have some lint errors to fix. Run npm run-script lint locally to see what they are.

I think this patch looks pretty good now!

@@ -654,6 +655,9 @@ Client.prototype.connect = function(retryCount, callback) { // {{{
self.conn.authorizationError === 'CERT_HAS_EXPIRED') {
util.log('Connecting to server with expired certificate');
}
if (typeof self.opt.webirc.ip !== 'undefined') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better as if (self.opt.webirc.ip) {. Currently this would run if an IP was an empty string as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still has the issue of the case where self.opt.webirc.ip === ''. It is probably better to check the value instead of trusting the type. Using if (self.opt.webirc.ip) { looks for a falsy value, and the empty string('') will evaluate to false.

@Trinitas
Copy link
Contributor Author

Trinitas commented Jan 7, 2015

it's a string not a boolean value

@jirwin
Copy link
Collaborator

jirwin commented Jan 7, 2015

$ node
> var bill = "I'm just a bill";
> var empty = "";
> if (bill) console.log('This is a truthy statement');
This is a truthy statement
> if (empty) console.log('Since this value is empty it will not print')
> if (typeof empty !== null) console.log('Since empty is a string, even though this is empty, it will evaluate to true and continue')
Since empty is a string, even though this is empty, it will evaluate to true and continue

@Trinitas
Copy link
Contributor Author

Trinitas commented Jan 7, 2015

Line 661 and 688" if (self.opt.password !== null) " should i change it to true/false also or leave it?
Also a string. not writed by me. Btw i don't get any errors on my JSlint in notepad++ Edit: it was JSHint

@ghost
Copy link

ghost commented Jan 8, 2015

As I said in a previous pull req, I'm not sure why this needs to be a part of node-irc proper and can't just be handled via a registered event handler. Can you explain that, please?

@ghost
Copy link

ghost commented Jan 8, 2015

I have trawled the charybdis source code and I see no indication that WEBIRC needs to be sent immediately upon connecting.

@Trinitas
Copy link
Contributor Author

Trinitas commented Jan 9, 2015

I gonna test that new pull with socket.localAddress and see if that fixed the problem with multiple ip
Problem on my server. But here is some reading about Webirc

When a user connects through an indirect method, such web clients, the indirect client sends its own IP address instead of sending the user's IP address unless WebIRC is implemented by both the client and the server.

Method:
Before the client sends the PASS, USER or NICK commands it should send:WEBIRC password user hostname ip

Source:
https://kiwiirc.com/docs/webirc.

Compatible with a bunch of irc servers

ghost pushed a commit that referenced this pull request Jan 9, 2015
@ghost ghost merged commit 63ae435 into martynsmith:master Jan 9, 2015
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants