From c5d68bd2daefbc5be750cefe3362137d14c7a7d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Apr 2011 06:35:17 +0200 Subject: [PATCH] Fire appropriate event if cancelled by user. --- src/main/java/net/pterodactylus/sone/core/FreenetInterface.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index 3466ead..90383e1 100644 --- a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java +++ b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java @@ -432,7 +432,11 @@ public class FreenetInterface { @Override public void onFailure(InsertException insertException, BaseClientPutter clientPutter, ObjectContainer objectContainer) { for (ImageInsertListener imageInsertListener : imageInsertListeners) { - imageInsertListener.imageInsertFailed(image, insertException); + if ((insertException != null) && ("Cancelled by user".equals(insertException.getMessage()))) { + imageInsertListener.imageInsertAborted(image); + } else { + imageInsertListener.imageInsertFailed(image, insertException); + } } } -- 2.7.4