Skip to content

Commit

Permalink
Merge pull request thelounge#449 from thelounge/xpaw/irc-fw-upd
Browse files Browse the repository at this point in the history
Update irc-framework to 2.3.0
  • Loading branch information
maxpoulin64 authored Jul 2, 2016
2 parents 5bf5c0e + 21ea2b3 commit 643287b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"event-stream": "3.3.2",
"express": "4.13.4",
"fs-extra": "0.30.0",
"irc-framework": "2.0.0",
"irc-framework": "2.3.0",
"lodash": "4.11.2",
"moment": "2.13.0",
"read": "1.0.7",
Expand Down
2 changes: 2 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ Client.prototype.connect = function(args) {
localAddress: config.bind,
rejectUnauthorized: false,
auto_reconnect: true,
auto_reconnect_wait: 10000 + Math.floor(Math.random() * 1000), // If multiple users are connected to the same network, randomize their reconnections a little
auto_reconnect_max_retries: 360, // At least one hour (plus timeouts) worth of reconnections
webirc: webirc,
});

Expand Down
13 changes: 8 additions & 5 deletions src/plugins/irc-events/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function(irc, network) {

irc.on("close", function() {
network.channels[0].pushMessage(client, new Msg({
text: "Disconnected from the network, and will not reconnect."
text: "Disconnected from the network, and will not reconnect. Use /connect to reconnect again."
}));
});

Expand All @@ -69,23 +69,26 @@ module.exports = function(irc, network) {
});
}

irc.on("debug", function(message) {
log.debug("[" + client.name + " on " + network.host + ":" + network.port + "]", message);
});

irc.on("socket error", function(err) {
log.debug("IRC socket error", err);
network.channels[0].pushMessage(client, new Msg({
type: Msg.Type.ERROR,
text: "Socket error: " + err
}));
});

irc.on("reconnecting", function() {
irc.on("reconnecting", function(data) {
network.channels[0].pushMessage(client, new Msg({
text: "Disconnected from the network. Reconnecting..."
text: "Disconnected from the network. Reconnecting in " + Math.round(data.wait / 1000) + " seconds… (Attempt " + data.attempt + " of " + data.max_retries + ")"
}));
});

irc.on("ping timeout", function() {
network.channels[0].pushMessage(client, new Msg({
text: "Ping timeout, disconnecting..."
text: "Ping timeout, disconnecting"
}));
});

Expand Down

0 comments on commit 643287b

Please sign in to comment.