Skip to content

Commit

Permalink
Updated to v0.24.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed May 11, 2023
2 parents 221597a + e17ed1d commit e23d8ca
Show file tree
Hide file tree
Showing 20 changed files with 219 additions and 40 deletions.
3 changes: 2 additions & 1 deletion src/chatty/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void defineSettings() {

// Hotkeys
addDefaultHotkeyAppWide("0.7.3", "dialog.streams", "ctrl L");
addDefaultHotkey("0.7.3", "dialog.toggleEmotes", "ctrl E");
addDefaultHotkeyAppWide("0.7.3", "dialog.toggleEmotes", "ctrl E");
addDefaultHotkey("0.7.3", "dialog.search", "ctrl F");
addDefaultHotkey("0.7.3", "dialog.joinChannel", "ctrl J");
addDefaultHotkeyAppWide("0.7.3", "window.toggleUserlist", "F9");
Expand Down Expand Up @@ -775,6 +775,7 @@ public void defineSettings() {
settings.addBoolean("streamHighlightCustomEnabled", false);
settings.addString("streamHighlightCustom", "$(timestamp),$(chan),$(uptime),$(streamgame),$(chatuser),$quote($(rawcomment))");
settings.addBoolean("streamHighlightExtra", true);
settings.addLong("streamHighlightCooldown", 0);

// Stream Status Writer
settings.addBoolean("enableStatusWriter", false);
Expand Down
16 changes: 16 additions & 0 deletions src/chatty/gui/Highlighter.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ public boolean matches(Type type, String text, int msgStart, int msgEnd, Blackli
private Color backgroundColor;
private boolean noNotification;
private boolean noSound;
private boolean hide;
private boolean noLog;

/**
* Replacement string for filtering parts of a message
Expand Down Expand Up @@ -905,6 +907,12 @@ else if (item.startsWith("config:")) {
else if (part.equals("!notify")) {
noNotification = true;
}
else if (part.equals("hide")) {
hide = true;
}
else if (part.equals("!log")) {
noLog = true;
}
else if (part.equals("block")) {
blacklistBlock = true;
}
Expand Down Expand Up @@ -2045,6 +2053,14 @@ public boolean noSound() {
return noSound;
}

public boolean hide() {
return hide;
}

public boolean noLog() {
return noLog;
}

public String getFailedReason() {
if (failedItem != null) {
return failedItem.toString();
Expand Down
47 changes: 33 additions & 14 deletions src/chatty/gui/MainGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,9 @@ public void emoteMenuItemClicked(ActionEvent e, CachedImage<Emoticon> emoteImage
} else if (e.getActionCommand().equals("cheer")) {
url = "https://help.twitch.tv/customer/portal/articles/2449458";
} else if (e.getActionCommand().equals("emoteImage")) {
url = emoteImage.getLoadedFrom();
url = emoteImage.getSourceUrl();
} else if (e.getActionCommand().equals("emoteImageLoaded")) {
url = emoteImage.getLoadedFromUrl();
} else if (e.getActionCommand().equals("ffzlink")) {
url = TwitchUrl.makeFFZUrl();
} else if (e.getActionCommand().equals("emoteId")) {
Expand Down Expand Up @@ -2512,7 +2514,7 @@ else if (e.getActionCommand().startsWith("hideUsericonOfBadgeType")) {
}
}
else if (e.getActionCommand().equals("badgeImage")) {
UrlOpener.openUrlPrompt(getActiveWindow(), usericonImage.getLoadedFrom(), true);
UrlOpener.openUrlPrompt(getActiveWindow(), usericonImage.getSourceUrl(), true);
}
}

Expand Down Expand Up @@ -3544,11 +3546,16 @@ public void run() {
ignoreMatches = ignoreList.getLastTextMatches();
ignoreSource = ignoreList.getLastMatchItems();
}
ignoredMessages.addMessage(channel, user, text, action,
tagEmotes, bitsForEmotes, whisper, ignoreMatches,
ignoreSource, tags);
client.chatLog.message("ignored", user, text, action, channel);
ignoredMessagesHelper.ignoredMessage(channel);
// No match item is set when ignored by "Ignored Users" list
if (ignoredUser || !ignoreList.getLastMatchItem().hide()) {
ignoredMessages.addMessage(channel, user, text, action,
tagEmotes, bitsForEmotes, whisper, ignoreMatches,
ignoreSource, tags);
ignoredMessagesHelper.ignoredMessage(channel);
}
if (ignoredUser || !ignoreList.getLastMatchItem().noLog()) {
client.chatLog.message("ignored", user, text, action, channel);
}
}
long ignoreMode = client.settings.getLong("ignoreMode");

Expand Down Expand Up @@ -3600,8 +3607,12 @@ public void run() {
}
chan.printMessage(message, timestamp);
if (highlighted) {
highlightedMessages.addMessage(channel, message);
client.chatLog.message("highlighted", user, text, action, channel);
if (!highlighter.getLastMatchItem().hide()) {
highlightedMessages.addMessage(channel, message);
}
if (!highlighter.getLastMatchItem().noLog()) {
client.chatLog.message("highlighted", user, text, action, channel);
}
}
if (client.settings.listContains("streamChatChannels", channel)) {
streamChat.printMessage(message);
Expand Down Expand Up @@ -3978,18 +3989,26 @@ private boolean printInfo(Channel channel, InfoMessage message) {
}
// After colors and everything is set
if (highlighted) {
highlightedMessages.addInfoMessage(channel.getChannel(), message);
client.chatLog.info("highlighted", message.text, channel.getChannel());
if (!highlighter.getLastMatchItem().hide()) {
highlightedMessages.addInfoMessage(channel.getChannel(), message);
}
if (!highlighter.getLastMatchItem().noLog()) {
client.chatLog.info("highlighted", message.text, channel.getChannel());
}
}
}
channel.printInfoMessage(message);
if (channel.getType() == Channel.Type.SPECIAL) {
channels.setChannelNewMessage(channel);
}
} else if (!message.isHidden()) {
ignoredMessages.addInfoMessage(channel.getChannel(), message.text,
ignoreList.getLastTextMatches(), ignoreList.getLastMatchItems());
client.chatLog.info("ignored", message.text, channel.getChannel());
if (!ignoreList.getLastMatchItem().hide()) {
ignoredMessages.addInfoMessage(channel.getChannel(), message.text,
ignoreList.getLastTextMatches(), ignoreList.getLastMatchItems());
}
if (!ignoreList.getLastMatchItem().noLog()) {
client.chatLog.info("ignored", message.text, channel.getChannel());
}
}

//----------
Expand Down
36 changes: 28 additions & 8 deletions src/chatty/gui/components/EmotesDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@
import chatty.util.api.Emoticon.TypeCategory;
import chatty.util.api.EmoticonFavorites.Favorite;
import chatty.util.api.IgnoredEmotes;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JTextField;
import javax.swing.KeyStroke;

/**
* Dialog showing emoticons that can be clicked on to insert them in the last
Expand Down Expand Up @@ -1225,21 +1229,37 @@ private void addNotFoundList(Collection<Emoticon> chanSpecificFavs) {
list.setModel(data);
notFoundFavorites.forEach(fav -> data.addElement(fav));

// Remove Button
JButton removeButton = new JButton(Language.getString("emotesDialog.button.unfavoriteSelected"));
removeButton.addActionListener(e -> {
int selected = list.getSelectedIndex();
Runnable removeAction = () -> {
// Remove selected entries
Collection<Favorite> toRemove = list.getSelectedValuesList();
emoteManager.removeFavorites(toRemove);
toRemove.forEach(fav -> data.removeElement(fav));
// Select an entry again
selected = Math.min(data.size() - 1, selected);
if (data.size() > selected) {
list.setSelectedIndex(selected);
// For updating title
updateEmotes();
};
list.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "removeFavoriteEmotes");
list.getActionMap().put("removeFavoriteEmotes", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
removeAction.run();
}
});
JListActionHelper.install(list, (a, l, s) -> {
if (a == JListActionHelper.Action.CONTEXT_MENU) {
JPopupMenu menu = new JPopupMenu();
JMenuItem item = new JMenuItem(Language.getString("emotesDialog.button.unfavoriteSelected"));
item.addActionListener(e2 -> removeAction.run());
menu.add(item);
menu.show(list, l.x, l.y);
}
});

// Remove Button
JButton removeButton = new JButton(Language.getString("emotesDialog.button.unfavoriteSelected"));
removeButton.addActionListener(e -> {
removeAction.run();
});

// Layout
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JScrollPane(list), BorderLayout.CENTER);
Expand Down
50 changes: 48 additions & 2 deletions src/chatty/gui/components/help/help-releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<h1><a name="top">Release Information</a></h1>

<p>
<a href="#0.24.1">0.24.1</a> |
<a href="#0.24">0.24</a> |
<a href="#0.23">0.23</a> |
<a href="#0.22">0.22</a> |
Expand Down Expand Up @@ -73,11 +74,56 @@ <h1><a name="top">Release Information</a></h1>
full list of changes.</p>

<h2>
<a name="0.24">Version 0.24</a> <a name="latest">(This one!)</a> (2023-??-??)
<a name="0.24.1">Version 0.24.1</a> <a name="latest">(This one!)</a> (2023-05-10)
<a href="#top" class="top">[back to top]</a>
</h2>
<pre>
BETA, TBD
- Fixed error that can occur when users are added to the Ignored Users list
</pre>

<h2>
<a name="0.24">Version 0.24</a> (2023-05-09)
<a href="#top" class="top">[back to top]</a>
</h2>
<pre>
### Twitch Features
- Added some support for suspicious users (for moderators)
- Info about monitored/restricted messages it appended to the message
- Restricted messages (that aren't posted to regular chat) are shown in chat
- Changing monitored/restricted status of a user shown in Modlogs
- Some information shown in the User Dialog of involved users
- You can match on restricted messages via `config:restricted`, monitored
users can not be matched on since that information isn't necessarily
available at the time matching happens
- There is no API to get/change the monitored/restricted state of users, only
the info associated with chat messages

### Emoticons
- Improved support for Follower Emotes (subscribers can use them globally)
- Added support for FFZ animated emotes
- Added setting to toggle using WebP (and WebP is now als used for BTTV and
animated FFZ emotes for better quality, if possible)
- Fallback to PNG/GIF for 7TV if WebP is not enabled or supported

### Other
- Added command `/msgreplythread` to continue a reply thread
- Added check whether updating stream status in Admin Dialog actually succeeded
(the API does not always return an error when it should)
- Made search dialog resizable
- Increased chat input field length limit for non-messages (e.g. when using
setting commands with a long value)
- Improved `$j()` replacement (for `$json()`) to allow more functions to be
applied to objects, added `[sort]` and sub parameters for more flexibility
- Added Stream Highlights cooldown setting
- Added matching prefixes `config:hide` (to not add to the Highlighted/Ignored
Messages panel) and `config:!log` (to not add to the separate log files)
- Some small UI improvements
- Updated help

### Bugfixes
- Fixed bug in Highlight Tester where presets/substitutes were sometimes not set
- Fixed 7TV emotes with special characters not being shown
- Fixed favorite emotes not being sorted first unless `:` is used
</pre>

<h2>
Expand Down
5 changes: 5 additions & 0 deletions src/chatty/gui/components/help/help-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,11 @@ <h3><a name="Highlight_Meta_Behaviour">Meta Prefixes (Behaviour)</a></h3>
In the Highlight settings you can also enable this for all
Highlight items, without having to apply this prefix to each
one.</li>
<li><code>config:hide</code> - Don't add the message to the
Highlighted/Ignored Messages panel</li>
<li><code>config:!log</code> - Don't log the message to the
separate highlighted/ignored log file (may still be logged
to the channel log file)</li>
</ul>
</li>
<li><code>n:</code> to provide a note that is ignored for matching.
Expand Down
2 changes: 1 addition & 1 deletion src/chatty/gui/components/help/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1><a name="top">Chatty (Version: 0.24-b2)</a></h1>
<h1><a name="top">Chatty (Version: 0.24.1)</a></h1>
<table>
<tr>
<td valign="top">
Expand Down
5 changes: 4 additions & 1 deletion src/chatty/gui/components/menus/EmoteContextMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public EmoteContextMenu(CachedImage<Emoticon> emoteImage, ContextMenuListener li
}
}
}
addItem("emoteImage", emoteImage.getSizeString(), ICON_IMAGE);
String imageMenu = emoteImage.getSizeString();
addItem("emoteImage", "Source", imageMenu);
addItem("emoteImageLoaded", "Loaded from", imageMenu);
setSubMenuIcon(imageMenu, ICON_IMAGE);
switch (emote.type) {
case TWITCH:
case FFZ:
Expand Down
11 changes: 11 additions & 0 deletions src/chatty/gui/components/settings/ComboLongSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ public ComboLongSetting(Map<Long, String> items) {
super(items);
}

@Override
public Long getSettingValue(Long def) {
// When combobox is set as editable the input may not be a number
try {
return super.getSettingValue(def);
}
catch (ClassCastException ex) {
return 0L;
}
}

}
5 changes: 5 additions & 0 deletions src/chatty/gui/components/settings/SettingsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,10 @@ protected JTextField addSimpleLongSetting(String name, int size, boolean editabl
}

protected ComboLongSetting addComboLongSetting(String name, int... choices) {
return addComboLongSetting(name, false, choices);
}

protected ComboLongSetting addComboLongSetting(String name, boolean editable, int... choices) {
Map<Long, String> localizedChoices = new LinkedHashMap<>();
for (Integer choice : choices) {
String label = Language.getString("settings.long."+name+".option."+choice, false);
Expand All @@ -954,6 +958,7 @@ protected ComboLongSetting addComboLongSetting(String name, int... choices) {
localizedChoices.put((long)choice, label);
}
ComboLongSetting result = new ComboLongSetting(localizedChoices);
result.setEditable(editable);
result.setToolTipText(SettingsUtil.addTooltipLinebreaks(Language.getString("settings.long."+name+".tip", false)));
longSettings.put(name, result);
return result;
Expand Down
4 changes: 4 additions & 0 deletions src/chatty/gui/components/settings/StreamSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ public String test(Window parent, Component component, int x, int y, String valu

SettingsUtil.addSubsettings(customEnabled, customOutput);

SettingsUtil.addLabeledComponent(hlPanel, "streamHighlightCooldown",
0, 5, 2, GridBagConstraints.WEST,
d.addComboLongSetting("streamHighlightCooldown", true, 0, 5, 10, 15, 20, 25, 30, 60, 120));

//==========================
// Chat Command
//==========================
Expand Down
2 changes: 1 addition & 1 deletion src/chatty/gui/components/textpane/ChannelTextPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -2799,7 +2799,7 @@ private void findEmoticons(String text, User user, Map<Integer, Integer> ranges,
// Sent messages
if (user.isLocalUser()) {
findEmoticons(main.emoticons.getUsableGlobalTwitchEmotes(), text, ranges, rangesStyle);
findEmoticons(main.emoticons.getUsableFollowerEmotes(channel.getStreamName()), text, ranges, rangesStyle);
findEmoticons(main.emoticons.getUsableFollowerEmotes(user.getStream()), text, ranges, rangesStyle);
findEmoticons(main.emoticons.getSmilies(), text, ranges, rangesStyle);
}

Expand Down
3 changes: 3 additions & 0 deletions src/chatty/lang/Strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,9 @@ settings.boolean.streamHighlightCustomEnabled = Output to file with custom forma
settings.streamHighlights.customOutput = Custom format that gets written to file
settings.boolean.streamHighlightExtra = Write additional lines (stream separator, error messages)
settings.boolean.streamHighlightExtra.tip = Add a "-" line between streams/sessions and add possible error messages. If you want the file to be more machine-readable it may help to disable this.
settings.label.streamHighlightCooldown = Cooldown (seconds):
settings.label.streamHighlightCooldown.tip = Highlight will not be added unless the set amount of seconds have passed since the last time a highlight was added (per channel)
settings.long.streamHighlightCooldown.option.0 = Off

!-- Hotkey Settings --!
settings.hotkeys.key.button.set = Set key combination
Expand Down
Loading

0 comments on commit e23d8ca

Please sign in to comment.