Skip to content

Commit

Permalink
Improve log for restricted friends
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Aug 28, 2024
1 parent 8f21d2e commit 3df4ac5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static void install(com.rtm516.mcxboxbroadcast.core.Logger logger) {
logger.error("Failed to disable Jitsi logger, may see more logs than expected", e);
}

// TODO Disable the logger for config
// Set the config to use our custom source
JitsiConfig.Companion.useDebugNewConfig(new CustomIceConfigSource());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ private void internalProcess() {
// 1015 - An invalid request was attempted.
// 1028 - The attempted People request was rejected because it would exceed the People list limit.
// 1039 - Request could not be completed due to another request taking precedence.
// 1049 - Target user privacy settings do not allow friend requests to be received.

if (modifyResponse.code() == 1028) {
logger.error("Friend list full, unable to add " + entry.getValue() + " (" + entry.getKey() + ") as a friend");
Expand All @@ -320,7 +321,7 @@ private void internalProcess() {
// Remove these people from following us (block and unblock)
forceUnfollow(entry.getKey());

logger.warn("Removed " + entry.getValue() + " (" + entry.getKey() + ") as a friend due to account restrictions");
logger.warn("Removed " + entry.getValue() + " (" + entry.getKey() + ") as a friend due to restrictions on their account");
} else {
logger.warn("Failed to add " + entry.getValue() + " (" + entry.getKey() + ") as a friend: (" + response.statusCode() + ") " + response.body());
}
Expand Down Expand Up @@ -396,15 +397,19 @@ public void forceUnfollow(String xuid) {
try {
block(xuid);

// Wait 2.5s else the unblock request will not get processed
Thread.sleep(2500);
try {
// Wait 2.5s else the unblock request will not get processed
Thread.sleep(2500);
} catch (InterruptedException e) {
logger.warn("Failed to wait to unblock user, this may cause issues (" + xuid + "): " + e.getMessage());
}

unblock(xuid);

// Remove the user from the cache
lastFriendCache.removeIf(person -> person.xuid.equals(xuid));
} catch (Exception e) {
logger.error("Failed to force unfollow user: " + e.getMessage());
logger.error("Failed to force unfollow user", e);
}
}

Expand Down

0 comments on commit 3df4ac5

Please sign in to comment.