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.gui.main.account.ADVANCED_CONFIG_DISABLED=false
# impl.msghistory # impl.msghistory
impl.msghistory.IS_MESSAGE_HISTORY_ENABLED=true net.java.sip.communicator.service.msghistory.IS_MESSAGE_HISTORY_ENABLED=true
# branding # branding
plugin.branding.ABOUT_LOGO_FONT_SIZE=14 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 // Check if the message history is enabled in the configuration
// service, and if not do not register the service. // service, and if not do not register the service.
String isMessageHistoryEnabledPropertyString = boolean isMessageHistoryEnabled = configService.getBoolean(
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED"; MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED,
Boolean.parseBoolean(getResources().getSettingsString(
String isMessageHistoryEnabledString = configService.getString( MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED))
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;
// We're adding a property change listener in order to // We're adding a property change listener in order to
// listen for modifications of the isMessageHistoryEnabled property. // listen for modifications of the isMessageHistoryEnabled property.
msgHistoryPropListener = new MessageHistoryPropertyChangeListener(); msgHistoryPropListener = new MessageHistoryPropertyChangeListener();
configService.addPropertyChangeListener( configService.addPropertyChangeListener(
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED", MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED,
msgHistoryPropListener); msgHistoryPropListener);
if (logger.isDebugEnabled()) if (isMessageHistoryEnabled)
logger.debug("Starting the msg history implementation."); {
if (logger.isDebugEnabled())
logger.debug("Starting the msg history implementation.");
this.loadMessageHistoryService(); this.loadMessageHistoryService();
}
} }
/** /**
@ -1881,8 +1867,6 @@ private class SearchProgressWrapper
implements HistorySearchProgressListener implements HistorySearchProgressListener
{ {
private MessageHistorySearchProgressListener listener = null; private MessageHistorySearchProgressListener listener = null;
int allRecords = 0;
HistoryReader reader = null;
double currentReaderProgressRatio = 0; double currentReaderProgressRatio = 0;
double accumulatedRatio = 0; double accumulatedRatio = 0;
double currentProgress = 0; double currentProgress = 0;
@ -1899,8 +1883,6 @@ private class SearchProgressWrapper
private void setCurrentValues( HistoryReader currentReader, private void setCurrentValues( HistoryReader currentReader,
int allRecords) int allRecords)
{ {
this.allRecords = allRecords;
this.reader = currentReader;
currentReaderProgressRatio = currentReaderProgressRatio =
(double)currentReader.countRecords()/allRecords * raiser; (double)currentReader.countRecords()/allRecords * raiser;
accumulatedRatio += currentReaderProgressRatio; accumulatedRatio += currentReaderProgressRatio;
@ -1953,7 +1935,6 @@ private int getProgressMapping(ProgressEvent evt)
*/ */
void clear() void clear()
{ {
allRecords = 0;
currentProgress = 0; currentProgress = 0;
lastHistoryProgress = 0; lastHistoryProgress = 0;
} }
@ -2228,7 +2209,7 @@ public void messageDelivered(AdHocChatRoomMessageDeliveredEvent evt)
public void messageDeliveryFailed( public void messageDeliveryFailed(
AdHocChatRoomMessageDeliveryFailedEvent evt) AdHocChatRoomMessageDeliveryFailedEvent evt)
{ {
// TODO Auto-generated method stub // nothing to do for the history service
} }
public void messageReceived(AdHocChatRoomMessageReceivedEvent evt) public void messageReceived(AdHocChatRoomMessageReceivedEvent evt)

@ -20,6 +20,14 @@
*/ */
public interface MessageHistoryService 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 * Returns all the messages exchanged by all the contacts
* in the supplied metacontact after the given date * in the supplied metacontact after the given date

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

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

Loading…
Cancel
Save