From 575c196cb7c2546b09ce53664f442da0b7c24bf1 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Wed, 13 Jul 2016 13:11:44 -0400 Subject: [PATCH] Added acceptAllConfirmations method --- components/confirmations.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/components/confirmations.js b/components/confirmations.js index 84fa9bb..87b09ca 100644 --- a/components/confirmations.js +++ b/components/confirmations.js @@ -144,6 +144,31 @@ SteamCommunity.prototype.respondToConfirmation = function(confID, confKey, time, }); }; +SteamCommunity.prototype.acceptAllConfirmations = function(time, confKey, allowKey, callback) { + var self = this; + + this.getConfirmations(time, confKey, function(err, confs) { + if (err) { + callback(err); + return; + } + + if (confs.length == 0) { + callback(null, []); + return; + } + + self.respondToConfirmation(confs.map(function(conf) { return conf.id; }), confs.map(function(conf) { return conf.key; }), time, allowKey, true, function(err) { + if (err) { + callback(err); + return; + } + + callback(err, confs); + }); + }); +}; + function request(community, url, key, time, tag, params, json, callback) { params = params || {}; params.p = SteamTotp.getDeviceID(community.steamID);