Skip to content

Commit

Permalink
Updated to v0.10-b3.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Sep 12, 2019
2 parents 87bdc48 + be4e753 commit 81118fb
Show file tree
Hide file tree
Showing 64 changed files with 2,948 additions and 742 deletions.
4 changes: 4 additions & 0 deletions src/chatty/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ public static boolean matchUserStatus(String id, User user) {
|| user.isModerator() || user.isStaff()) {
return true;
}
} else if (id.equals("$vip")) {
if (user.hasTwitchBadge("vip")) {
return true;
}
}
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/chatty/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ public void defineSettings() {
settings.addBoolean("closeToTray", false);
settings.addBoolean("minimizeToTray", false);
settings.addBoolean("trayIconAlways", false);
settings.addBoolean("singleClickTrayOpen", true);

// Window State
settings.addMap("windows", new HashMap<>(), Setting.STRING);
Expand Down Expand Up @@ -515,6 +516,7 @@ public void defineSettings() {
settings.addList("highlightBlacklist", new ArrayList(), Setting.STRING);
settings.addBoolean("highlightMatches", true);
settings.addBoolean("highlightMatchesAll", true);
settings.addBoolean("highlightByPoints", true);

// Ignore
settings.addList("ignore", new ArrayList(), Setting.STRING);
Expand Down
25 changes: 12 additions & 13 deletions src/chatty/TwitchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ else if (channel.startsWith("*")) {
if (testUser.getRoom().equals(room)) {
user = testUser;
}
g.printMessage(user,text,false,null,1);
g.printMessage(user,text,false);
} else {
g.printLine("Not in a channel");
}
Expand All @@ -815,9 +815,9 @@ private void sendMessage(String channel, String text) {
private void sendMessage(String channel, String text, boolean allowCommandMessageLocally) {
if (c.sendSpamProtectedMessage(channel, text, false)) {
User user = c.localUserJoined(channel);
g.printMessage(user, text, false, null, 0);
g.printMessage(user, text, false);
if (allowCommandMessageLocally) {
modCommandAddStreamHighlight(user, text);
modCommandAddStreamHighlight(user, text, MsgTags.EMPTY);
}
} else {
g.printLine("# Message not sent to prevent ban: " + text);
Expand Down Expand Up @@ -1754,7 +1754,7 @@ private void commandActionMessage(String channel, String message) {
public void sendActionMessage(String channel, String message) {
if (c.onChannel(channel, true)) {
if (c.sendSpamProtectedMessage(channel, message, true)) {
g.printMessage(c.localUserJoined(channel), message, true, null, 0);
g.printMessage(c.localUserJoined(channel), message, true);
} else {
g.printLine("# Action Message not sent to prevent ban: " + message);
}
Expand Down Expand Up @@ -1865,9 +1865,9 @@ public void commandOpenStreamHighlights(Room room) {
g.printLine(room, streamHighlights.openFile());
}

public void modCommandAddStreamHighlight(User user, String message) {
public void modCommandAddStreamHighlight(User user, String message, MsgTags tags) {
// Stream Highlights
String result = streamHighlights.modCommand(user, message);
String result = streamHighlights.modCommand(user, message, tags);
if (result != null) {
result = user.getDisplayNick() + ": " + result;
if (settings.getBoolean("streamHighlightChannelRespond")) {
Expand Down Expand Up @@ -2752,12 +2752,11 @@ public void onUserUpdated(User user) {
}

@Override
public void onChannelMessage(User user, String message, boolean action,
String emotes, String id, int bits) {
g.printMessage(user, message, action, emotes, bits, id);
public void onChannelMessage(User user, String text, boolean action, MsgTags tags) {
g.printMessage(user, text, action, tags);
if (!action) {
addressbookCommands(user.getChannel(), user, message);
modCommandAddStreamHighlight(user, message);
addressbookCommands(user.getChannel(), user, text);
modCommandAddStreamHighlight(user, text, tags);
}
}

Expand Down Expand Up @@ -3050,7 +3049,7 @@ private class MyWhisperListener implements WhisperListener {

@Override
public void whisperReceived(User user, String message, String emotes) {
g.printMessage(user, message, false, emotes, 0);
g.printMessage(user, message, false, MsgTags.create("emotes", emotes));
g.updateUser(user);
}

Expand All @@ -3061,7 +3060,7 @@ public void info(String message) {

@Override
public void whisperSent(User to, String message) {
g.printMessage(to, message, true, null, 0);
g.printMessage(to, message, true);
}
}

Expand Down
7 changes: 2 additions & 5 deletions src/chatty/TwitchConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -953,13 +953,10 @@ void onChannelMessage(String channel, String nick, String from, String text,
} else {
User user = userJoined(channel, nick);
updateUserFromTags(user, tags);
String emotesTag = tags.get("emotes");
String id = tags.get("id");
int bits = tags.getInteger("bits", 0);
if (!user.getName().equals(username) || !sentMessages.shouldHide(channel, text)) {
// Don't show if own name and message was sent recently,
// to prevent echo message from being shown in chatrooms
listener.onChannelMessage(user, text, action, emotesTag, id, bits);
listener.onChannelMessage(user, text, action, tags);
}
}
}
Expand Down Expand Up @@ -1480,7 +1477,7 @@ public interface ConnectionListener {

void onUserUpdated(User user);

void onChannelMessage(User user, String message, boolean action, String emotes, String id, int bits);
void onChannelMessage(User user, String msg, boolean action, MsgTags tags);

void onWhisper(User user, String message, String emotes);

Expand Down
8 changes: 6 additions & 2 deletions src/chatty/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,14 @@ public synchronized boolean hasTwitchBadge(String id) {
return twitchBadges != null && twitchBadges.containsKey(id);
}

public List<Usericon> getBadges(boolean botBadgeEnabled) {
public synchronized boolean hasTwitchBadge(String id, String version) {
return twitchBadges != null && twitchBadges.containsKey(id) && twitchBadges.get(id).equals(version);
}

public List<Usericon> getBadges(boolean botBadgeEnabled, boolean pointsHl) {
Map<String, String> badges = getTwitchBadges();
if (iconManager != null) {
return iconManager.getBadges(badges, this, botBadgeEnabled);
return iconManager.getBadges(badges, this, botBadgeEnabled, pointsHl);
}
return null;
}
Expand Down
Loading

0 comments on commit 81118fb

Please sign in to comment.