-
Notifications
You must be signed in to change notification settings - Fork 681
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
Auto away when no clients are connected #775
Conversation
src/client.js
Outdated
|
||
if (_.size(this.attachedClients) === 0) { | ||
this.networks.forEach(function(network) { | ||
network.irc.raw("AWAY", this.awayMessage); |
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.
this
should be client from upper scope.
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.
As I understand MDN's article on arrow functions, this would come for free if forEach
was using one of them. I haven't used them much, so I might be wrong.
What do you mean by this? Shouldn't this come with an entry in the client settings? We probably don't want to force everyone to be away when no client is connected :) |
src/client.js
Outdated
@@ -63,6 +63,7 @@ function Client(manager, name, config) { | |||
config = {}; | |||
} | |||
_.merge(this, { | |||
awayMessage: "no users in the lounge", |
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.
Now that this branch is leaving the status of patch, we should probably have a better default. Actually, empty by default since it will be disabled by default.
src/client.js
Outdated
@@ -457,11 +458,23 @@ Client.prototype.quit = function() { | |||
}; | |||
|
|||
Client.prototype.clientAttach = function(socketId) { | |||
if (_.size(this.attachedClients) === 0) { | |||
this.networks.forEach(function(network) { | |||
network.irc.raw("AWAY"); |
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.
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.
Not really related directly.
src/client.js
Outdated
|
||
if (_.size(this.attachedClients) === 0) { | ||
this.networks.forEach(function(network) { | ||
network.irc.raw("AWAY", this.awayMessage); |
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.
As I understand MDN's article on arrow functions, this would come for free if forEach
was using one of them. I haven't used them much, so I might be wrong.
src/plugins/irc-events/connection.js
Outdated
@@ -20,6 +21,10 @@ module.exports = function(irc, network) { | |||
}), true); | |||
} | |||
|
|||
if (_.size(client.attachedClients) === 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.
Would it make sense to use Map
for client.attachedClients
?
I noticed we use it like this in a couple places, and we could use client.attachedClients.size
directly (actually, this is one of the arguments of Object
vs. Map
used in the MDN article!).
118bb90
to
58eff93
Compare
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.
Code looks fine to me, but I'm a bit unsure as if this should be directly tied to the away message. I could very well set myself as away leaving my computer on and everything. If my connection happens to drop or anything, then I'd be marked back. I think this one should be a checkbox or field in the settings and be independent of the away message.
@maxpoulin64 See the second todo in main post. I wanted to incorporate your |
58eff93
to
349144a
Compare
Updated the PR to also account for network |
349144a
to
0ab3615
Compare
Just curious, if we merge this, |
@astorije Nope, there's code to prevent that. Look closely for |
Any updates on getting this merged into master? |
@MuffinMedic We are currently doing final checks on version 2.2.0, and after that we will start looking at this again. |
@xPaw, can we have a front-end checkbox for this? We already do server-synced stuff with custom highlights so we should be able to do that for this one too. |
0bb67a9
to
4a68b78
Compare
FYI, rebased this on master and got rid of the merge conflict. |
We'd don't though? |
Well I'll be damned, I thought so but I see this is client-side only! I guess this is good to go then, but I wish there was a way to do settings better here. Quite the undertaking, but that would be such a great enhancement to solve globally. |
Settings branch exists, but it needs major work. |
🎉 |
Auto away when no clients are connected
2 issues:
Auto away is useful for people that use lounge along with Znc as it has checks for away clients.