mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-1361
reduced last shown History to 5000Messages to reduce loading time and ram-usage if you want to increase or decrease set "maximumHistory=xxx" (where xxx is any value) in APPDATA/Spark/spark.properties no Settings Panel for now ------ fixed little roar bug in TopRight-Mode git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12457 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
wolf.posdorfer
parent
2766faed7c
commit
dbb18e3919
Binary file not shown.
@ -122,14 +122,15 @@ INSTALL_PLUGINS_DISABLED =
|
|||||||
# set true if you want to disable deinstalling of Plugins
|
# set true if you want to disable deinstalling of Plugins
|
||||||
DEINSTALL_PLUGINS_DISABLED =
|
DEINSTALL_PLUGINS_DISABLED =
|
||||||
# Put plugins here that you dont want enabled
|
# Put plugins here that you dont want enabled
|
||||||
# comma separated
|
# comma separated, case insensitive
|
||||||
# names of plugins can be found in the plugin.xml
|
# names of plugins can be found in the plugin.xml
|
||||||
# example: Fastpath,Jingle Client,Phone Client,Window Flashing Plugin
|
# example: Fastpath,Jingle Client,Phone Client,Window Flashing Plugin
|
||||||
# default is empty
|
# default is empty
|
||||||
PLUGIN_BLACKLIST =
|
PLUGIN_BLACKLIST =
|
||||||
# Disable Plugins by entrypoint Class
|
# Disable Plugins by entrypoint Class
|
||||||
# Comma seperated
|
# Comma seperated, case sensitive
|
||||||
# example org.jivesoftware.fastpath.FastpathPlugin
|
# example org.jivesoftware.fastpath.FastpathPlugin
|
||||||
|
# default is empty
|
||||||
PLUGIN_BLACKLIST_CLASS =
|
PLUGIN_BLACKLIST_CLASS =
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import java.awt.event.WindowAdapter;
|
|||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -341,10 +342,28 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
|
|
||||||
final TimerTask transcriptTask = new TimerTask() {
|
final TimerTask transcriptTask = new TimerTask() {
|
||||||
public void run() {
|
public void run() {
|
||||||
final ChatTranscript transcript = (ChatTranscript)get();
|
ChatTranscript transcript = (ChatTranscript)get();
|
||||||
|
|
||||||
|
// reduce the size of our transcript to the last 5000Messages
|
||||||
|
// This will prevent JavaOutOfHeap Errors
|
||||||
|
ArrayList<HistoryMessage> toobig = (ArrayList<HistoryMessage>) transcript.getMessage(null);
|
||||||
|
|
||||||
|
// Get the Maximum size from settingsfile
|
||||||
|
int maxsize = SettingsManager.getLocalPreferences().getMaximumHistory();
|
||||||
|
if (toobig.size() > maxsize)
|
||||||
|
{
|
||||||
|
transcript = new ChatTranscript();
|
||||||
|
|
||||||
|
for(int i = toobig.size()-1; i>=toobig.size()-maxsize;--i)
|
||||||
|
{
|
||||||
|
transcript.addHistoryMessage(toobig.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final List<HistoryMessage> list = transcript.getMessage(
|
final List<HistoryMessage> list = transcript.getMessage(
|
||||||
Res.getString("message.search.for.history").equals(searchField.getText())
|
Res.getString("message.search.for.history").equals(searchField.getText())
|
||||||
? null : searchField.getText());
|
? null : searchField.getText());
|
||||||
|
|
||||||
|
|
||||||
final String personalNickname = SparkManager.getUserManager().getNickname();
|
final String personalNickname = SparkManager.getUserManager().getNickname();
|
||||||
Date lastPost = null;
|
Date lastPost = null;
|
||||||
|
|||||||
@ -85,25 +85,31 @@ public final class ChatTranscripts {
|
|||||||
|
|
||||||
private static void writeToFile(File transcriptFile, Collection<HistoryMessage> messages, boolean append) {
|
private static void writeToFile(File transcriptFile, Collection<HistoryMessage> messages, boolean append) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
final String one = " ";
|
||||||
|
final String two = " ";
|
||||||
|
final String three = " ";
|
||||||
|
|
||||||
// Handle new transcript file.
|
// Handle new transcript file.
|
||||||
if (!transcriptFile.exists() || !append) {
|
if (!transcriptFile.exists() || !append) {
|
||||||
builder.append("<transcript><messages>");
|
builder.append("<transcript>\n");
|
||||||
|
builder.append(one+"<messages>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (HistoryMessage m : messages) {
|
for (HistoryMessage m : messages) {
|
||||||
builder.append("<message>");
|
builder.append(two+"<message>\n");
|
||||||
builder.append("<to>").append(m.getTo()).append("</to>");
|
builder.append(three+"<to>").append(m.getTo()).append("</to>\n");
|
||||||
builder.append("<from>").append(m.getFrom()).append("</from>");
|
builder.append(three+"<from>").append(m.getFrom()).append("</from>\n");
|
||||||
builder.append("<body>").append(StringUtils.escapeForXML(m.getBody())).append("</body>");
|
builder.append(three+"<body>").append(StringUtils.escapeForXML(m.getBody())).append("</body>\n");
|
||||||
|
|
||||||
String dateString = FORMATTER.format(m.getDate());
|
String dateString = FORMATTER.format(m.getDate());
|
||||||
builder.append("<date>").append(dateString).append("</date>");
|
builder.append(three+"<date>").append(dateString).append("</date>\n");
|
||||||
builder.append("</message>");
|
builder.append(two+"</message>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transcriptFile.exists() || !append) {
|
if (!transcriptFile.exists() || !append) {
|
||||||
builder.append("</messages></transcript>");
|
builder.append(one+"</messages>\n");
|
||||||
|
builder.append("</transcript>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +133,7 @@ public final class ChatTranscripts {
|
|||||||
|
|
||||||
// We want to append near the end of the document as the last
|
// We want to append near the end of the document as the last
|
||||||
// child in the transcript.
|
// child in the transcript.
|
||||||
final String endTag = "</messages></transcript>";
|
final String endTag = " </messages>\n</transcript>";
|
||||||
builder.append(endTag);
|
builder.append(endTag);
|
||||||
|
|
||||||
raf.seek(transcriptFile.length() - endTag.length());
|
raf.seek(transcriptFile.length() - endTag.length());
|
||||||
@ -192,6 +198,7 @@ public final class ChatTranscripts {
|
|||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return transcript;
|
return transcript;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1049,6 +1049,20 @@ public class LocalPreferences {
|
|||||||
setBoolean("autoAcceptMucInvite", autoAcceptMuc);
|
setBoolean("autoAcceptMucInvite", autoAcceptMuc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Maximum visible amount of History entries
|
||||||
|
* Default is 5000
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getMaximumHistory() {
|
||||||
|
int x = getInt("maximumHistory", -1);
|
||||||
|
if (x == -1) {
|
||||||
|
x = 5000;
|
||||||
|
setInt("maximumHistory", x);
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,6 +106,11 @@ public class TopRight implements RoarDisplayType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
--_amount;
|
--_amount;
|
||||||
|
|
||||||
|
if (_amount == 0) {
|
||||||
|
_lastusedXpos = _screensize.width - 5;
|
||||||
|
_lastusedYpos = 5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user