Skip to content

Commit

Permalink
Updated to v0.9.7-b4.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jun 25, 2019
2 parents 25a6743 + af75736 commit 21c797a
Show file tree
Hide file tree
Showing 3,118 changed files with 5,474 additions and 3,879 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion src/chatty/Chatty.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Chatty {
* by points. May contain a single "b" for beta versions, which are counted
* as older (so 0.8.7b4 is older than 0.8.7).
*/
public static final String VERSION = "0.9.7.163";
public static final String VERSION = "0.9.7.165";

/**
* Enable Version Checker (if you compile and distribute this yourself, you
Expand Down
6 changes: 6 additions & 0 deletions src/chatty/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public void defineSettings() {
settings.addLong("displayNamesModeUserlist", DISPLAY_NAMES_MODE_CAPITALIZED);
settings.addBoolean("showImageTooltips", true);
settings.addLong("mentions", 3);
settings.addLong("mentionsInfo", 3);
settings.addLong("markHoveredUser", chatty.gui.components.textpane.SettingConstants.USER_HOVER_HL_MENTIONS);

// Badges/Emotes
Expand Down Expand Up @@ -253,6 +254,7 @@ public void defineSettings() {
// Message Colors
settings.addBoolean("msgColorsEnabled", false);
settings.addList("msgColors", new LinkedList(), Setting.STRING);
settings.addBoolean("msgColorsPrefer", false);

// Usercolors
settings.addBoolean("customUsercolors", false);
Expand Down Expand Up @@ -821,6 +823,10 @@ public void overrideSettings() {
}
}

if (switchedFromVersionBefore("0.9.7-b4")) {
settings.setLong("mentionsInfo", settings.getLong("mentions"));
}

overrideHotkeySettings();
}

Expand Down
10 changes: 10 additions & 0 deletions src/chatty/TwitchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,8 @@ else if (command.equals("bantest")) {
pubsub.connect();
} else if (command.equals("psdisconnect")) {
pubsub.disconnect();
} else if (command.equals("psreconnect")) {
pubsub.reconnect();
} else if (command.equals("modaction")) {
String by = "Blahfasel";
String action = "timeout";
Expand Down Expand Up @@ -2093,6 +2095,14 @@ public void messageReceived(Message message) {
bannedUser.addBanInfo(data);
g.updateUserinfo(bannedUser);
}
String unbannedUsername = ModLogInfo.getUnbannedUsername(data);
if (unbannedUsername != null) {
// Add info to unbanned user
User unbannedUser = c.getUser(channel, unbannedUsername);
int type = User.UnbanMessage.getType(data.moderation_action);
unbannedUser.addUnban(type, data.created_by);
g.updateUserinfo(unbannedUser);
}
}
}
}
Expand Down
29 changes: 29 additions & 0 deletions src/chatty/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ public synchronized void addBan(long duration, String reason, String id) {
replayCachedBanInfo();
}

public synchronized void addUnban(int type, String by) {
addLine(new UnbanMessage(System.currentTimeMillis(), type, by));
}

public synchronized void addMsgDeleted(String targetMsgId, String msg) {
addLine(new MsgDeleted(System.currentTimeMillis(), targetMsgId, msg, null));
replayCachedBanInfo();
Expand Down Expand Up @@ -1115,6 +1119,31 @@ public BanMessage addModLogInfo(String by, String reason) {

}

public static class UnbanMessage extends Message {

public static final int TYPE_UNKNOWN = -1;
public static final int TYPE_UNBAN = 0;
public static final int TYPE_UNTIMEOUT = 1;

public final int type;
public final String by;

public UnbanMessage(long time, int type, String by) {
super(time);
this.type = type;
this.by = by;
}

public static int getType(String modAction) {
switch (modAction) {
case "unban": return TYPE_UNBAN;
case "untimeout": return TYPE_UNTIMEOUT;
}
return TYPE_UNKNOWN;
}

}

public static class MsgDeleted extends Message {

public final String targetMsgId;
Expand Down
1 change: 1 addition & 0 deletions src/chatty/gui/Channels.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ private void addDefaultChannel() {
*/
private Channel createChannel(Room room, Channel.Type type) {
Channel channel = new Channel(room,type,gui,styleManager, contextMenuListener);
channel.init();
channel.setUserlistWidth(defaultUserlistWidth, minUserlistWidth);
channel.setMouseClickedListener(mouseClickedListener);
channel.setScrollbarAlways(chatScrollbarAlaways);
Expand Down
25 changes: 25 additions & 0 deletions src/chatty/gui/Highlighter.java
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,31 @@ public boolean spans(int start, int end) {
public String toString() {
return start+"-"+end;
}

/**
* Add to the index of all Match objects in the given list of matches.
* Resulting negative indices are set to 0, if start and end are equal
* the match is not added to the result.
*
* @param input The input list
* @param shift How much to add to the indices
* @return A new list with new Match objects, or the same as input if it
* was null or empty
*/
public static List<Match> shiftMatchList(List<Match> input, int shift) {
if (input == null || input.isEmpty()) {
return input;
}
List<Match> result = new ArrayList<>();
for (Match m : input) {
int start = Math.max(m.start + shift, 0);
int end = Math.max(m.end + shift, 0);
if (start != end) {
result.add(new Match(start, end));
}
}
return result;
}

}

Expand Down
31 changes: 31 additions & 0 deletions src/chatty/gui/LaF.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.logging.Logger;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.TabbedPaneUI;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.OceanTheme;

Expand All @@ -29,6 +30,7 @@ public class LaF {
private static Settings settings;
private static String linkColor = "#0000FF";
private static boolean isDarkTheme;
private static String lafClass;

public static void setSettings(Settings settings) {
LaF.settings = settings;
Expand Down Expand Up @@ -119,10 +121,14 @@ public static void setLookAndFeel(String lafCode, String theme) {

LOGGER.info("[LAF] Set " + lafCode + "/" + theme + " [" + laf + "]");
UIManager.setLookAndFeel(laf);
lafClass = laf;
} catch (Exception ex) {
LOGGER.warning("Failed setting LAF: "+ex);
}

// Tab rows not overlaying eachother
UIManager.getDefaults().put("TabbedPane.tabRunOverlay", 0);

if (lafCode.equals("hifi") || lafCode.equals("hifi2")
|| lafCode.equals("noire")) {
linkColor = "#EEEEEE";
Expand All @@ -133,6 +139,31 @@ public static void setLookAndFeel(String lafCode, String theme) {
}
}

/**
* Return a customized UI that disables switching tab rows, based on the
* current Look&Feel.
*
* @return A customized UI, or null if no customized UI should be used
*/
public static TabbedPaneUI getTabbedPaneUI() {
if (lafClass == null) {
return null;
}
if (lafClass.equals("com.jtattoo.plaf.hifi.HiFiLookAndFeel")
|| lafClass.equals("com.jtattoo.plaf.noire.NoireLookAndFeel")) {
// Both of these share the same class for tabs
return new com.jtattoo.plaf.hifi.HiFiTabbedPaneUI() {

@Override
protected boolean shouldRotateTabRuns(int i) {
return false;
}

};
}
return null;
}

private static Properties prepareTheme(Properties properties) {
if (properties == null) {
properties = new Properties();
Expand Down
Loading

0 comments on commit 21c797a

Please sign in to comment.