Skip to content

Commit

Permalink
party: no longer use account session id
Browse files Browse the repository at this point in the history
This is no longer required because the oauth responses don't come back via websocket anymore
  • Loading branch information
Adam- committed Jun 10, 2022
1 parent 0556773 commit 169ec74
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.ItemComposition;
import net.runelite.client.account.AccountSession;
import net.runelite.client.account.SessionManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.eventbus.EventBus;
Expand All @@ -72,7 +70,6 @@ public class PartyService

private final Client client;
private final WSClient wsClient;
private final SessionManager sessionManager;
private final EventBus eventBus;
private final ChatMessageManager chat;
private final List<PartyMember> members = new ArrayList<>();
Expand All @@ -83,11 +80,10 @@ public class PartyService
private String partyPassphrase;

@Inject
private PartyService(final Client client, final WSClient wsClient, final SessionManager sessionManager, final EventBus eventBus, final ChatMessageManager chat)
private PartyService(final Client client, final WSClient wsClient, final EventBus eventBus, final ChatMessageManager chat)
{
this.client = client;
this.wsClient = wsClient;
this.sessionManager = sessionManager;
this.eventBus = eventBus;
this.chat = chat;
eventBus.register(this);
Expand Down Expand Up @@ -169,23 +165,15 @@ public void changeParty(@Nullable String passphrase)

if (partyId == null)
{
// close the websocket if the session id isn't for an account
if (sessionManager.getAccountSession() == null)
{
wsClient.changeSession(null);
}

wsClient.changeSession(null);
eventBus.post(new PartyChanged(partyPassphrase, partyId));
return;
}

// If there isn't already a session open, open one
if (!wsClient.sessionExists())
{
AccountSession accountSession = sessionManager.getAccountSession();
// Use the existing account session, if it exists, otherwise generate a new session id
UUID uuid = accountSession != null ? accountSession.getUuid() : UUID.randomUUID();
wsClient.changeSession(uuid);
wsClient.changeSession(UUID.randomUUID());
}

eventBus.post(new PartyChanged(partyPassphrase, partyId));
Expand Down

0 comments on commit 169ec74

Please sign in to comment.