forked from FAForever/downlords-faf-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:FAForever/downlords-faf-client i…
…nto feature/FAForever#3023-replay-card-enhancement
- Loading branch information
Showing
11 changed files
with
261 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 0 additions & 101 deletions
101
src/main/java/com/faforever/client/chat/kitteh/FixedWhoListener.java
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
src/main/java/com/faforever/client/chat/kitteh/WhoAwayListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.faforever.client.chat.kitteh; | ||
|
||
import net.engio.mbassy.listener.Handler; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.kitteh.irc.client.library.Client; | ||
import org.kitteh.irc.client.library.defaults.listener.AbstractDefaultListenerBase; | ||
import org.kitteh.irc.client.library.event.client.ClientReceiveNumericEvent; | ||
import org.kitteh.irc.client.library.event.helper.ClientEvent; | ||
import org.kitteh.irc.client.library.feature.filter.NumericFilter; | ||
|
||
// This who listener only sends events marking users as away for a channel | ||
public class WhoAwayListener extends AbstractDefaultListenerBase { | ||
|
||
/** | ||
* Constructs the listener. | ||
* | ||
* @param client client | ||
*/ | ||
public WhoAwayListener(Client.WithManagement client) { | ||
super(client); | ||
} | ||
|
||
@NumericFilter(352) // WHO | ||
@NumericFilter(354) // WHOX | ||
@Handler(priority = Integer.MAX_VALUE - 1) | ||
public void who(ClientReceiveNumericEvent event) { | ||
if (event.getParameters().size() < ((event.getNumeric() == 352) ? 8 : 9)) { | ||
this.trackException(event, "WHO response too short"); | ||
return; | ||
} | ||
final String channel = event.getParameters().get(1); | ||
|
||
final String nick = event.getParameters().get(5); | ||
final String status = event.getParameters().get(6); | ||
boolean isAway = status.contains("G"); | ||
|
||
this.fire(new WhoAwayMessageEvent(this.getClient(), channel, nick, isAway)); | ||
} | ||
|
||
public record WhoAwayMessageEvent( | ||
Client client, String channel, String userName, boolean isAway | ||
) implements ClientEvent { | ||
@Override | ||
public @NonNull Client getClient() { | ||
return client; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.