Add file transfer event for rejected incoming files, update file history and reflect changes in gui.

cusax-fix
Damian Minkov 17 years ago
parent 08613749e0
commit b4af204401

@ -17,13 +17,13 @@
# be used
# - \ at the end of a line means that the translation is continued
# in the next line
# - cannot use single quotes when a parameter is used in the sentence,
# or when using quotes multiple times in the same sentence.
# For exemple, <You can't move contact {0}>, <Contact {0} doesn't exist>,
# <Accept '{0}'> or <Do's and Don't's> does not display correctly. In
# such cases, you need to use double quotes (''):
# <You can''t move contact {0}>, <Contact {0} doesn''t exist>,
# <Accept ''{0}''> or <Do''s and Don''t''s>
# - cannot use single quotes when a parameter is used in the sentence,
# or when using quotes multiple times in the same sentence.
# For exemple, <You can't move contact {0}>, <Contact {0} doesn't exist>,
# <Accept '{0}'> or <Do's and Don't's> does not display correctly. In
# such cases, you need to use double quotes (''):
# <You can''t move contact {0}>, <Contact {0} doesn''t exist>,
# <Accept ''{0}''> or <Do''s and Don''t''s>
#
# To start SIP Communicator with a language that is different
# from your system's language, pass the language code to ant:
@ -152,7 +152,8 @@ service.gui.FILE_RECEIVING_FROM=Receiving file from {0}.
service.gui.FILE_SEND_COMPLETED=File has been successfully sent to {0}.
service.gui.FILE_RECEIVE_COMPLETED=File has been received from {0}.
service.gui.FILE_TRANSFER_CANCELED=File transfer has been canceled.
service.gui.FILE_SEND_REFUSED={0} has refused this file.
service.gui.FILE_SEND_REFUSED=File has been {0} has refused this file.
service.gui.FILE_TRANSFER_REFUSED=File transfer has been rejected.
service.gui.FILE_RECEIVE_REFUSED=You have refused the file from {0}.
service.gui.FILE_TRANSFER_PREPARING=Preparing file transfer with {0}. Please wait...
service.gui.FILE_TRANSFER_REQUEST_RECIEVED={0} is sharing a file with you.

