Update EmoticonPack.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6088 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2006-11-13 07:31:14 +00:00
committed by derek
parent 03bafa7cc9
commit b6864dd2be
4 changed files with 30 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<install4j version="3.2.4">
<install4j version="3.2.1">
<directoryPresets config="../../documentation" />
<application name="%APP_NAME%" distributionSourceDir="" applicationId="3057-7228-2063-7466" mediaDir="../../../../.." mediaFilePattern="spark_%VERSION%" compression="6" lzmaCompression="true" keepModificationTimes="false" shortName="%APP_SHORT_NAME%" publisher="%PUBLISHER%" publisherWeb="%PUBLISHER_URL%" version="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%" allPathsRelative="true" backupOnSave="false" autoSave="false" macSignature="????" javaMinVersion="1.5" javaMaxVersion="1.6" allowBetaVM="false">
<searchSequence>
@ -174,8 +174,6 @@
</mediaSets>
<buildIds buildAll="false">
<mediaSet refId="2" />
<mediaSet refId="13" />
<mediaSet refId="19" />
</buildIds>
</install4j>

View File

@ -21,6 +21,7 @@ import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.component.VerticalFlowLayout;
import org.jivesoftware.spark.ui.themes.ThemeManager;
import org.jivesoftware.spark.util.ModelUtil;
import org.jivesoftware.spark.util.URLFileSystem;
import org.jivesoftware.spark.util.log.Log;
import org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon;
import org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager;
@ -171,13 +172,13 @@ public class TranscriptWindow extends JPanel {
public void insertCustomMessage(String prefix, String message) {
message = filterBody(message);
String text = themeManager.getOutgoingMessage(prefix, "", message, null);
String text = themeManager.getOutgoingMessage(prefix, "", message, vcardManager.getAvatar(""));
executeScript("appendMessage('" + text + "')");
}
public void insertCustomOtherMessage(String prefix, String message) {
message = filterBody(message);
String text = themeManager.getIncomingMessage(prefix, "", message, null);
String text = themeManager.getIncomingMessage(prefix, "", message, vcardManager.getAvatar(""));
executeScript("appendMessage('" + text + "')");
}
@ -198,7 +199,7 @@ public class TranscriptWindow extends JPanel {
}
String body = message.getBody();
body = filterBody(body);
try {
DelayInformation inf = (DelayInformation)message.getExtension("x", "jabber:x:delay");
@ -215,6 +216,7 @@ public class TranscriptWindow extends JPanel {
String theDate = getDate(sentDate);
body = org.jivesoftware.spark.util.StringUtils.escapeHTMLTags(body);
body = filterBody(body);
if (userid.equals(activeUser)) {
String text = themeManager.getNextIncomingMessage(body, theDate);
@ -506,7 +508,7 @@ public class TranscriptWindow extends JPanel {
StringBuilder builder = new StringBuilder();
final StringTokenizer tokenizer = new StringTokenizer(text, "> \n \t", true);
final StringTokenizer tokenizer = new StringTokenizer(text, " \n \t", true);
while (tokenizer.hasMoreTokens()) {
String textFound = tokenizer.nextToken();
if (textFound.startsWith("http://") || textFound.startsWith("ftp://")
@ -516,6 +518,7 @@ public class TranscriptWindow extends JPanel {
else if (emoticonManager.getEmoticon(textFound) != null) {
Emoticon emot = emoticonManager.getEmoticon(textFound);
URL url = emoticonManager.getEmoticonURL(emot);
File file = URLFileSystem.url2File(url);
builder.append("<img src=\"").append(url.toExternalForm()).append("\" />");
}
else {

View File

@ -16,6 +16,7 @@ import org.jivesoftware.spark.ui.TranscriptWindow;
import org.jivesoftware.spark.util.ResourceUtils;
import org.jivesoftware.spark.util.URLFileSystem;
import org.jivesoftware.spark.util.WindowsFileSystemView;
import org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon;
import org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager;
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
@ -127,12 +128,14 @@ public class ThemePanel extends JPanel {
emoticonBox.addItem(pack);
}
String activePack = pref.getEmoticonPack();
final String activePack = pref.getEmoticonPack();
emoticonBox.setSelectedItem(activePack);
emoticonBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
emoticonManager.addEmoticonPack((String)emoticonBox.getSelectedItem());
emoticonManager.setActivePack((String)emoticonBox.getSelectedItem());
showSelectedTheme();
}
});
@ -175,6 +178,18 @@ public class ThemePanel extends JPanel {
transcript.insertNotificationMessage("Welcome to this theme.");
transcript.executeScript(("appendMessage('" + message1 + "')"));
transcript.executeScript("appendMessage('" + message2 + "')");
StringBuilder builder = new StringBuilder();
EmoticonManager emoticonManager = EmoticonManager.getInstance();
for (Emoticon emoticon : emoticonManager.getActiveEmoticonSet()) {
String eq = emoticon.getEquivalants().get(0);
builder.append(eq);
builder.append(" ");
}
transcript.insertCustomMessage("Emoticon Man:", builder.toString());
}
public String getSelectedTheme() {

View File

@ -107,6 +107,11 @@ public class EmoticonManager {
return emoticonPack;
}
public void setActivePack(String pack) {
final LocalPreferences pref = SettingsManager.getLocalPreferences();
pref.setEmoticonPack(pack);
}
public String installPack(File pack) {
String name = null;
// Copy to the emoticon area