diff options
Diffstat (limited to 'src/main')
13 files changed, 132 insertions, 108 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java b/src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java index ee6af84f..bba52954 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java +++ b/src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java @@ -33,12 +33,18 @@ import de.thedevstack.conversationsplus.ui.UiCallback; public class PgpEngine { private OpenPgpApi api; private XmppConnectionService mXmppConnectionService; + private static PgpEngine INSTANCE; public PgpEngine(OpenPgpApi api, XmppConnectionService service) { this.api = api; this.mXmppConnectionService = service; + INSTANCE = this; } + public static PgpEngine getInstance() { + return INSTANCE; + } + public void decrypt(final Message message, final UiCallback<Message> callback) { Intent params = new Intent(); params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java index f8856f90..4bc27a7d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java +++ b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java @@ -41,6 +41,7 @@ import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.parser.IqParser; import de.thedevstack.conversationsplus.services.XmppConnectionService; import de.thedevstack.conversationsplus.utils.CryptoHelper; +import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.SerialSingleThreadExecutor; import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.OnAdvancedStreamFeaturesLoaded; @@ -946,7 +947,7 @@ public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, Axolo public void run() { XmppAxolotlMessage axolotlMessage = encrypt(message); if (axolotlMessage == null) { - mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(message, Message.STATUS_SEND_FAILED); //mXmppConnectionService.updateConversationUi(); } else { Log.d(Config.LOGTAG, AxolotlServiceImpl.getLogprefix(account) + "Generated message, caching: " + message.getUuid()); diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java index da24f5ab..231a6ca7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java +++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java @@ -91,7 +91,7 @@ public class HttpUploadConnection implements Transferable { private void fail() { mHttpConnectionManager.finishUploadConnection(this); message.setTransferable(null); - mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(message, Message.STATUS_SEND_FAILED); StreamUtil.close(mFileInputStream); } @@ -145,7 +145,7 @@ public class HttpUploadConnection implements Transferable { } }); message.setTransferable(this); - mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND); + MessageUtil.markMessage(message, Message.STATUS_UNSEND); } private class FileUploader implements Runnable { diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java index a89adb23..a8e5929b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java @@ -3,6 +3,7 @@ package de.thedevstack.conversationsplus.parser; import android.util.Log; import android.util.Pair; +import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.xmpp.httpuploadim.HttpUploadHint; import de.tzur.conversations.Settings; @@ -343,12 +344,12 @@ public class MessageParser extends AbstractParser implements if (counterpart.getResourcepart().equals(conversation.getMucOptions().getActualNick())) { status = Message.STATUS_SEND_RECEIVED; isCarbon = true; //not really carbon but received from another resource - if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status)) { + if (MessageUtil.markMessage(conversation, remoteMsgId, status)) { return; } else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) { Message message = conversation.findSentMessageWithBody(packet.getBody()); if (message != null) { - mXmppConnectionService.markMessage(message, status); + MessageUtil.markMessage(message, status); return; } } @@ -535,7 +536,7 @@ public class MessageParser extends AbstractParser implements while (message != null && message.getStatus() == Message.STATUS_SEND_RECEIVED && message.getTimeSent() < displayedMessage.getTimeSent()) { - mXmppConnectionService.markMessage(message, Message.STATUS_SEND_DISPLAYED); + MessageUtil.markMessage(message, Message.STATUS_SEND_DISPLAYED); message = message.prev(); } } diff --git a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java index cf587efe..9c0e55db 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java @@ -217,7 +217,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (conversation.getAccount() == account) { Message message = conversation.findUnsentMessageWithUuid(uuid); if (message != null) { - markMessage(message, Message.STATUS_SEND); + MessageUtil.markMessage(message, Message.STATUS_SEND); } } } @@ -360,64 +360,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } - public void attachLocationToConversation(final Conversation conversation, - final Uri uri, - final UiCallback<Message> callback) { - int encryption = conversation.getNextEncryption(); - if (encryption == Message.ENCRYPTION_PGP) { - encryption = Message.ENCRYPTION_DECRYPTED; - } - Message message = new Message(conversation, uri.toString(), encryption); - if (conversation.getNextCounterpart() != null) { - message.setCounterpart(conversation.getNextCounterpart()); - } - if (encryption == Message.ENCRYPTION_DECRYPTED) { - getPgpEngine().encrypt(message, callback); - } else { - callback.success(message); - } - } - - public void attachFileToConversation(final Conversation conversation, - final Uri uri, - final UiCallback<Message> callback) { - final Message message; - if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { - message = new Message(conversation, "", Message.ENCRYPTION_DECRYPTED); - } else { - message = new Message(conversation, "", conversation.getNextEncryption()); - } - message.setCounterpart(conversation.getNextCounterpart()); - message.setType(Message.TYPE_FILE); - String path = FileUtils.getPath(uri); - if (path != null) { - message.setRelativeFilePath(path); - MessageUtil.updateFileParams(message); - if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { - getPgpEngine().encrypt(message, callback); - } else { - callback.success(message); - } - } else { - ConversationsPlusApplication.executeFileAdding(new Runnable() { - @Override - public void run() { - try { - FileBackend.copyFileToPrivateStorage(message, uri); - MessageUtil.updateFileParams(message); - if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { - getPgpEngine().encrypt(message, callback); - } else { - callback.success(message); - } - } catch (FileCopyException e) { - callback.error(e.getResId(), message); - } - } - }); - } - } - public Conversation find(Bookmark bookmark) { return find(bookmark.getAccount(), bookmark.getJid()); } @@ -828,7 +770,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa new Conversation.OnMessageFound() { @Override public void onMessageFound(Message message) { - markMessage(message, Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(message, Message.STATUS_SEND_FAILED); } }); } @@ -940,9 +882,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (resend) { if (packet != null && addToConversation) { if (account.getXmppConnection().getFeatures().sm() || conversation.getMode() == Conversation.MODE_MULTI) { - markMessage(message, Message.STATUS_UNSEND); + MessageUtil.markMessage(message, Message.STATUS_UNSEND); } else { - markMessage(message, Message.STATUS_SEND); + MessageUtil.markMessage(message, Message.STATUS_SEND); } } } else { @@ -1158,7 +1100,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED)); final int s = message.getStatus(); if (s == Message.STATUS_WAITING || s == Message.STATUS_OFFERED || s == Message.STATUS_UNSEND) { - markMessage(message, Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(message, Message.STATUS_SEND_FAILED); } } } @@ -2344,7 +2286,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa @Override public void onMessageFound(Message message) { - markMessage(message, Message.STATUS_WAITING); + MessageUtil.markMessage(message, Message.STATUS_WAITING); } }); } @@ -2359,7 +2301,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (conversation.getJid().toBareJid().equals(recipient) && conversation.getAccount() == account) { final Message message = conversation.findSentMessageWithUuidOrRemoteId(uuid); if (message != null) { - markMessage(message, status); + MessageUtil.markMessage(message, status); } return message; } @@ -2367,24 +2309,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa return null; } - public boolean markMessage(Conversation conversation, String uuid, int status) { - if (uuid == null) { - return false; - } else { - Message message = conversation.findSentMessageWithUuid(uuid); - if (message != null) { - markMessage(message, status); - return true; - } else { - return false; - } - } - } - - public void markMessage(Message message, int status) { - MessageUtil.markMessage(message, status); - } - public int unreadCount() { int count = 0; for (Conversation conversation : getConversations()) { @@ -2682,7 +2606,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void resendFailedMessages(final Message message) { if (message.getStatus() == Message.STATUS_SEND_FAILED) { message.setTime(System.currentTimeMillis()); - markMessage(message, Message.STATUS_WAITING); + MessageUtil.markMessage(message, Message.STATUS_WAITING); this.resendMessage(message, false); } } diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java index 301ba563..de69c1e6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java @@ -47,6 +47,7 @@ import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.ui.dialogs.UserDecisionDialog; import de.thedevstack.conversationsplus.ui.listeners.ResizePictureUserDecisionListener; +import de.thedevstack.conversationsplus.utils.ConversationUtil; import de.timroes.android.listview.EnhancedListView; import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.R; @@ -1420,7 +1421,7 @@ public class ConversationActivity extends XmppActivity if (conversation == null) { return; } - xmppConnectionService.attachLocationToConversation(conversation,uri, new UiCallback<Message>() { + ConversationUtil.attachLocationToConversation(conversation,uri, new UiCallback<Message>() { @Override public void success(Message message) { @@ -1445,7 +1446,7 @@ public class ConversationActivity extends XmppActivity } final Toast prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_file), Toast.LENGTH_LONG); prepareFileToast.show(); - xmppConnectionService.attachFileToConversation(conversation, uri, new UiCallback<Message>() { + ConversationUtil.attachFileToConversation(conversation, uri, new UiCallback<Message>() { @Override public void success(Message message) { hidePrepareFileToast(prepareFileToast); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java index 4ae88a5e..f065a25b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java @@ -69,6 +69,7 @@ import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter.OnContactPictu import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter.OnContactPictureLongClicked; import de.thedevstack.conversationsplus.ui.listeners.ConversationSwipeRefreshListener; import de.thedevstack.conversationsplus.utils.GeoHelper; +import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.UIHelper; import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; import de.thedevstack.conversationsplus.xmpp.jid.Jid; @@ -693,7 +694,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa if (transferable != null) { transferable.cancel(); } else { - activity.xmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(message, Message.STATUS_SEND_FAILED); } } diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java index fe3ed73f..28e8beb8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java @@ -31,6 +31,7 @@ import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.persistance.FileBackend; import de.thedevstack.conversationsplus.services.XmppConnectionService; import de.thedevstack.conversationsplus.ui.adapter.ConversationAdapter; +import de.thedevstack.conversationsplus.utils.ConversationUtil; import de.thedevstack.conversationsplus.utils.FileUtils; import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; import de.thedevstack.conversationsplus.xmpp.jid.Jid; @@ -300,9 +301,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer @Override public void onPresenceSelected() { replaceToast(getString(R.string.preparing_file)); - ShareWithActivity.this.xmppConnectionService - .attachFileToConversation(conversation, share.uris.get(0), - attachFileCallback); + ConversationUtil.attachFileToConversation(conversation, share.uris.get(0), attachFileCallback); switchToConversation(conversation, null, true); finish(); } diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java index 231f738c..b7340ce0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java @@ -13,6 +13,7 @@ import java.io.InputStream; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; +import de.thedevstack.conversationsplus.crypto.PgpEngine; import de.thedevstack.conversationsplus.enums.UserDecision; import de.thedevstack.conversationsplus.exceptions.UiException; import de.thedevstack.conversationsplus.utils.FileUtils; @@ -29,7 +30,7 @@ import de.thedevstack.conversationsplus.ui.XmppActivity; import de.thedevstack.conversationsplus.utils.StreamUtil; /** - * Created by tzur on 31.10.2015. + * Listener to let the user decide whether to resize a picture before sending or not. */ public class ResizePictureUserDecisionListener implements UserDecisionListener { protected Uri uri; @@ -156,7 +157,7 @@ public class ResizePictureUserDecisionListener implements UserDecisionListener { String filePath = FileUtils.getPath(uri); MessageUtil.updateMessageWithImageDetails(message, filePath, imageSize, imageWidth, imageHeight); if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { - xmppConnectionService.getPgpEngine().encrypt(message, callback); + PgpEngine.getInstance().encrypt(message, callback); } else { callback.success(message); } @@ -195,7 +196,7 @@ public class ResizePictureUserDecisionListener implements UserDecisionListener { int imageHeight = resizedAndRotatedImage.getHeight(); MessageUtil.updateMessageWithImageDetails(message, filePath, imageSize, imageWidth, imageHeight); if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { - xmppConnectionService.getPgpEngine().encrypt(message, callback); + PgpEngine.getInstance().encrypt(message, callback); } else { callback.success(message); } diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java new file mode 100644 index 00000000..77c2c728 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java @@ -0,0 +1,75 @@ +package de.thedevstack.conversationsplus.utils; + +import android.net.Uri; + +import de.thedevstack.conversationsplus.ConversationsPlusApplication; +import de.thedevstack.conversationsplus.crypto.PgpEngine; +import de.thedevstack.conversationsplus.entities.Conversation; +import de.thedevstack.conversationsplus.entities.Message; +import de.thedevstack.conversationsplus.exceptions.FileCopyException; +import de.thedevstack.conversationsplus.persistance.FileBackend; +import de.thedevstack.conversationsplus.ui.UiCallback; + +/** + * Utility class to work with conversations. + */ +public class ConversationUtil { + + public static void attachLocationToConversation(final Conversation conversation, + final Uri uri, + final UiCallback<Message> callback) { + int encryption = conversation.getNextEncryption(); + if (encryption == Message.ENCRYPTION_PGP) { + encryption = Message.ENCRYPTION_DECRYPTED; + } + Message message = new Message(conversation, uri.toString(), encryption); + if (conversation.getNextCounterpart() != null) { + message.setCounterpart(conversation.getNextCounterpart()); + } + if (encryption == Message.ENCRYPTION_DECRYPTED) { + PgpEngine.getInstance().encrypt(message, callback); + } else { + callback.success(message); + } + } + + public static void attachFileToConversation(final Conversation conversation, + final Uri uri, + final UiCallback<Message> callback) { + final Message message; + if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { + message = new Message(conversation, "", Message.ENCRYPTION_DECRYPTED); + } else { + message = new Message(conversation, "", conversation.getNextEncryption()); + } + message.setCounterpart(conversation.getNextCounterpart()); + message.setType(Message.TYPE_FILE); + String path = FileUtils.getPath(uri); + if (path != null) { + message.setRelativeFilePath(path); + MessageUtil.updateFileParams(message); + if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { + PgpEngine.getInstance().encrypt(message, callback); + } else { + callback.success(message); + } + } else { + ConversationsPlusApplication.executeFileAdding(new Runnable() { + @Override + public void run() { + try { + FileBackend.copyFileToPrivateStorage(message, uri); + MessageUtil.updateFileParams(message); + if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { + PgpEngine.getInstance().encrypt(message, callback); + } else { + callback.success(message); + } + } catch (FileCopyException e) { + callback.error(e.getResId(), message); + } + } + }); + } + } +} diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java index 7fbc2d94..67433b31 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java @@ -7,6 +7,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import de.thedevstack.conversationsplus.ConversationsPlusApplication; +import de.thedevstack.conversationsplus.entities.Conversation; import de.thedevstack.conversationsplus.entities.DownloadableFile; import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.persistance.DatabaseBackend; @@ -17,6 +18,21 @@ import de.thedevstack.conversationsplus.persistance.FileBackend; */ public final class MessageUtil { + + public static boolean markMessage(Conversation conversation, String uuid, int status) { + if (uuid == null) { + return false; + } else { + Message message = conversation.findSentMessageWithUuid(uuid); + if (message != null) { + markMessage(message, status); + return true; + } else { + return false; + } + } + } + public static void markMessage(Message message, int status) { if (status == Message.STATUS_SEND_FAILED && (message.getStatus() == Message.STATUS_SEND_RECEIVED || message diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java index b4c05ce4..422bdff0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java @@ -103,7 +103,7 @@ public class JingleConnection implements Transferable { sendSuccess(); MessageUtil.updateFileParams(message); mXmppConnectionService.databaseBackend.createMessage(message); - mXmppConnectionService.markMessage(message,Message.STATUS_RECEIVED); + MessageUtil.markMessage(message,Message.STATUS_RECEIVED); if (acceptedAutomatically) { message.markUnread(); JingleConnection.this.mXmppConnectionService.getNotificationService().push(message); @@ -457,7 +457,7 @@ public class JingleConnection implements Transferable { if (packet.getType() == IqPacket.TYPE.RESULT) { Logging.d(Config.LOGTAG,account.getJid().toBareJid()+": other party received offer"); mJingleStatus = JINGLE_STATUS_INITIATED; - mXmppConnectionService.markMessage(message, Message.STATUS_OFFERED); + MessageUtil.markMessage(message, Message.STATUS_OFFERED); } else { fail(); } @@ -548,7 +548,7 @@ public class JingleConnection implements Transferable { mergeCandidates(JingleCandidate.parse(content.socks5transport() .getChildren())); this.mJingleStatus = JINGLE_STATUS_ACCEPTED; - mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND); + MessageUtil.markMessage(message, Message.STATUS_UNSEND); this.connectNextCandidate(); return true; } @@ -780,7 +780,7 @@ public class JingleConnection implements Transferable { private void receiveSuccess() { this.mJingleStatus = JINGLE_STATUS_FINISHED; - this.mXmppConnectionService.markMessage(this.message,Message.STATUS_SEND_RECEIVED); + MessageUtil.markMessage(this.message,Message.STATUS_SEND_RECEIVED); this.disconnectSocks5Connections(); if (this.transport != null && this.transport instanceof JingleInbandTransport) { this.transport.disconnect(); @@ -803,8 +803,7 @@ public class JingleConnection implements Transferable { } this.mXmppConnectionService.updateConversationUi(); } else { - this.mXmppConnectionService.markMessage(this.message, - Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(this.message, Message.STATUS_SEND_FAILED); this.message.setTransferable(null); } } @@ -825,8 +824,7 @@ public class JingleConnection implements Transferable { } this.mXmppConnectionService.updateConversationUi(); } else { - this.mXmppConnectionService.markMessage(this.message, - Message.STATUS_SEND_FAILED); + MessageUtil.markMessage(this.message, Message.STATUS_SEND_FAILED); this.message.setTransferable(null); } } diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java index 3284a936..2deb79c6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java @@ -15,6 +15,7 @@ import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.entities.Transferable; import de.thedevstack.conversationsplus.services.AbstractConnectionManager; import de.thedevstack.conversationsplus.services.XmppConnectionService; +import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.Xmlns; import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; @@ -65,7 +66,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { old.cancel(); } JingleConnection connection = new JingleConnection(this); - mXmppConnectionService.markMessage(message,Message.STATUS_WAITING); + MessageUtil.markMessage(message,Message.STATUS_WAITING); connection.init(message); this.connections.add(connection); return connection; |