Fixes searching for recent chats when we have special character in protocol name.

fix-message-formatting
Damian Minkov 12 years ago
parent ac0ce144fe
commit ab756af122

@ -409,6 +409,12 @@ Collection<EventObject> findRecentMessagesPerContact(
this.historyService.getExistingHistories(
new String[]{"messages", "default"});
// make the filter provider string to reflect those that were
// used when creating folders
String providerFilterStr = null;
if(providerToFilter != null)
providerFilterStr = HistoryID.readableHash(providerToFilter);
for(HistoryID id : historyIDs)
{
if(result.size() >= count)
@ -421,9 +427,8 @@ Collection<EventObject> findRecentMessagesPerContact(
continue;
// filter by protocol provider
String accountID = id.getID()[2].replace('_', ':');
if(providerToFilter != null
&& !accountID.startsWith(providerToFilter))
if(providerFilterStr != null
&& !id.getID()[2].startsWith(providerFilterStr))
{
continue;
}
@ -436,7 +441,7 @@ Collection<EventObject> findRecentMessagesPerContact(
// find contact or chatroom for historyID
Object descriptor = getContactOrRoomByID(
accountID,
providerToFilter,
id.getID()[3],
id,
isSMSEnabled);

@ -19,6 +19,7 @@
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import org.jitsi.service.configuration.*;
import org.jitsi.util.*;
import static net.java.sip.communicator.service.history.HistoryService.DATE_FORMAT;
@ -66,6 +67,12 @@ public class MessageSourceService
private static final String NUMBER_OF_RECENT_MSGS_PROP
= "net.java.sip.communicator.impl.msghistory.contactsrc.MSG_NUMBER";
/**
* Property to control version of recent messages.
*/
private static final String VER_OF_RECENT_MSGS_PROP
= "net.java.sip.communicator.impl.msghistory.contactsrc.MSG_VER";
/**
* Property to control messages type. Can query for message sub type.
*/
@ -93,7 +100,7 @@ public class MessageSourceService
* The current version of recent messages. When changed the recent messages
* are recreated.
*/
private static final String RECENT_MSGS_VER = "2";
private static String RECENT_MSGS_VER = "2";
/**
* The structure.
@ -145,8 +152,10 @@ public class MessageSourceService
{
this.messageHistoryService = messageHistoryService;
if(MessageHistoryActivator.getConfigurationService()
.getBoolean(IN_HISTORY_PROPERTY , false))
ConfigurationService conf
= MessageHistoryActivator.getConfigurationService();
if(conf.getBoolean(IN_HISTORY_PROPERTY , false))
{
sourceServiceType = HISTORY_TYPE;
}
@ -154,11 +163,14 @@ public class MessageSourceService
MESSAGE_HISTORY_NAME = MessageHistoryActivator.getResources()
.getI18NString("service.gui.RECENT_MESSAGES");
numberOfMessages = MessageHistoryActivator.getConfigurationService()
.getInt(NUMBER_OF_RECENT_MSGS_PROP, numberOfMessages);
numberOfMessages
= conf.getInt(NUMBER_OF_RECENT_MSGS_PROP, numberOfMessages);
isSMSEnabled
= conf.getBoolean(IS_MESSAGE_SUBTYPE_SMS_PROP, isSMSEnabled);
isSMSEnabled = MessageHistoryActivator.getConfigurationService()
.getBoolean(IS_MESSAGE_SUBTYPE_SMS_PROP, isSMSEnabled);
RECENT_MSGS_VER
= conf.getString(VER_OF_RECENT_MSGS_PROP, RECENT_MSGS_VER);
}
/**

Loading…
Cancel
Save