-
Notifications
You must be signed in to change notification settings - Fork 421
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
Adding support for command rpl_whoreply (352) #413
Conversation
I would have avoided the declaration of variables in there and use its counterpart value (lets not forget this is a listener, which will iterate to infinity) apart from that nitpicking, 👍 |
moshmage, should I declare it at the top of the file? |
@lan17 nay, my nitpicking was "do not use variables as aliases" so, the code would become something like case 'rpl_whoreply':
self._addWhoisData(message.args[5], 'user', message.args[2]);
self._addWhoisData(message.args[5], 'host', message.args[3]);
self._addWhoisData(message.args[5], 'server', message.args[4]);
self._addWhoisData(message.args[5], 'realname', message.args[7].match(/[0-9]+\s*(.+)/g)[1]);
// emit right away because rpl_endofwho doesn't contain nick
self.emit('whois', self._clearWhoisData(message.args[5]));
break; Would the code be harder to read? Probably, as we have to keep track that You could also use the |
It seems that rpl_endofwho is not guaranteed to be paired with a single rpl_whoreply. I see behavior (from a ZNC bouncer) where there are a bunch of rpl_whoreply that are followed by a single rpl_endofwho. Therefore I don't think we can rely on rpl_endofwho and should rather emit right away. |
I have updated this pull request with @moshmage comments, however I did not add support for "rpl_endofwho" for reasons stated above. |
👍 Later on we'll have to whip some way of connecting |
Awesome. Keep in mind, however, that its impossible to pair rpl_whoreply with rpl_endofwho because its many to one relationship (many rpl_whoreply for single rpl_endofwho at least with ZNC). Perhaps instead we can have a state machine where if we are receiving rpl_whoreply and we have another one being prepared then we flush previous one. |
What are the next steps? I need approval by martynsmith in order to merge? |
+1 |
Adding support for command rpl_whoreply (352)
+1 |
I found that this library lacks support for this command, which my ZNC bouncer seems to send me a lot.
I have implemented support for it and have tested it by using it within my own project which uses this library.
As a special case I have emitted whois information right away because the end command - rpl_endofwho lacks nick so its impossible to match it with original rpl_whoreply
Let me know what you guys think.