Use common property for message history service and UI

net.java.sip.communicator.service.msghistory.IS_MESSAGE_HISTORY_ENABLED
cusax-fix
Ingo Bauersachs 13 years ago
parent 3e368df399
commit f3ebc89abb

@ -47,7 +47,7 @@ impl.gui.CALL_BUTTON_ENABLED=false
impl.gui.main.account.ADVANCED_CONFIG_DISABLED=false
# impl.msghistory
impl.msghistory.IS_MESSAGE_HISTORY_ENABLED=true
net.java.sip.communicator.service.msghistory.IS_MESSAGE_HISTORY_ENABLED=true
# branding
plugin.branding.ABOUT_LOGO_FONT_SIZE=14

@ -785,41 +785,27 @@ public void start(BundleContext bc)
// Check if the message history is enabled in the configuration
// service, and if not do not register the service.
String isMessageHistoryEnabledPropertyString =
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED";
String isMessageHistoryEnabledString = configService.getString(
isMessageHistoryEnabledPropertyString);
if(isMessageHistoryEnabledString == null)
isMessageHistoryEnabledString =
getResources().
getSettingsString(isMessageHistoryEnabledPropertyString);
// If the property doesn't exist we stop here.
if (isMessageHistoryEnabledString == null
|| isMessageHistoryEnabledString.length() == 0)
return;
boolean isMessageHistoryEnabled
= new Boolean(isMessageHistoryEnabledString).booleanValue();
// If the message history is not enabled we stop here.
if (!isMessageHistoryEnabled)
return;
boolean isMessageHistoryEnabled = configService.getBoolean(
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED,
Boolean.parseBoolean(getResources().getSettingsString(
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED))
);
// We're adding a property change listener in order to
// listen for modifications of the isMessageHistoryEnabled property.
msgHistoryPropListener = new MessageHistoryPropertyChangeListener();
configService.addPropertyChangeListener(
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED",
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED,
msgHistoryPropListener);
if (logger.isDebugEnabled())
logger.debug("Starting the msg history implementation.");
if (isMessageHistoryEnabled)
{
if (logger.isDebugEnabled())
logger.debug("Starting the msg history implementation.");
this.loadMessageHistoryService();
this.loadMessageHistoryService();
}
}
/**
@ -1881,8 +1867,6 @@ private class SearchProgressWrapper
implements HistorySearchProgressListener
{
private MessageHistorySearchProgressListener listener = null;
int allRecords = 0;
HistoryReader reader = null;
double currentReaderProgressRatio = 0;
double accumulatedRatio = 0;
double currentProgress = 0;
@ -1899,8 +1883,6 @@ private class SearchProgressWrapper
private void setCurrentValues( HistoryReader currentReader,
int allRecords)
{
this.allRecords = allRecords;
this.reader = currentReader;
currentReaderProgressRatio =
(double)currentReader.countRecords()/allRecords * raiser;
accumulatedRatio += currentReaderProgressRatio;
@ -1953,7 +1935,6 @@ private int getProgressMapping(ProgressEvent evt)
*/
void clear()
{
allRecords = 0;
currentProgress = 0;
lastHistoryProgress = 0;
}
@ -2228,7 +2209,7 @@ public void messageDelivered(AdHocChatRoomMessageDeliveredEvent evt)
public void messageDeliveryFailed(
AdHocChatRoomMessageDeliveryFailedEvent evt)
{
// TODO Auto-generated method stub
// nothing to do for the history service
}
public void messageReceived(AdHocChatRoomMessageReceivedEvent evt)

@ -20,6 +20,14 @@
*/
public interface MessageHistoryService
{
/**
* Name of the property that indicates whether the logging of messages is
* enabled.
*/
public static final String PNAME_IS_MESSAGE_HISTORY_ENABLED
= "net.java.sip.communicator.service.msghistory."
+ "IS_MESSAGE_HISTORY_ENABLED";
/**
* Returns all the messages exchanged by all the contacts
* in the supplied metacontact after the given date

@ -14,6 +14,7 @@
import javax.net.ssl.*;
import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
@ -55,7 +56,7 @@ public class ConfigurationUtils
private static boolean autoPopupNewMessage = false;
/**
* The send message command. ENTER ou Ctrl-ENTER
* The send message command. ENTER or Ctrl-ENTER
*/
private static String sendMessageCommand;
@ -449,17 +450,13 @@ public static void loadGuiConfigurations()
.booleanValue();
}
// Load the "isHistoryLoggingEnabled" property.
String isHistoryLoggingEnabledString
= configService.getString(
"net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled");
if(isHistoryLoggingEnabledString != null
&& isHistoryLoggingEnabledString.length() > 0)
{
isHistoryLoggingEnabled
= Boolean.parseBoolean(isHistoryLoggingEnabledString);
}
// Load the "IS_MESSAGE_HISTORY_ENABLED" property.
isHistoryLoggingEnabled = configService.getBoolean(
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED,
Boolean.parseBoolean(UtilActivator
.getResources().getSettingsString(
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED))
);
// Load the "isHistoryShown" property.
String isHistoryShownStringProperty =
@ -994,11 +991,11 @@ public static void setLeaveChatRoomOnWindowClose(boolean isLeave)
}
/**
* Returns <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* interface whether the history logging is enabled.
* @return <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>.
* Returns <code>true</code> if the "IS_MESSAGE_HISTORY_ENABLED"
* property is true, otherwise - returns <code>false</code>.
* Indicates to the user interface whether the history logging is enabled.
* @return <code>true</code> if the "IS_MESSAGE_HISTORY_ENABLED"
* property is true, otherwise - returns <code>false</code>.
*/
public static boolean isHistoryLoggingEnabled()
{
@ -1017,7 +1014,7 @@ public static void setHistoryLoggingEnabled(boolean isEnabled)
isHistoryLoggingEnabled = isEnabled;
configService.setProperty(
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED",
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED,
Boolean.toString(isHistoryLoggingEnabled));
}
@ -2320,7 +2317,7 @@ else if (evt.getPropertyName().equals(
= Boolean.parseBoolean(newValue);
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled"))
MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED))
{
isHistoryLoggingEnabled = Boolean.parseBoolean(newValue);
}

@ -32,6 +32,7 @@ Import-Package: com.sun.awt,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.keybindings,
net.java.sip.communicator.service.msghistory,
net.java.sip.communicator.service.netaddr,
net.java.sip.communicator.service.netaddr.event,
net.java.sip.communicator.service.contactlist,

Loading…
Cancel
Save