-
Notifications
You must be signed in to change notification settings - Fork 685
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
Drop slate-irc, switch to irc-framework #167
Conversation
And we can write a middleware that persists messages to a sqlite database 👍 |
Pinging @thelounge/maintainers to test this branch for any obvious breakage (besides the ones mentioned in op post) |
@xPaw, nice work! I'll look at what I can simply add in terms of tests before I move forward. |
Quick test so far, looks really great overall! Few things I noticed:
You probably know about those but I'm letting them here for tracking purposes. |
Connecting to Quakenet crashes lounge.
Here's lounge console with logs as xPaw asked when connecting to Quakenet : |
@xPaw, just rebased this branch, don't forget to |
Tests know reflect the PR correctly. It does show a couple breaks, but I didn't fix the code itself. I can take a look later. |
}, this); | ||
Chan.prototype.sortUsers = function(irc) { | ||
var userModeSortPriority = {}; | ||
irc.network.options.PREFIX.forEach(function(prefix, index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nicer to only pass the prefixes in the sortUsers
function. To assist with that, we can have Network.prototype.prefixes = function()
in network.js
that returns the array of prefixes for that network. We can then call things like chan.sortUsers(network.prefixes());
in a simple way (simplify tests too).
I was trying to provide it, but I noticed there is options.PREFIX
, serverOptions.PREFIX
and prefixLookup
, all related. It seems to me that sortUsers
should be using serverOptions.PREFIX
instead of options.PREFIX
but I didn't look at the code too closely. It would be better to keep a single source of truth and use methods to produce the others.
Also, in places calling sortUsers()
, there are irc.network
and network
. Do they carry the same values?
Happy to help on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that sortUsers should be using serverOptions.PREFIX instead of options.PREFIX
They're the same thing. serverOptions
exists because its an object in our network instance, and it gets synchronized to the frontend client for later use. I didn't want to pipe the whole irc-fw options/networks objects to the client, as they have a lot of data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to pipe the whole irc-fw options/networks objects to the client, as they have a lot of data.
Yep, agreed!
However, I think those add some confusion to the codebase overall, I'm sure we can encapsulate this nicely in the models and interface that (options
, serverOptions
, ...) via methods. What do you think? I can try to spend some time on that if that's fine by you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably can change toJSON
method in network to return whitelisted properties, like export
does.
@xPaw, I'll test more extensively and add stuff over the weekend. Meanwhile, could you add @maxpoulin64 and @lpoujol's comments to your punch list above? |
attr.name = attr.nick; | ||
attr.mode = attr.modes[0] || ""; | ||
attr.name = attr.name || attr.nick; | ||
attr.mode = attr.mode || (attr.modes && attr.modes[0]) || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should have been fixed in the test, as irc-fw will only be providing us with modes array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added changes here simply because of the TODO above. If the model changes because irc-framework makes us too, I think we should go all in: name
could be reworded nick
everywhere and the non-array mode
could disappear.
In the meantime, it was an easy way for me to integrate the tests, until this TODO gets addressed.
@xPaw, what's your take about changing the model regarding name
/nick
/mode
/modes
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not an easy change because it will affect a lot of files. I'd rather tackle it in a separate PR because this one is getting pretty big already.
@@ -35,7 +36,7 @@ describe("Chan", function() { | |||
new User({name: "xPaw", mode: "~"}), | |||
new User({name: "Max-P", mode: "@"}), | |||
]}); | |||
chan.sortUsers(); | |||
chan.sortUsers({network: {options: {PREFIX: ["+", "%", "@", "&", "~"]}}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not how PREFIX is formatted by the way, which is why the test is failing. See https://github.com/kiwiirc/irc-framework/blob/48bb805653872e5f21210474fdfe439892be91b0/src/networkinfo.js#L12
39a7b83
to
cbd6283
Compare
4484fbf
to
34af38f
Compare
Nah, I just double-checked, assuming I'm
If nick is already in use, command should be canceled altogether. I can take a look if you want :-)
Sorry, should have been clearer: my point was that
Actually, this is on Freenode: A is on Weird...
Somehow I can't reproduce this, so marking that as fixed, we'll deal with this later if needed. |
Alright, I'm done testing I believe :-) Only major issue I have noticed is that running the [...]/lounge/node_modules/irc-framework/src/commands/handlers/misc.js:12
if (cache.channels.length) {
^
TypeError: Cannot read property 'length' of undefined
at IrcCommandHandler.handlers.RPL_LISTEND ([...]/lounge/node_modules/irc-framework/src/commands/handlers/misc.js:12:27)
at IrcCommandHandler.dispatch ([...]/lounge/node_modules/irc-framework/src/commands/handler.js:49:37)
at IrcCommandHandler._write ([...]/lounge/node_modules/irc-framework/src/commands/handler.js:35:10)
at doWrite (_stream_writable.js:292:12)
at writeOrBuffer (_stream_writable.js:278:5)
at IrcCommandHandler.Writable.write (_stream_writable.js:207:11)
at MiddlewareStream.ondata (_stream_readable.js:528:20)
at emitOne (events.js:77:13)
at MiddlewareStream.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16) and: [...]/lounge/node_modules/irc-framework/src/commands/handlers/misc.js:23
cache.channels.push({
^
TypeError: Cannot read property 'push' of undefined
at IrcCommandHandler.handlers.RPL_LIST ([...]/lounge/node_modules/irc-framework/src/commands/handlers/misc.js:23:23)
at IrcCommandHandler.dispatch ([...]/lounge/node_modules/irc-framework/src/commands/handler.js:49:37)
at IrcCommandHandler._write ([...]/lounge/node_modules/irc-framework/src/commands/handler.js:35:10)
at doWrite (_stream_writable.js:292:12)
at writeOrBuffer (_stream_writable.js:278:5)
at IrcCommandHandler.Writable.write (_stream_writable.js:207:11)
at MiddlewareStream.ondata (_stream_readable.js:528:20)
at emitOne (events.js:77:13)
at MiddlewareStream.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16) It's fairly inconsistent, and for the first one I sometimes had to run It seems pretty critical to me, as it gets easy to kill an instance, like our demo. @xPaw, what do you recommend here? Is it reasonable to suggest a custom input plugin for So yeah, a few minor bugs, that big one, and then I think we can ship this PR :-) |
@astorije I suggest we take a good look at error messages in a future PR, see https://github.com/prawnsalad/KiwiIRC/blob/6f90124e0f15d4cc373496110d1150ffd75072fc/client/src/models/network.js#L856-L917 And I see about the random name now, it only added random numbers if you were not "connected" yet. Fixed I don't see how you are possibly hitting a crash in /list, since the |
Yep!
Nice, tested and works OK! Still not too fond of the
See it in action :-) On the left, it's Freenode, on the right, it's not. Each of them produces one of the 2 stacktraces I posted above: |
I'm not sure how come you couldn't reproduce this as I found this to be actually a bug. I fixed it in af2c36e, one less to go :-) |
@astorije The remaining points you have are all related to displaying error messages, which we agreed to take a look at in a future discussion. |
Great re: |
I've been running it for the last few days and not noticed anything that On Wed, 13 Apr 2016, 03:16 Jérémie Astori, notifications@github.com wrote:
|
Alright, looks like all comments have been addressed, or discussed enough to ensure they'll be addressed when time comes, everyone is 👍 on that, let's do it!! |
Awesome work everyone involved! Awesome PR! |
When working on thelounge#660, I missed that helper already existed, added in thelounge#167.
When working on thelounge#660, I missed that helper already existed, added in thelounge#167.
💅 This is rather huge, opening a PR for tracking and discussion.
What's left to do:
NAMES
request just like the currentmaster
solution, this will need to be tackled in a future PRfrom_server
is not being set to true and causes server notices to be sent into a query windowtopic set by
need to be parsedThing to keep in mind: the framework keeps its own track of channels and users in them, we can use it to our advantage.
New features:
SASL should workbrokenserver-time
support on the clienttwitch.tv/membership
is supported