@ -805,6 +805,34 @@ else if (fileTransfer.getDirection() == FileTransfer.OUT)
}
/**
* Called when a new <tt>IncomingFileTransferRequest</tt> has been rejected.
*
* @param event the <tt>FileTransferRequestEvent</tt> containing the
* received request which was rejected.
*/
public void fileTransferRequestRejected(FileTransferRequestEvent event)
{
try
{
IncomingFileTransferRequest req = event.getRequest();
History history = getHistory(null, req.getSender());
HistoryWriter historyWriter = history.getWriter();
historyWriter.updateRecord(
STRUCTURE_NAMES[4],
req.getID(),
STRUCTURE_NAMES[3],
FileRecord.REFUSED
);
}
catch (IOException e)
{
logger.error("Could not add file transfer log to history", e);
}
}
/**
* Used to compare FileRecords
* and to be ordered in TreeSet according their timestamp

@ -1939,7 +1939,7 @@ public void addActiveFileTransfer(String id, Object descriptor)
* file transfers.
* @param id the identifier of the file transfer to remove
*/
private void removeActiveFileTransfer(String id)
public void removeActiveFileTransfer(String id)
{
synchronized (activeFileTransfers)
{

@ -27,6 +27,9 @@ public FileHistoryConversationComponent(FileRecord fileRecord)
String contactName = fileRecord.getContact().getDisplayName();
openFileButton.setVisible(true);
openFolderButton.setVisible(true);
String titleString = "";
if (fileRecord.getDirection().equals(FileRecord.IN))
{
@ -59,6 +62,9 @@ else if (fileRecord.getStatus().equals(FileRecord.REFUSED))
"service.gui.FILE_TRANSFER_REFUSED",
new String[]{contactName});
openFileButton.setVisible(false);
openFolderButton.setVisible(false);
setWarningStyle(true);
}
}
@ -103,8 +109,6 @@ else if (fileRecord.getStatus().equals(FileRecord.REFUSED))
titleLabel.setText(
getDateString(new Date(date)) + titleString);
fileLabel.setText(getFileName(fileRecord.getFile()));
openFileButton.setVisible(true);
openFolderButton.setVisible(true);
}
/**

@ -95,11 +95,14 @@ public void actionPerformed(ActionEvent e)
acceptButton.setVisible(false);
rejectButton.setVisible(false);
setWarningStyle(true);
fileLabel.setText("");
titleLabel.setText(
dateString
+ resources.getI18NString(
"service.gui.FILE_TRANSFER_CANCELED"));
"service.gui.FILE_TRANSFER_REFUSED"));
ReceiveFileConversationComponent.this.chatPanel
.removeActiveFileTransfer(fileTransferRequest.getID());
}
});
@ -238,6 +241,8 @@ else if (status == FileTransferStatusChangeEvent.REFUSED)
"service.gui.FILE_TRANSFER_REFUSED",
new String[]{fromContactName}));
cancelButton.setVisible(false);
openFileButton.setVisible(false);
openFolderButton.setVisible(false);
setWarningStyle(true);
}
}

@ -216,6 +216,16 @@ public void protocolContactClicked(ContactListEvent evt)
contactHandler.contactClicked(protoContact, evt.getClickCount());
}
/**
* Called when a new <tt>IncomingFileTransferRequest</tt> has been rejected.
*
* @param event the <tt>FileTransferRequestEvent</tt> containing the
* received request which was rejected.
*/
public void fileTransferRequestRejected(FileTransferRequestEvent event)
{
}
/**
* Runs the chat window for the specified contact. We examine different
* cases here, depending on the chat window mode.

@ -44,6 +44,8 @@ public class IncomingFileTransferRequestJabberImpl
private Contact sender;
private Date date;
/**
* Creates an <tt>IncomingFileTransferRequestJabberImpl</tt> based on the
* given <tt>fileTransferRequest</tt>, coming from the Jabber protocol.
@ -61,6 +63,7 @@ public IncomingFileTransferRequestJabberImpl(
{
this.fileTransferOpSet = fileTransferOpSet;
this.fileTransferRequest = fileTransferRequest;
this.date = date;
String fromUserID
= StringUtils.parseBareAddress(fileTransferRequest.getRequestor());
@ -158,6 +161,9 @@ public FileTransfer acceptFile(File file)
public void rejectFile()
{
fileTransferRequest.reject();
fileTransferOpSet.fireFileTransferRequestRejected(
new FileTransferRequestEvent(this, this.date));
}
/**

@ -304,6 +304,29 @@ private void fireFileTransferRequest(FileTransferRequestEvent event)
}
}
/**
* Delivers the specified event to all registered file transfer listeners.
*
* @param event the <tt>EventObject</tt> that we'd like delivered to all
* registered file transfer listeners.
*/
void fireFileTransferRequestRejected(FileTransferRequestEvent event)
{
Iterator<FileTransferListener> listeners = null;
synchronized (fileTransferListeners)
{
listeners = new ArrayList<FileTransferListener>
(fileTransferListeners).iterator();
}
while (listeners.hasNext())
{
FileTransferListener listener = listeners.next();
listener.fileTransferRequestRejected(event);
}
}
/**
* Delivers the file transfer to all registered listeners.
*

@ -33,4 +33,12 @@ public interface FileTransferListener
* received file transfer and other details.
*/
public void fileTransferCreated(FileTransferCreatedEvent event);
/**
* Called when a new <tt>IncomingFileTransferRequest</tt> has been rejected.
*
* @param event the <tt>FileTransferRequestEvent</tt> containing the
* received request which was rejected.
*/
public void fileTransferRequestRejected(FileTransferRequestEvent event);
}

@ -1002,5 +1002,9 @@ public void fileTransferCreated(FileTransferCreatedEvent event)
}
public void fileTransferRequestRejected(FileTransferRequestEvent event)
{
}
}
}

Loading…
Cancel
Save