From 5875f47ebc82e55ff374a29978b231d6e477f683 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Tue, 15 Aug 2017 21:42:14 -0400 Subject: [PATCH] Ignore chat friendstate responses if we no longer care --- components/chat.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/chat.js b/components/chat.js index b3fe1ae..4329e71 100644 --- a/components/chat.js +++ b/components/chat.js @@ -158,7 +158,7 @@ SteamCommunity.prototype._chatPoll = function() { }, "json": true }, function(err, response, body) { - if(self.chatState == SteamCommunity.ChatState.Offline) { + if (self.chatState == SteamCommunity.ChatState.Offline) { return; } @@ -219,12 +219,20 @@ SteamCommunity.prototype._relogWebChat = function() { }; SteamCommunity.prototype._chatUpdatePersona = function(steamID) { + if (!this.chatFriends || self.chatState == SteamCommunity.ChatState.Offline) { + return; // we no longer care + } + this.emit('debug', 'Updating persona data for ' + steamID); var self = this; this.httpRequest({ "uri": "https://steamcommunity.com/chat/friendstate/" + steamID.accountid, "json": true }, function(err, response, body) { + if (!self.chatFriends || self.chatState == SteamCommunity.ChatState.Offline) { + return; // welp + } + if(err || response.statusCode != 200) { self.emit('debug', 'Chat update persona error: ' + (err ? err.message : "HTTP error " + response.statusCode)); setTimeout(function() {