@@ -279,4 +279,42 @@ Future<Result<>> checkGDMessageLimit(const AccountData& account) {
279279 co_return Ok ();
280280}
281281
282+ Future<Result<>> checkGDUserNotBlocked (const AccountData& account, int targetUser) {
283+ auto payload = fmt::format (
284+ " accountID={}&gjp2={}&gameVersion=22&binaryVersion=45"
285+ " &secret=Wmfd2893gb7&type=1&dvs=3" ,
286+ account.accountId , account.gjp2
287+ );
288+
289+ auto response = co_await baseGDRequest ()
290+ .bodyString (payload)
291+ .post (fmt::format (" {}/getGJUserList20.php" , account.serverUrl ));
292+
293+ ARC_CO_UNWRAP_INTO (response, wrapResponse (" fetch GD blocklist" , std::move (response)));
294+ auto str = response.string ().unwrapOrDefault ();
295+ if (str.empty ()) {
296+ co_return Err (wrapError (response, " fetch GD messages" ));
297+ }
298+
299+ if (str == " -1" ) {
300+ co_return Err (" Invalid account credentials, please try to Refresh Login in account settings" );
301+ } else if (str == " -2" ) {
302+ co_return Ok ();
303+ } else if (str.starts_with (" -" )) {
304+ co_return Err (" Unexpected server response while fetching blocklist: {}" , str);
305+ }
306+
307+ std::string targetStr = fmt::to_string (targetUser);
308+
309+ for (auto user : asp::iter::split (str, " |" )) {
310+ for (auto [k, v] : asp::iter::split (user, ' :' ).arrayChunks <2 >()) {
311+ if (k == " 16" && v == targetStr) {
312+ co_return Err (" You have blocked the authentication bot account, please unblock it and try again" );
313+ }
314+ }
315+ }
316+
317+ co_return Ok ();
318+ }
319+
282320}
0 commit comments