use of chatty.gui.components.textpane.UserMessage in project chatty by chatty.
the class HighlightedMessages method addMessage.
public void addMessage(String channel, User user, String text, boolean action, TagEmotes emotes, int bits, boolean whisper) {
messageAdded(channel);
UserMessage message = new UserMessage(user, text, emotes, null, bits);
message.whisper = whisper;
messages.printMessage(message);
}
use of chatty.gui.components.textpane.UserMessage in project chatty by chatty.
the class MainGui method commandGui.
/**
* Should only be called out of EDT. All commands have to be defined
* lowercase, because they are made lowercase when entered.
*
* @param command
* @param parameter
* @return
*/
public boolean commandGui(String channel, String command, String parameter) {
if (command.equals("settings")) {
getSettingsDialog().showSettings();
} else if (command.equals("customemotes")) {
printLine(emoticons.getCustomEmotesInfo());
} else if (command.equals("reloadcustomemotes")) {
printLine("Reloading custom emotes from file..");
emoticons.loadCustomEmotes();
printLine(emoticons.getCustomEmotesInfo());
} else if (command.equals("livestreams")) {
openLiveStreamsDialog();
} else if (command.equals("channeladmin")) {
openChannelAdminDialog();
} else if (command.equals("channelinfo")) {
openChannelInfoDialog();
} else if (command.equals("userinfo")) {
User user = client.getExistingUser(channel, parameter);
if (user != null) {
openUserInfoDialog(user, null, null);
} else {
printSystem(String.format("User %s in %s not found", parameter, channel));
}
} else if (command.equals("search")) {
openSearchDialog();
} else if (command.equals("insert")) {
insert(parameter, false);
} else if (command.equals("insertword")) {
insert(parameter, true);
} else if (command.equals("openurl")) {
if (!UrlOpener.openUrl(parameter)) {
printLine("Failed to open URL (none specified or invalid).");
}
} else if (command.equals("openurlprompt")) {
// is mainly for custom commands put in a context menu anyway.
if (!UrlOpener.openUrlPrompt(getActiveWindow(), parameter, true)) {
printLine("Failed to open URL (none specified or invalid).");
}
} else if (command.equals("openfollowers")) {
openFollowerDialog();
} else if (command.equals("opensubscribers")) {
openSubscriberDialog();
} else if (command.equals("openrules")) {
if (parameter != null) {
openChatRules("#" + parameter);
} else {
openChatRules();
}
} else if (command.equals("openstreamchat")) {
openStreamChat();
} else if (command.equals("clearstreamchat")) {
streamChat.clear();
} else if (command.equals("streamchattest")) {
String message = "A bit longer chat message with emotes and stuff " + "FrankerZ ZreknarF MiniK (" + (int) (Math.random() * 10) + ")";
if (parameter != null && !parameter.isEmpty()) {
message = parameter;
}
UserMessage m = new UserMessage(client.getSpecialUser(), message, null, null, 0);
streamChat.printMessage(m);
} else if (command.equals("livestreamer")) {
String stream = null;
String quality = null;
if (parameter != null && !parameter.trim().isEmpty()) {
String[] split = parameter.trim().split(" ");
stream = split[0];
if (stream.equals("$active")) {
stream = channels.getActiveChannel().getStreamName();
if (stream == null) {
printLine("Livestreamer: No channel open.");
return true;
}
}
if (split.length > 1) {
quality = split[1];
}
}
printLine("Livestreamer: Opening stream..");
livestreamerDialog.open(stream, quality);
} else if (command.equals("help")) {
openHelp(null);
} else if (command.equals("setstreamchatsize")) {
Dimension size = Helper.getDimensionFromParameter(parameter);
if (size != null) {
setStreamChatSize(size.width, size.height);
printSystem("Set StreamChat size to " + size.width + "x" + size.height);
return true;
}
printSystem("Invalid parameters.");
} else if (command.equals("getstreamchatsize")) {
Dimension d = streamChat.getSize();
printSystem("StreamChat size: " + d.width + "x" + d.height);
} else if (command.equals("setsize")) {
Dimension size = Helper.getDimensionFromParameter(parameter);
if (size != null) {
setSize(size);
printSystem(String.format("Set Window size to %dx%d", size.width, size.height));
return true;
}
printSystem("Invalid parameters.");
} else {
return false;
}
return true;
}
Aggregations