Clears and file history when clear chat history is selected.

cusax-fix
Damian Minkov 12 years ago
parent 9bdd23d95c
commit 48a2f53115

@ -875,6 +875,39 @@ public void fileTransferRequestCanceled(FileTransferRequestEvent event)
}
}
/**
* Permanently removes all locally stored file history.
*
* @throws java.io.IOException
* Thrown if the history could not be removed due to a IO error.
*/
public void eraseLocallyStoredHistory()
throws IOException
{
HistoryID historyId = HistoryID.createFromRawID(
new String[] { "filehistory" });
historyService.purgeLocallyStoredHistory(historyId);
}
/**
* Permanently removes locally stored file history for the metacontact.
*
* @throws java.io.IOException
* Thrown if the history could not be removed due to a IO error.
*/
public void eraseLocallyStoredHistory(MetaContact contact)
throws IOException
{
Iterator<Contact> iter = contact.getContacts();
while (iter.hasNext())
{
Contact item = iter.next();
History history = this.getHistory(null, item);
historyService.purgeLocallyStoredHistory(history.getID());
}
}
/**
* Used to compare FileRecords
* and to be ordered in TreeSet according their timestamp

@ -19,6 +19,7 @@
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.filehistory.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.muc.*;
@ -189,6 +190,10 @@ else if(desc instanceof ChatRoomWrapper)
MessageHistoryService.class)
.eraseLocallyStoredHistory(
(MetaContact)desc);
ServiceUtils.getService(GuiActivator.bundleContext,
FileHistoryService.class)
.eraseLocallyStoredHistory(
(MetaContact)desc);
}
else if(desc instanceof ChatRoomWrapper)
{
@ -226,6 +231,9 @@ else if (menuItemName.equals("eraseAllHistory"))
{
ServiceUtils.getService(GuiActivator.bundleContext,
MessageHistoryService.class).eraseLocallyStoredHistory();
ServiceUtils.getService(GuiActivator.bundleContext,
FileHistoryService.class).eraseLocallyStoredHistory();
}
catch(IOException ex)
{

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.service.filehistory;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.service.contactlist.*;
@ -173,4 +174,24 @@ public Collection<FileRecord> findFirstRecordsAfter(
public Collection<FileRecord> findLastRecordsBefore(
MetaContact contact, Date date, int count)
throws RuntimeException;
/**
* Permanently removes all locally stored file history.
*
* @throws java.io.IOException
* Thrown if the history could not be removed due to a IO error.
*/
public void eraseLocallyStoredHistory()
throws
IOException;
/**
* Permanently removes locally stored file history for the metacontact.
*
* @throws java.io.IOException
* Thrown if the history could not be removed due to a IO error.
*/
public void eraseLocallyStoredHistory(MetaContact contact)
throws IOException;
}

Loading…
Cancel
Save