Skip to content

Commit

Permalink
Whispers to Main Chat, some other stuff
Browse files Browse the repository at this point in the history
- Hide userlist for Whisper Tabs
- Change Whisper display mode to per user by default
- Change Whispers to Main Chat
- Fix $[whisper] Tab opening inadvertently
- Replace WhisperConnection by WhisperManager, using the main connection
- Reorganize Settings definition
- Increase max reconnection attempts to 40
- Clean up, remove some unused TwitchConnection code
- Update help
  • Loading branch information
tduva committed Apr 11, 2016
1 parent 9a95ace commit a0491ff
Show file tree
Hide file tree
Showing 11 changed files with 459 additions and 952 deletions.
344 changes: 207 additions & 137 deletions src/chatty/SettingsManager.java

Large diffs are not rendered by default.

38 changes: 8 additions & 30 deletions src/chatty/TwitchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import chatty.util.api.ChannelInfo;
import chatty.util.api.TwitchApi;
import chatty.Version.VersionListener;
import chatty.WhisperConnection.WhisperListener;
import chatty.WhisperManager.WhisperListener;
import chatty.gui.GuiUtil;
import chatty.gui.MainGui;
import chatty.gui.components.Channel;
Expand Down Expand Up @@ -150,7 +150,7 @@ public class TwitchClient {

private final Set<String> refreshRequests = Collections.synchronizedSet(new HashSet<String>());

private final WhisperConnection w;
private final WhisperManager w;
private final IrcLogger ircLogger = new IrcLogger();

private boolean fixServer = false;
Expand Down Expand Up @@ -238,10 +238,7 @@ public TwitchClient(Map<String, String> args) {
c.addChannelStateListener(new ChannelStateUpdater());
c.setSubNotificationPattern(settings.getString("subNotificationPattern"));

w = new WhisperConnection(new MyWhisperListener(), settings);
w.setUsericonManager(usericonManager);
w.setAddressbook(addressbook);
w.setUsercolorManager(usercolorManager);
w = new WhisperManager(new MyWhisperListener(), settings, c);

streamStatusWriter = new StreamStatusWriter(Chatty.getUserDataDirectory(), api);
streamStatusWriter.setSetting(settings.getString("statusWriter"));
Expand Down Expand Up @@ -630,12 +627,10 @@ public boolean prepareConnection(String name, String password,
}

c.connect(server, ports, name, password, autojoin);
w.connect(name, password);
return true;
}

public boolean disconnect() {
w.disconnect();
return c.disconnect();
}

Expand Down Expand Up @@ -761,11 +756,7 @@ else if (command.equals("reconnect")) {
commandReconnect();
}
else if (command.equals("connection")) {
if (!w.isOffline()) {
g.printLine(c.getConnectionInfo()+" {Whisper: "+w.getConnectionInfo()+"}");
} else {
g.printLine(c.getConnectionInfo());
}
g.printLine(c.getConnectionInfo());
}
else if (command.equals("join")) {
commandJoinChannel(parameter);
Expand Down Expand Up @@ -1890,7 +1881,6 @@ public void exit() {
saveSettings(true);
logAllViewerstats();
c.disconnect();
w.disconnect();
g.cleanUp();
chatLog.close();
System.exit(0);
Expand Down Expand Up @@ -2158,6 +2148,7 @@ public void onChannelCleared(String channel) {

@Override
public void onWhisper(User user, String message, String emotes) {
w.whisperReceived(user, message, emotes);
}

@Override
Expand Down Expand Up @@ -2239,10 +2230,8 @@ private class MyWhisperListener implements WhisperListener {

@Override
public void whisperReceived(User user, String message, String emotes) {
g.printMessage(WhisperConnection.WHISPER_CHANNEL, user, message, false, emotes);
if (settings.getLong("whisperDisplayMode") == WhisperConnection.DISPLAY_ONE_WINDOW) {
g.updateUser(user);
}
g.printMessage(WhisperManager.WHISPER_CHANNEL, user, message, false, emotes);
g.updateUser(user);
}

@Override
Expand All @@ -2252,19 +2241,8 @@ public void info(String message) {

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

@Override
public void onRawSent(String text) {
ircLogger.onRawSent(text);
}

@Override
public void onRawReceived(String text) {
ircLogger.onRawReceived(text);
}

}

}
Loading

0 comments on commit a0491ff

Please sign in to comment.