diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ConversationsPlusApplication.java | 12 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java | 47 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/http/HttpClient.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/persistance/db/access/MessageDatabaseAccess.java | 39 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/persistance/db/migrations/FileParamsBodyToDatabaseFieldsMigration.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/persistance/observers/FileDeletionObserver.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/FileTransferService.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferManager.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferStatusListener.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFile.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFileService.java | 12 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileTransferEntity.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileUploader.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadFileTransferService.java | 14 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadSlotRequestReceived.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadedFileEncryptionUiCallback.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/jingle/JingleFileTransferService.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java | 3 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java | 10 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java | 12 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/dialogs/SimpleConfirmDialog.java | 3 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/dialogs/UserDecisionDialog.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java | 22 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShareWithResizePictureUserDecisionListener.java | 6 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/ClipboardUtil.java | 3 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java | 12 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java | 80 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/UiUpdateHelper.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/UrlUtil.java | 25 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/XmppConnectionServiceAccessor.java | 3 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/XmppSendUtil.java | 12 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/IqPacketParser.java | 3 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/OnBindListener.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/OnIqPacketReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/OnKeyStatusUpdated.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessagePacketReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/OnPresencePacketReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/OnStatusChanged.java | 7 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java | 8 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/BadRequestIqErrorException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/InternalServerErrorException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/IqPacketErrorException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredContentException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredElementException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/ServiceUnavailableException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UndefinedConditionException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UnexpectedIqPacketTypeException.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/XmppException.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotPacketParser.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotRequestPacket.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/FileTransferHttpDeleteSlotRequestPacketGenerator.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/HttpUploadRequestSlotPacketGenerator.java | 6 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotPacketParser.java | 5 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotRequestPacket.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/httpuploadim/HttpUploadHint.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnJinglePacketReceived.java | 9 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketGenerator.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java | 4 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacketGenerator.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java | 3 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/Config.java (renamed from src/main/java/de/thedevstack/conversationsplus/Config.java) | 5 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/OtrService.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/OtrService.java) | 20 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/PgpDecryptionService.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/PgpEngine.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java) | 22 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/XmppDomainVerifier.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/XmppDomainVerifier.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlServiceImpl.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java) | 33 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlServiceStub.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java) | 12 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/CryptoFailedException.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/CryptoFailedException.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/NoSessionsCreatedException.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/NoSessionsCreatedException.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/OnMessageCreatedCallback.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/OnMessageCreatedCallback.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/SQLiteAxolotlStore.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/XmppAxolotlMessage.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/XmppAxolotlSession.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/sasl/DigestMd5.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/External.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/sasl/External.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/sasl/Plain.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/sasl/SaslMechanism.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha1.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/sasl/ScramSha1.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java (renamed from src/main/java/de/thedevstack/conversationsplus/crypto/sasl/Tokenizer.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/AbstractEntity.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/AbstractEntity.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Account.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Account.java) | 25 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Blockable.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Blockable.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Bookmark.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java) | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Contact.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Contact.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Conversation.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Conversation.java) | 13 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/DownloadableFile.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/DownloadableFile.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/ListItem.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/ListItem.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Message.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Message.java) | 78 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/MucOptions.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/MucOptions.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Presence.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Presence.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Presences.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Presences.java) | 5 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Roster.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Roster.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/ServiceDiscoveryResult.java) | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Transferable.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/Transferable.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java (renamed from src/main/java/de/thedevstack/conversationsplus/entities/TransferablePlaceholder.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java (renamed from src/main/java/de/thedevstack/conversationsplus/generator/AbstractGenerator.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/IqGenerator.java (renamed from src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java) | 25 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/MessageGenerator.java (renamed from src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java) | 19 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java (renamed from src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java) | 12 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/http/HttpConnectionManager.java (renamed from src/main/java/de/thedevstack/conversationsplus/http/HttpConnectionManager.java) | 25 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java (renamed from src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java) | 59 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/AbstractParser.java (renamed from src/main/java/de/thedevstack/conversationsplus/parser/AbstractParser.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/IqParser.java (renamed from src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java) | 26 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java (renamed from src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java) | 59 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/PresenceParser.java (renamed from src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java) | 36 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java (renamed from src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java) | 28 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/FileBackend.java (renamed from src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java) | 26 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java (renamed from src/main/java/de/thedevstack/conversationsplus/persistance/OnPhoneContactsMerged.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/providers/ConversationsPlusFileProvider.java (renamed from src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/AbstractConnectionManager.java) | 7 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/AvatarService.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java) | 42 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/ContactChooserTargetService.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/EventReceiver.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/ExportLogsService.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/ExportLogsService.java) | 16 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/MessageArchiveService.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/MessageArchiveService.java) | 23 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/NotificationService.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java) | 20 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java (renamed from src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java) | 115 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/AboutActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/AboutActivity.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/AboutPreference.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/AboutPreference.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/AbstractSearchableListItemActivity.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/BlockContactDialog.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/BlocklistActivity.java) | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ChangePasswordActivity.java) | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ChooseContactActivity.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java) | 31 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ContactDetailsActivity.java) | 38 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java) | 55 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java) | 64 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java) | 41 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/EditMessage.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/EditMessage.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/EnterJidDialog.java) | 12 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ManageAccountActivity.java) | 18 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/PublishProfilePictureActivity.java) | 19 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/SettingsActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/SettingsActivity.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/SettingsFragment.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/SettingsFragment.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java) | 25 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java) | 36 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/TimePreference.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/TimePreference.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java) | 19 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/UiCallback.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/UiCallback.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/VerifyOTRActivity.java) | 21 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/XmppActivity.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java) | 39 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java) | 15 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java) | 21 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/adapter/KnownHostsAdapter.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java) | 13 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java) | 519 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/forms/FormBooleanFieldWrapper.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormFieldFactory.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/forms/FormFieldFactory.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/forms/FormFieldWrapper.java) | 7 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/forms/FormJidSingleFieldWrapper.java) | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/forms/FormTextFieldWrapper.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/forms/FormWrapper.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/forms/FormWrapper.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/listeners/ConversationMoreMessagesLoadedListener.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/listeners/ConversationMoreMessagesLoadedListener.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java (renamed from src/main/java/de/thedevstack/conversationsplus/ui/listeners/ConversationSwipeRefreshListener.java) | 20 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/CryptoHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/CryptoHelper.java) | 12 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/DNSHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/DNSHelper.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/ExceptionHandler.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/ExceptionHelper.java) | 20 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/ExifHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/ExifHelper.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/FileUtils.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java) | 14 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/GeoHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/GeoHelper.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/MimeUtils.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/MimeUtils.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/OnPhoneContactsLoadedListener.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/PRNGFixes.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/PRNGFixes.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/PhoneHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/PhoneHelper.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/SSLSocketHelper.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/SerialSingleThreadExecutor.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/SerialSingleThreadExecutor.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/SocksSocketFactory.java) | 5 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/UIHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java) | 51 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/XmlHelper.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/XmlHelper.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/Xmlns.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/XmppUri.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/XmppUri.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xml/Element.java (renamed from src/main/java/de/thedevstack/conversationsplus/xml/Element.java) | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xml/Tag.java (renamed from src/main/java/de/thedevstack/conversationsplus/xml/Tag.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xml/TagWriter.java (renamed from src/main/java/de/thedevstack/conversationsplus/xml/TagWriter.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xml/XmlReader.java (renamed from src/main/java/de/thedevstack/conversationsplus/xml/XmlReader.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/OnAdvancedStreamFeaturesLoaded.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java | 7 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/OnContactStatusChanged.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnIqPacketReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java | 7 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnMessageAcknowledged.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessageAcknowledged.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java | 7 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/OnUpdateBlocklist.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/PacketReceived.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java) | 76 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/chatstate/ChatState.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/forms/Data.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Data.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/forms/Field.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jid/InvalidJidException.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jid/Jid.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleCandidate.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java) | 48 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java) | 28 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleInbandTransport.java) | 18 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleSocks5Transport.java) | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleTransport.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleTransport.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/OnFileTransmissionStatusChanged.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnFileTransmissionStatusChanged.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/OnJinglePacketReceived.java | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/OnPrimaryCandidateFound.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnPrimaryCandidateFound.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnTransportConnected.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/Content.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/JinglePacket.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/Reason.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/pep/Avatar.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractAcknowledgeableStanza.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/AbstractAcknowledgeableStanza.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/AbstractStanza.java) | 8 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/IqPacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacket.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/MessagePacket.java) | 6 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java) | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/csi/ActivePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/csi/ActivePacket.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/csi/InactivePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/csi/InactivePacket.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/AckPacket.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/EnablePacket.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/RequestPacket.java) | 4 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java (renamed from src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/ResumePacket.java) | 4 |
231 files changed, 1758 insertions, 1430 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusApplication.java b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusApplication.java index d4e3ebc2..fb1e9392 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusApplication.java +++ b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusApplication.java @@ -11,14 +11,16 @@ import java.security.SecureRandom; import de.duenndns.ssl.MemorizingTrustManager; import de.thedevstack.conversationsplus.http.HttpClient; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.persistance.FileBackend; +import de.thedevstack.conversationsplus.utils.ImageUtil; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferManager; import de.thedevstack.conversationsplus.services.filetransfer.http.upload.HttpUploadFileTransferService; import de.thedevstack.conversationsplus.services.filetransfer.jingle.JingleFileTransferService; -import de.thedevstack.conversationsplus.utils.ImageUtil; -import de.thedevstack.conversationsplus.utils.PRNGFixes; -import de.thedevstack.conversationsplus.utils.SerialSingleThreadExecutor; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.utils.PRNGFixes; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.utils.SerialSingleThreadExecutor; import okhttp3.OkHttpClient; /** diff --git a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java index 352e86e3..e0434e8b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java +++ b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java @@ -1,5 +1,7 @@ package de.thedevstack.conversationsplus; +import eu.siacs.conversations.R; + /** * Helper class for accessing colors. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java index bce8e571..3abb37e4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java +++ b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java @@ -1,13 +1,15 @@ package de.thedevstack.conversationsplus.entities; import de.thedevstack.conversationsplus.enums.FileStatus; -import de.thedevstack.conversationsplus.utils.MimeUtils; + +import eu.siacs.conversations.utils.MimeUtils; /** * */ public class FileParams { private String name; + private String originalFilename; private String path; private String url; private String mimeType; @@ -15,6 +17,8 @@ public class FileParams { private int width = 0; private int height = 0; private FileStatus fileStatus; + private byte[] aeskey; + private byte[] iv; public FileParams() { fileStatus = FileStatus.UNDEFINED; @@ -88,6 +92,39 @@ public class FileParams { return path; } + public void setKeyAndIv(byte[] keyIvCombo) { + if (null != keyIvCombo) { + if (keyIvCombo.length == 48) { + this.aeskey = new byte[32]; + this.iv = new byte[16]; + System.arraycopy(keyIvCombo, 0, this.iv, 0, 16); + System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32); + } else if (keyIvCombo.length >= 32) { + this.aeskey = new byte[32]; + System.arraycopy(keyIvCombo, 0, aeskey, 0, 32); + } else if (keyIvCombo.length >= 16) { + this.aeskey = new byte[16]; + System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16); + } + } + } + + public void setKey(byte[] key) { + this.aeskey = key; + } + + public void setIv(byte[] iv) { + this.iv = iv; + } + + public byte[] getKey() { + return this.aeskey; + } + + public byte[] getIv() { + return this.iv; + } + /** * Sets the path to the file. * If no file name is stored yet here - this method tries to extract the file name from the path. @@ -126,4 +163,12 @@ public class FileParams { public FileStatus getFileStatus() { return this.fileStatus; } + + public void setOriginalFilename(String originalFilename) { + this.originalFilename = originalFilename; + } + + public String getOriginalFilename() { + return this.originalFilename; + } } diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpClient.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpClient.java index 7e12a890..e1a38067 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpClient.java +++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpClient.java @@ -6,14 +6,15 @@ import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509TrustManager; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.SSLSocketHelper; + +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.SSLSocketHelper; + import okhttp3.OkHttpClient; /** diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/db/access/MessageDatabaseAccess.java b/src/main/java/de/thedevstack/conversationsplus/persistance/db/access/MessageDatabaseAccess.java index 51ad99a4..0fb85fbf 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/db/access/MessageDatabaseAccess.java +++ b/src/main/java/de/thedevstack/conversationsplus/persistance/db/access/MessageDatabaseAccess.java @@ -6,10 +6,12 @@ import android.database.sqlite.SQLiteDatabase; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.entities.FileParams; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.enums.FileStatus; import de.thedevstack.conversationsplus.persistance.db.migrations.FileParamsBodyToDatabaseFieldsMigration; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.utils.CryptoHelper; + /** * */ @@ -28,6 +30,9 @@ public class MessageDatabaseAccess extends AbstractDatabaseAccess { private static final String COLUMN_NAME_MSG_PARAMS_FILE_NAME = "file_name"; private static final String COLUMN_NAME_MSG_PARAMS_FILE_PATH = "file_path"; private static final String COLUMN_NAME_MSG_PARAMS_FILE_URL = "file_url"; + private static final String COLUMN_NAME_MSG_PARAMS_FILE_IV = "file_iv"; + private static final String COLUMN_NAME_MSG_PARAMS_FILE_KEY = "file_key"; + private static final String COLUMN_NAME_MSG_PARAMS_ORIGINAL_FILE_NAME = "original_file_name"; private static final String TABLE_ADDITIONAL_PARAMETERS_CREATE_V1 = "CREATE TABLE " + MessageDatabaseAccess.TABLE_NAME_ADDITIONAL_PARAMETERS + " (" + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_MSGUUID + " TEXT, " @@ -45,8 +50,11 @@ public class MessageDatabaseAccess extends AbstractDatabaseAccess { + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_WIDTH + " INTEGER DEFAULT 0, " + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_STATUS + " TEXT DEFAULT 'UNDEFINED', " + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_NAME + " TEXT DEFAULT NULL, " + + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_ORIGINAL_FILE_NAME + " TEXT DEFAULT NULL, " + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_PATH + " TEXT DEFAULT NULL, " + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_URL + " TEXT DEFAULT NULL, " + + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_IV + " TEXT DEFAULT NULL, " + + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_KEY + " TEXT DEFAULT NULL, " + "FOREIGN KEY(" + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_MSGUUID + ") REFERENCES " + Message.TABLENAME + "(" + Message.UUID + ") ON DELETE CASCADE)"; public static void updateMessageParameters(SQLiteDatabase db, Message message, String uuid) { @@ -65,8 +73,16 @@ public class MessageDatabaseAccess extends AbstractDatabaseAccess { additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_SIZE, fileParams.getSize()); additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_HEIGHT, fileParams.getHeight()); additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_WIDTH, fileParams.getWidth()); + additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_NAME, fileParams.getName()); + additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_ORIGINAL_FILE_NAME, fileParams.getOriginalFilename()); additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_PATH, fileParams.getPath()); additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_URL, fileParams.getUrl()); + if (null != fileParams.getIv()) { + additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_IV, CryptoHelper.bytesToHex(fileParams.getIv())); + } + if (null != fileParams.getKey()) { + additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_KEY, CryptoHelper.bytesToHex(fileParams.getKey())); + } if (null != fileParams.getFileStatus()) { additionalParameters.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_STATUS, fileParams.getFileStatus().name()); } @@ -95,10 +111,20 @@ public class MessageDatabaseAccess extends AbstractDatabaseAccess { fileParams.setMimeType(fileType); String name = CursorHelper.getString(cursor, COLUMN_NAME_MSG_PARAMS_FILE_NAME); fileParams.setName(name); + String originalFilename = CursorHelper.getString(cursor, COLUMN_NAME_MSG_PARAMS_ORIGINAL_FILE_NAME); + fileParams.setOriginalFilename(originalFilename); String path = CursorHelper.getString(cursor, COLUMN_NAME_MSG_PARAMS_FILE_PATH); fileParams.setPath(path); String url = CursorHelper.getString(cursor, COLUMN_NAME_MSG_PARAMS_FILE_URL); fileParams.setUrl(url); + String iv = CursorHelper.getString(cursor, COLUMN_NAME_MSG_PARAMS_FILE_IV); + if (null != iv && !iv.isEmpty()) { + fileParams.setIv(CryptoHelper.hexToBytes(iv)); + } + String key = CursorHelper.getString(cursor, COLUMN_NAME_MSG_PARAMS_FILE_KEY); + if (null != key && !key.isEmpty()) { + fileParams.setKey(CryptoHelper.hexToBytes(key)); + } long fileSize = CursorHelper.getLong(cursor, COLUMN_NAME_MSG_PARAMS_FILE_SIZE); fileParams.setSize(fileSize); int imageHeight = CursorHelper.getInt(cursor, COLUMN_NAME_MSG_PARAMS_FILE_HEIGHT); @@ -146,7 +172,11 @@ public class MessageDatabaseAccess extends AbstractDatabaseAccess { MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_WIDTH + " INTEGER DEFAULT 0", MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_STATUS + " TEXT DEFAULT 'UNDEFINED'", MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_NAME + " TEXT DEFAULT NULL", + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_ORIGINAL_FILE_NAME + " TEXT DEFAULT NULL", MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_PATH + " TEXT DEFAULT NULL", + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_URL + " TEXT DEFAULT NULL", + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_IV + " TEXT DEFAULT NULL", + MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_KEY + " TEXT DEFAULT NULL", }; addNewColumns(db, MessageDatabaseAccess.TABLE_NAME_ADDITIONAL_PARAMETERS, columnDefinitions); @@ -166,6 +196,13 @@ public class MessageDatabaseAccess extends AbstractDatabaseAccess { parameterValues.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_SIZE, fileParams.getSize()); parameterValues.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_HEIGHT, fileParams.getHeight()); parameterValues.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_WIDTH, fileParams.getWidth()); + parameterValues.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_URL, fileParams.getUrl()); + if (null != fileParams.getIv()) { + parameterValues.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_IV, CryptoHelper.bytesToHex(fileParams.getIv())); + } + if (null != fileParams.getKey()) { + parameterValues.put(MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_FILE_KEY, CryptoHelper.bytesToHex(fileParams.getKey())); + } db.update(MessageDatabaseAccess.TABLE_NAME_ADDITIONAL_PARAMETERS, parameterValues, MessageDatabaseAccess.COLUMN_NAME_MSG_PARAMS_MSGUUID + "=?", new String[] {uuid}); } diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/db/migrations/FileParamsBodyToDatabaseFieldsMigration.java b/src/main/java/de/thedevstack/conversationsplus/persistance/db/migrations/FileParamsBodyToDatabaseFieldsMigration.java index c0aa63c0..8ad94ca0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/db/migrations/FileParamsBodyToDatabaseFieldsMigration.java +++ b/src/main/java/de/thedevstack/conversationsplus/persistance/db/migrations/FileParamsBodyToDatabaseFieldsMigration.java @@ -4,6 +4,7 @@ import java.net.MalformedURLException; import java.net.URL; import de.thedevstack.conversationsplus.entities.FileParams; +import de.thedevstack.conversationsplus.utils.UrlUtil; /** * Created by steckbrief on 24.08.2016. @@ -28,6 +29,8 @@ public class FileParamsBodyToDatabaseFieldsMigration { try { URL url = new URL(parts[0]); params.setUrl(url.toString()); + byte[] ivAndKey = UrlUtil.getIvAndKeyFromURL(url); + params.setKeyAndIv(ivAndKey); } catch (MalformedURLException e1) { } } @@ -37,6 +40,8 @@ public class FileParamsBodyToDatabaseFieldsMigration { try { URL url = new URL(parts[0]); params.setUrl(url.toString()); + byte[] ivAndKey = UrlUtil.getIvAndKeyFromURL(url); + params.setKeyAndIv(ivAndKey); } catch (MalformedURLException e1) { } try { diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/observers/FileDeletionObserver.java b/src/main/java/de/thedevstack/conversationsplus/persistance/observers/FileDeletionObserver.java index 3534ccd2..a313c8b1 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/observers/FileDeletionObserver.java +++ b/src/main/java/de/thedevstack/conversationsplus/persistance/observers/FileDeletionObserver.java @@ -2,14 +2,15 @@ package de.thedevstack.conversationsplus.persistance.observers; import android.os.FileObserver; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.entities.TransferablePlaceholder; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; + /** * Observer to mark messages containing files which are deleted. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/services/FileTransferService.java b/src/main/java/de/thedevstack/conversationsplus/services/FileTransferService.java index 9fc35b2b..300d25e9 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/FileTransferService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/FileTransferService.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.services; -import de.thedevstack.conversationsplus.entities.Message; +import eu.siacs.conversations.entities.Message; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferStatusListener; /** diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java index e1b40fa6..7799fe8f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferEntity.java @@ -5,12 +5,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.persistance.FileBackend; import de.thedevstack.conversationsplus.utils.StreamUtil; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.persistance.FileBackend; + /** * */ diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferManager.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferManager.java index 2f9a819b..112aafd1 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferManager.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferManager.java @@ -6,12 +6,13 @@ import java.util.SortedSet; import java.util.TreeSet; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.services.FileTransferService; import de.thedevstack.conversationsplus.services.filetransfer.http.upload.HttpFileTransferEntity; import de.thedevstack.conversationsplus.utils.MessageUtil; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Message; + /** * */ diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferStatusListener.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferStatusListener.java index 86d6fbfa..638a20cf 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferStatusListener.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/FileTransferStatusListener.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.services.filetransfer; -import de.thedevstack.conversationsplus.entities.Message; +import eu.siacs.conversations.entities.Message; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFile.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFile.java index 1549388e..95b8450a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFile.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFile.java @@ -2,7 +2,7 @@ package de.thedevstack.conversationsplus.services.filetransfer.http.delete; import android.support.annotation.NonNull; -import de.thedevstack.conversationsplus.entities.Message; +import eu.siacs.conversations.entities.Message; import de.thedevstack.conversationsplus.dto.RemoteFile; /** diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFileService.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFileService.java index eb9f1b04..f60efb56 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFileService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteRemoteFileService.java @@ -1,18 +1,16 @@ package de.thedevstack.conversationsplus.services.filetransfer.http.delete; -import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.enums.FileStatus; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; import de.thedevstack.conversationsplus.ui.listeners.SimpleUserDecisionCallback; import de.thedevstack.conversationsplus.utils.MessageUtil; -import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.XmppSendUtil; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.FileTransferHttp; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete.FileTransferHttpDeleteSlotRequestPacketGenerator; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java index 186454e4..3151ca30 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java @@ -6,14 +6,16 @@ import org.json.JSONObject; import java.io.IOException; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.entities.Account; import de.thedevstack.conversationsplus.enums.FileStatus; import de.thedevstack.conversationsplus.http.HttpClient; import de.thedevstack.conversationsplus.utils.MessageUtil; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete.DeleteSlotPacketParser; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; + import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileTransferEntity.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileTransferEntity.java index a373d584..a36db4cd 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileTransferEntity.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileTransferEntity.java @@ -4,17 +4,18 @@ import java.net.MalformedURLException; import java.net.URL; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.entities.FileParams; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.enums.FileStatus; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferEntity; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferFailureReason; -import de.thedevstack.conversationsplus.utils.CryptoHelper; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload.HttpUploadSlot; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.utils.CryptoHelper; + /** * */ @@ -30,9 +31,9 @@ public class HttpFileTransferEntity extends FileTransferEntity { FileParams fileParams = this.getMessage().getFileParams(); if (null == fileParams) { fileParams = new FileParams(); + this.getMessage().setFileParams(fileParams); } fileParams.setFileStatus(FileStatus.NEEDS_UPLOAD); - this.getMessage().setFileParams(fileParams); if (Config.ENCRYPT_ON_HTTP_UPLOADED || message.getEncryption() == Message.ENCRYPTION_AXOLOTL || message.getEncryption() == Message.ENCRYPTION_OTR) { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileUploader.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileUploader.java index 8cae599c..9c949ed9 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileUploader.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpFileUploader.java @@ -14,16 +14,17 @@ import javax.net.ssl.HttpsURLConnection; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.persistance.FileBackend; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferFailureReason; import de.thedevstack.conversationsplus.utils.StreamUtil; import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload.HttpUpload; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.persistance.FileBackend; + public class HttpFileUploader implements Runnable { private static final String HTTP_METHOD = "PUT"; private static final String MIME_REQUEST_PROPERTY_NAME = "Content-Type"; diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadFileTransferService.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadFileTransferService.java index 6b19cd5f..7fe12dc6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadFileTransferService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadFileTransferService.java @@ -6,19 +6,19 @@ import java.io.FileNotFoundException; import java.io.InputStream; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.AbstractConnectionManager; +import eu.siacs.conversations.services.AbstractConnectionManager; import de.thedevstack.conversationsplus.services.FileTransferService; import de.thedevstack.conversationsplus.services.filetransfer.AbstractFileTransferService; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.XmppSendUtil; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload.HttpUpload; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload.HttpUploadRequestSlotPacketGenerator; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadSlotRequestReceived.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadSlotRequestReceived.java index 2687878d..5a12a4d4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadSlotRequestReceived.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadSlotRequestReceived.java @@ -1,13 +1,14 @@ package de.thedevstack.conversationsplus.services.filetransfer.http.upload; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.entities.Account; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferFailureReason; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload.HttpUploadSlot; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload.SlotPacketParser; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadedFileEncryptionUiCallback.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadedFileEncryptionUiCallback.java index f363a675..f084bffa 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadedFileEncryptionUiCallback.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/upload/HttpUploadedFileEncryptionUiCallback.java @@ -2,11 +2,12 @@ package de.thedevstack.conversationsplus.services.filetransfer.http.upload; import android.app.PendingIntent; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferFailureReason; -import de.thedevstack.conversationsplus.ui.UiCallback; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.ui.UiCallback; + /** * */ diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/jingle/JingleFileTransferService.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/jingle/JingleFileTransferService.java index 5d8ddd4e..e48f30e5 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/jingle/JingleFileTransferService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/jingle/JingleFileTransferService.java @@ -1,10 +1,11 @@ package de.thedevstack.conversationsplus.services.filetransfer.jingle; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.services.FileTransferService; import de.thedevstack.conversationsplus.services.filetransfer.AbstractFileTransferService; -import de.thedevstack.conversationsplus.xmpp.jingle.JingleConnection; -import de.thedevstack.conversationsplus.xmpp.jingle.JingleConnectionManager; + +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xmpp.jingle.JingleConnection; +import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java index fe7968cb..a1f99a48 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java @@ -11,10 +11,11 @@ import android.widget.ListView; import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter; import de.thedevstack.android.logcat.tasks.ReadLogCatAsyncTask; -import de.thedevstack.conversationsplus.R; import de.thedevstack.conversationsplus.ui.listeners.LogCatOutputCopyOnClickListener; import de.thedevstack.conversationsplus.utils.ClipboardUtil; +import eu.siacs.conversations.R; + /** * Activity to display the logcat output. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java index 2d777897..d1f1e835 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java @@ -11,9 +11,9 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.Map; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Presences; -import de.thedevstack.conversationsplus.utils.UIHelper; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Presences; +import eu.siacs.conversations.utils.UIHelper; /** * Created by tzur on 27.09.2015. @@ -44,7 +44,7 @@ public class PresencesArrayAdapter extends ArrayAdapter<Presence> { private static Presence[] getPresenceArray(Presences presences) { ArrayList<Presence> presenceArrayList = new ArrayList<>(); if (null != presences && null != presences.getPresences() && !presences.getPresences().isEmpty()) { - for (Map.Entry<String, de.thedevstack.conversationsplus.entities.Presence> entry : presences.getPresences().entrySet()) { + for (Map.Entry<String, eu.siacs.conversations.entities.Presence> entry : presences.getPresences().entrySet()) { Presence p = new Presence(); p.resource = entry.getKey(); p.status = entry.getValue().getStatus(); @@ -58,5 +58,5 @@ public class PresencesArrayAdapter extends ArrayAdapter<Presence> { class Presence { String resource; - de.thedevstack.conversationsplus.entities.Presence.Status status; + eu.siacs.conversations.entities.Presence.Status status; } diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java index 10764798..2f394fb3 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java @@ -9,7 +9,7 @@ import android.view.View; import android.widget.AdapterView; import android.widget.ListAdapter; -import de.thedevstack.conversationsplus.R; +import eu.siacs.conversations.R; /** * Created by tzur on 29.09.2015. diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java index 4ec8e3eb..8a3de18d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java @@ -9,13 +9,14 @@ import java.util.Date; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Conversation; import de.thedevstack.conversationsplus.entities.FileParams; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.utils.UIHelper; import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.utils.UIHelper; + /** * Fills the contents to the message details dialog. * The view definition is done in R.layout.dialog_message_details. @@ -61,8 +62,9 @@ public class MessageDetailsDialog extends AbstractAlertDialog { view.findViewById(R.id.dlgMsgDetFileTable).setVisibility(View.VISIBLE); if (null != message.getFileParams()) { FileParams params = message.getFileParams(); - TextViewUtil.setText(view, R.id.dlgMsgDetFileSize, UIHelper.getHumanReadableFileSize(params.getSize())); + TextViewUtil.setText(view, R.id.dlgMsgDetFileSize, UIHelper.getHumanReadableDetailedFileSize(params.getSize())); TextViewUtil.setText(view, R.id.dlgMsgDetFileMimeType, params.getMimeType()); + TextViewUtil.setText(view, R.id.dlgMsgDetFileOriginalName, params.getOriginalFilename()); } TextViewUtil.setText(view, R.id.dlgMsgDetFileHttpUploaded, message.isHttpUploaded() ? R.string.cplus_yes : R.string.cplus_no); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/SimpleConfirmDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/SimpleConfirmDialog.java index 04e60caa..6bf9c563 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/SimpleConfirmDialog.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/SimpleConfirmDialog.java @@ -3,9 +3,10 @@ package de.thedevstack.conversationsplus.ui.dialogs; import android.content.Context; import android.content.DialogInterface; -import de.thedevstack.conversationsplus.R; import de.thedevstack.conversationsplus.ui.listeners.SimpleUserDecisionCallback; +import eu.siacs.conversations.R; + /** * A dialog to give the user the choice to decide whether to do something or not. * A UserDecisionListener is used to provide the functionality to be performed by clicking on yes, or no. diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/UserDecisionDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/UserDecisionDialog.java index e0834390..3305e8e1 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/UserDecisionDialog.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/UserDecisionDialog.java @@ -8,7 +8,7 @@ import android.widget.TextView; import de.thedevstack.conversationsplus.enums.UserDecision; import de.thedevstack.conversationsplus.ui.listeners.UserDecisionListener; -import de.thedevstack.conversationsplus.R; +import eu.siacs.conversations.R; /** * A dialog to give the user the choice to decide whether to do something or not. diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java index f855a90d..222e473b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java @@ -1,11 +1,12 @@ package de.thedevstack.conversationsplus.ui.listeners; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.entities.TransferablePlaceholder; -import de.thedevstack.conversationsplus.persistance.FileBackend; import de.thedevstack.conversationsplus.utils.UiUpdateHelper; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; +import eu.siacs.conversations.persistance.FileBackend; + /** * Callback for the user decision if a file should be deleted or not. */ 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 1574bb85..dec6b885 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ResizePictureUserDecisionListener.java @@ -13,25 +13,25 @@ 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.entities.FileParams; import de.thedevstack.conversationsplus.enums.FileStatus; import de.thedevstack.conversationsplus.enums.UserDecision; import de.thedevstack.conversationsplus.exceptions.UiException; -import de.thedevstack.conversationsplus.utils.FileUtils; import de.thedevstack.conversationsplus.utils.ImageUtil; import de.thedevstack.conversationsplus.utils.MessageUtil; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.UiCallback; -import de.thedevstack.conversationsplus.ui.XmppActivity; -import de.thedevstack.conversationsplus.utils.MimeUtils; import de.thedevstack.conversationsplus.utils.StreamUtil; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.PgpEngine; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.UiCallback; +import eu.siacs.conversations.ui.XmppActivity; +import eu.siacs.conversations.utils.FileUtils; + /** * Listener to let the user decide whether to resize a picture before sending or not. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShareWithResizePictureUserDecisionListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShareWithResizePictureUserDecisionListener.java index e2678ef7..7455cf97 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShareWithResizePictureUserDecisionListener.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShareWithResizePictureUserDecisionListener.java @@ -4,9 +4,9 @@ import android.net.Uri; import java.util.List; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.XmppActivity; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.XmppActivity; /** * Created by tzur on 03.11.2015. diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java index 791b31a7..1c16095c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java @@ -5,8 +5,8 @@ import android.view.View; import de.thedevstack.conversationsplus.ui.adapter.PresencesArrayAdapter; import de.thedevstack.conversationsplus.ui.dialogs.AbstractAlertDialog; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Contact; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Contact; /** * This listener shows the dialog with the resources of a contact. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java index 9f6071bb..b6ffd570 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java @@ -19,8 +19,9 @@ import java.security.NoSuchAlgorithmException; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xmpp.pep.Avatar; /** * This util provides access to saved avatars, creating avatars. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ClipboardUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ClipboardUtil.java index 1ef7cba9..4d6220e0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ClipboardUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/ClipboardUtil.java @@ -6,7 +6,8 @@ import android.content.Context; import android.widget.Toast; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.R; + +import eu.siacs.conversations.R; /** * Util class to work with the Clipboard. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java index 55fd1b8e..25c8b3ba 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/ConversationUtil.java @@ -3,13 +3,15 @@ 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.enums.FileStatus; import de.thedevstack.conversationsplus.exceptions.FileCopyException; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.ui.UiCallback; + +import eu.siacs.conversations.crypto.PgpEngine; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.ui.UiCallback; +import eu.siacs.conversations.utils.FileUtils; /** * Utility class to work with conversations. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java index 0b8ace95..0edf6ad0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java @@ -16,10 +16,11 @@ import java.io.InputStream; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.exceptions.ImageResizeException; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.persistance.FileBackend; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.utils.ExifHelper; /** * This util provides diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java index dc9607f0..ed144465 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/MessageUtil.java @@ -3,28 +3,92 @@ package de.thedevstack.conversationsplus.utils; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import java.net.MalformedURLException; import java.net.URL; 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.FileParams; -import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.enums.FileStatus; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; -import de.thedevstack.conversationsplus.persistance.FileBackend; + +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.persistance.DatabaseBackend; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.utils.MimeUtils; /** * Utility class to work with messages. */ public final class MessageUtil { + public static void extractFileParamsFromBody(Message message) { + if (null == message) { + return; + } + String body = message.getBody(); + /** + * there are a few cases where spaces result in an unwanted behavior, e.g. + * "http://example.com/image.jpg" text that will not be shown /abc.png" + * or more than one image link in one message. + */ + if (null == body || body.isEmpty() || body.contains(" ")) { + return; + } + + FileParams fileParams = message.getFileParams(); + if (null == fileParams) { + fileParams = new FileParams(); + message.setFileParams(fileParams); + } + + try { + URL url = new URL(body); + if (!url.getProtocol().equalsIgnoreCase("http") && !url.getProtocol().equalsIgnoreCase("https")) { + message.setTreatAsDownloadable(Message.Decision.NEVER); + return; + } + if (message.isHttpUploaded()) { + fileParams.setUrl(url.toString()); + message.setTreatAsDownloadable(Message.Decision.MUST); + return; + } + String extension = FileUtils.getRelevantExtension(url); + if (extension == null) { + message.setTreatAsDownloadable(Message.Decision.NEVER); + return; + } + byte[] ivAndKey = UrlUtil.getIvAndKeyFromURL(url); + + if (null != ivAndKey) { + if (MimeUtils.guessMimeTypeFromExtension(extension) != null) { + message.setTreatAsDownloadable(Message.Decision.MUST); + fileParams.setKeyAndIv(ivAndKey); + fileParams.setUrl(url.toString()); + } else { + message.setTreatAsDownloadable(Message.Decision.NEVER); + } + } else if (Transferable.VALID_IMAGE_EXTENSIONS.contains(extension) + || Transferable.WELL_KNOWN_EXTENSIONS.contains(extension)) { + message.setTreatAsDownloadable(Message.Decision.SHOULD); + fileParams.setUrl(url.toString()); + } else { + message.setTreatAsDownloadable(Message.Decision.NEVER); + } + + } catch (MalformedURLException e) { + message.setTreatAsDownloadable(Message.Decision.NEVER); + } + } + public static boolean needsDownload(Message message) { FileStatus fileStatus = (null != message.getFileParams()) ? message.getFileParams().getFileStatus() : null; - return (null != fileStatus && (fileStatus == FileStatus.NEEDS_DOWNLOAD - || fileStatus == FileStatus.UNDEFINED)) + return (null == fileStatus + || (null != fileStatus && (fileStatus == FileStatus.NEEDS_DOWNLOAD || fileStatus == FileStatus.UNDEFINED))) && message.treatAsDownloadable() != Message.Decision.NEVER; } @@ -121,6 +185,7 @@ public final class MessageUtil { FileParams fileParams = message.getFileParams(); if (null == fileParams) { fileParams = new FileParams(); + message.setFileParams(fileParams); } fileParams.setSize(size); if (null != url) { @@ -136,7 +201,6 @@ public final class MessageUtil { if (null != relativeFilePathFromMessage && relativeFilePathFromMessage.startsWith("/")) { fileParams.setPath(relativeFilePathFromMessage); } - message.setFileParams(fileParams); } private MessageUtil() { diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/UiUpdateHelper.java b/src/main/java/de/thedevstack/conversationsplus/utils/UiUpdateHelper.java index 7638caad..84ce200a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/UiUpdateHelper.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/UiUpdateHelper.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.utils; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.services.XmppConnectionService; +import eu.siacs.conversations.services.XmppConnectionService; /** * Helper class to avoid passing the xmppConnectionService to everywhere just to update the UI. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/UrlUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/UrlUtil.java new file mode 100644 index 00000000..50c42288 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/utils/UrlUtil.java @@ -0,0 +1,25 @@ +package de.thedevstack.conversationsplus.utils; + +import java.net.URL; + +import eu.siacs.conversations.utils.CryptoHelper; + +/** + * This utility class provides helper methods to handle URLs. + */ + +public final class UrlUtil { + public static byte[] getIvAndKeyFromURL(URL url) { + if (null == url) { + return null; + } + String reference = url.getRef(); + boolean linkHasIvAndKey = reference != null && reference.matches("([A-Fa-f0-9]{2}){48}"); + + return linkHasIvAndKey ? CryptoHelper.hexToBytes(reference) : null; + } + + private UrlUtil() { + // Helper Class + } +} diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/XmppConnectionServiceAccessor.java b/src/main/java/de/thedevstack/conversationsplus/utils/XmppConnectionServiceAccessor.java index 1f1d7cf4..20cd7361 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/XmppConnectionServiceAccessor.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/XmppConnectionServiceAccessor.java @@ -1,7 +1,8 @@ package de.thedevstack.conversationsplus.utils; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.services.XmppConnectionService; + +import eu.siacs.conversations.services.XmppConnectionService; /** * Accessor utility to access XmppConnectionService without having to pass the XmppConnectionService every time. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/XmppSendUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/XmppSendUtil.java index 11d05832..d4a555f2 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/XmppSendUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/XmppSendUtil.java @@ -1,11 +1,11 @@ package de.thedevstack.conversationsplus.utils; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; +import eu.siacs.conversations.xmpp.stanzas.PresencePacket; /** * Created by tzur on 09.01.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/IqPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/IqPacketParser.java index 7c198ce9..eee5b0aa 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/IqPacketParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/IqPacketParser.java @@ -1,9 +1,10 @@ package de.thedevstack.conversationsplus.xmpp; -import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.exceptions.MissingRequiredContentException; import de.thedevstack.conversationsplus.xmpp.exceptions.MissingRequiredElementException; +import eu.siacs.conversations.xml.Element; + /** * */ diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnBindListener.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/OnBindListener.java deleted file mode 100644 index 274511e0..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnBindListener.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp; - -import de.thedevstack.conversationsplus.entities.Account; - -public interface OnBindListener { - public void onBind(Account account); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnIqPacketReceived.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/OnIqPacketReceived.java deleted file mode 100644 index df0178c6..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnIqPacketReceived.java +++ /dev/null @@ -1,8 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp; - -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; - -public interface OnIqPacketReceived extends PacketReceived { - public void onIqPacketReceived(Account account, IqPacket packet); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnKeyStatusUpdated.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/OnKeyStatusUpdated.java deleted file mode 100644 index 47bcff9e..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnKeyStatusUpdated.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp; - -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; - -public interface OnKeyStatusUpdated { - public void onKeyStatusUpdated(AxolotlService.FetchStatus report); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessagePacketReceived.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessagePacketReceived.java deleted file mode 100644 index 47649a18..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessagePacketReceived.java +++ /dev/null @@ -1,8 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp; - -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; - -public interface OnMessagePacketReceived extends PacketReceived { - public void onMessagePacketReceived(Account account, MessagePacket packet); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnPresencePacketReceived.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/OnPresencePacketReceived.java deleted file mode 100644 index 70b0ccd2..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnPresencePacketReceived.java +++ /dev/null @@ -1,8 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp; - -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket; - -public interface OnPresencePacketReceived extends PacketReceived { - public void onPresencePacketReceived(Account account, PresencePacket packet); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnStatusChanged.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/OnStatusChanged.java deleted file mode 100644 index c8478bbb..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnStatusChanged.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp; - -import de.thedevstack.conversationsplus.entities.Account; - -public interface OnStatusChanged { - public void onStatusChanged(Account account); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java index 1574604e..46e2e642 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java @@ -1,10 +1,10 @@ package de.thedevstack.conversationsplus.xmpp.avatar; import de.thedevstack.conversationsplus.xmpp.pubsub.PubSubPacketGenerator; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Generates the IQ Packets for handling Avatars diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java index 0867524b..48045a3c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java @@ -1,8 +1,8 @@ package de.thedevstack.conversationsplus.xmpp.avatar; import de.thedevstack.conversationsplus.xmpp.pubsub.PubSubPacketParser; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Parses the IQ Packets for handling Avatars diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/BadRequestIqErrorException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/BadRequestIqErrorException.java index 69fb893b..120ef495 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/BadRequestIqErrorException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/BadRequestIqErrorException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * Created by steckbrief on 22.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/InternalServerErrorException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/InternalServerErrorException.java index 7925c423..1a1cded2 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/InternalServerErrorException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/InternalServerErrorException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * Created by steckbrief on 22.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/IqPacketErrorException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/IqPacketErrorException.java index d4d932b7..65e02688 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/IqPacketErrorException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/IqPacketErrorException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * Created by steckbrief on 22.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredContentException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredContentException.java index 8b21cb9c..060bb618 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredContentException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredContentException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredElementException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredElementException.java index 8c8162ef..de24262f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredElementException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/MissingRequiredElementException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/ServiceUnavailableException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/ServiceUnavailableException.java index 7e503aa9..88d5389b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/ServiceUnavailableException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/ServiceUnavailableException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * Created by steckbrief on 22.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UndefinedConditionException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UndefinedConditionException.java index 38e1f6d2..de821873 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UndefinedConditionException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UndefinedConditionException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * Created by steckbrief on 22.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UnexpectedIqPacketTypeException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UnexpectedIqPacketTypeException.java index 333f5dca..82f229e8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UnexpectedIqPacketTypeException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/UnexpectedIqPacketTypeException.java @@ -2,8 +2,8 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; import java.util.Arrays; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/XmppException.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/XmppException.java index 8c692f5b..b8c6c89d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/XmppException.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/exceptions/XmppException.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.exceptions; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotPacketParser.java index 7c011449..a6408e9f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotPacketParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotPacketParser.java @@ -1,13 +1,14 @@ package de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete; -import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.IqPacketParser; import de.thedevstack.conversationsplus.xmpp.exceptions.UnexpectedIqPacketTypeException; import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.FileTransferHttp; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; import de.thedevstack.conversationsplus.xmpp.utils.ErrorIqPacketExceptionHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + /** * Created by steckbrief on 21.08.2016. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotRequestPacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotRequestPacket.java index e389d851..67deeb6f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotRequestPacket.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/DeleteSlotRequestPacket.java @@ -1,8 +1,9 @@ package de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete; -import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.FileTransferHttp; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Created by steckbrief on 21.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/FileTransferHttpDeleteSlotRequestPacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/FileTransferHttpDeleteSlotRequestPacketGenerator.java index ac7de74e..fa0f7a34 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/FileTransferHttpDeleteSlotRequestPacketGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/delete/FileTransferHttpDeleteSlotRequestPacketGenerator.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Created by steckbrief on 21.08.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/HttpUploadRequestSlotPacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/HttpUploadRequestSlotPacketGenerator.java index eaa90ab0..cdb957c4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/HttpUploadRequestSlotPacketGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/HttpUploadRequestSlotPacketGenerator.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Generates the IQ Packets for requesting a http upload slot @@ -33,7 +33,7 @@ public final class HttpUploadRequestSlotPacketGenerator { public static IqPacket generate(Jid host, String filename, long filesize, String mime) { SlotRequestPacket packet = new SlotRequestPacket(filename, filesize); packet.setTo(host); - packet.setMime((mime == null) ? HttpUpload.DEFAULT_MIME_TYPE : mime); + packet.setMime((mime == null || mime.isEmpty()) ? HttpUpload.DEFAULT_MIME_TYPE : mime); return packet; } diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotPacketParser.java index 85d11b6b..40e7db96 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotPacketParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotPacketParser.java @@ -1,12 +1,13 @@ package de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload; -import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.IqPacketParser; import de.thedevstack.conversationsplus.xmpp.exceptions.UnexpectedIqPacketTypeException; import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; import de.thedevstack.conversationsplus.xmpp.utils.ErrorIqPacketExceptionHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + /** * */ diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotRequestPacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotRequestPacket.java index d0866508..30c5db79 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotRequestPacket.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/upload/SlotRequestPacket.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.filetransfer.http.upload; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/httpuploadim/HttpUploadHint.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/httpuploadim/HttpUploadHint.java index 13fb5ad1..00bd1158 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/httpuploadim/HttpUploadHint.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/httpuploadim/HttpUploadHint.java @@ -1,6 +1,6 @@ package de.thedevstack.conversationsplus.xmpp.httpuploadim; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; /** * Representation of the HttpUploadHint. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnJinglePacketReceived.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnJinglePacketReceived.java deleted file mode 100644 index c87fd400..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnJinglePacketReceived.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; - -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xmpp.PacketReceived; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.JinglePacket; - -public interface OnJinglePacketReceived extends PacketReceived { - void onJinglePacketReceived(Account account, JinglePacket packet); -} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java index fe485de0..31186191 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.pubsub; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Representation of a PubSub IQ packet as defined in XEP-0060. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketGenerator.java index a93c37aa..f72bf777 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketGenerator.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.pubsub; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Generates the IQ packets for Pubsub Subscription as defined in XEP-0060. diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java index 0f803b56..c8df0d5e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java @@ -1,7 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.pubsub; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Parses the IQ Packets for handling pubsub diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacketGenerator.java index 27e6607f..bdf0f4b0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacketGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacketGenerator.java @@ -1,5 +1,7 @@ package de.thedevstack.conversationsplus.xmpp.stanzas; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + /** * Created by tzur on 15.01.2016. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java index f02d8d46..15771248 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java @@ -1,6 +1,5 @@ package de.thedevstack.conversationsplus.xmpp.utils; -import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.IqPacketParser; import de.thedevstack.conversationsplus.xmpp.exceptions.BadRequestIqErrorException; import de.thedevstack.conversationsplus.xmpp.exceptions.InternalServerErrorException; @@ -8,6 +7,8 @@ import de.thedevstack.conversationsplus.xmpp.exceptions.IqPacketErrorException; import de.thedevstack.conversationsplus.xmpp.exceptions.ServiceUnavailableException; import de.thedevstack.conversationsplus.xmpp.exceptions.UndefinedConditionException; +import eu.siacs.conversations.xml.Element; + /** * Created by steckbrief on 22.08.2016. */ diff --git a/src/main/java/de/thedevstack/conversationsplus/Config.java b/src/main/java/eu/siacs/conversations/Config.java index a6825246..a9297c81 100644 --- a/src/main/java/de/thedevstack/conversationsplus/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -1,8 +1,9 @@ -package de.thedevstack.conversationsplus; +package eu.siacs.conversations; import android.graphics.Bitmap; -import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; +import de.thedevstack.conversationsplus.ConversationsPlusPreferences; +import eu.siacs.conversations.xmpp.chatstate.ChatState; public final class Config { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/OtrService.java b/src/main/java/eu/siacs/conversations/crypto/OtrService.java index 34023d9f..4ddf51fb 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/OtrService.java +++ b/src/main/java/eu/siacs/conversations/crypto/OtrService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto; +package eu.siacs.conversations.crypto; import net.java.otr4j.OtrEngineHost; import net.java.otr4j.OtrException; @@ -26,15 +26,15 @@ import java.security.spec.InvalidKeySpecException; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.generator.MessageGenerator; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.generator.MessageGenerator; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/PgpDecryptionService.java b/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java index b833f6e4..5afbe5c4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/PgpDecryptionService.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto; +package eu.siacs.conversations.crypto; import android.app.PendingIntent; @@ -7,9 +7,9 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.UiCallback; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.UiCallback; public class PgpDecryptionService { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java index c97b8395..4ad01089 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/PgpEngine.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto; +package eu.siacs.conversations.crypto; import android.app.PendingIntent; import android.content.Intent; @@ -17,16 +17,16 @@ import java.io.OutputStream; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.StreamUtil; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.UiCallback; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.UiCallback; public class PgpEngine { private OpenPgpApi api; diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/XmppDomainVerifier.java b/src/main/java/eu/siacs/conversations/crypto/XmppDomainVerifier.java index c9f65a97..1fca865e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/XmppDomainVerifier.java +++ b/src/main/java/eu/siacs/conversations/crypto/XmppDomainVerifier.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto; +package eu.siacs.conversations.crypto; import android.util.Log; import android.util.Pair; diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index 52418553..a066faad 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -12,12 +12,12 @@ import java.security.cert.X509Certificate; import java.util.List; import java.util.Set; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.xmpp.OnAdvancedStreamFeaturesLoaded; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; +import eu.siacs.conversations.xmpp.jid.Jid; /** * Created by tzur on 02.03.2016. diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlServiceImpl.java index 215e0995..f91dc066 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlServiceImpl.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; import android.os.Bundle; import android.security.KeyChain; @@ -33,23 +33,24 @@ import java.util.Map; import java.util.Random; import java.util.Set; -import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -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; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.parser.IqParser; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.SerialSingleThreadExecutor; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, AxolotlService { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlServiceStub.java index 7db99b75..0152d02a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceStub.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlServiceStub.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -13,11 +13,11 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xmpp.jid.Jid; /** * Axolotl Service Stub implementation to avoid axolotl usage. diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/CryptoFailedException.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/CryptoFailedException.java index df281248..5796ef30 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/CryptoFailedException.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/CryptoFailedException.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; public class CryptoFailedException extends Exception { public CryptoFailedException(Exception e){ diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/NoSessionsCreatedException.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/NoSessionsCreatedException.java index bcb1c6a8..663b42b5 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/NoSessionsCreatedException.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/NoSessionsCreatedException.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; public class NoSessionsCreatedException extends Throwable{ } diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/OnMessageCreatedCallback.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/OnMessageCreatedCallback.java index 082b514b..3d40a408 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/OnMessageCreatedCallback.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/OnMessageCreatedCallback.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; public interface OnMessageCreatedCallback { void run(XmppAxolotlMessage message); diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/SQLiteAxolotlStore.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java index 35f630bb..c634d877 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/SQLiteAxolotlStore.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; import android.util.Log; import android.util.LruCache; @@ -19,9 +19,9 @@ import java.security.cert.X509Certificate; import java.util.List; import java.util.Set; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.services.XmppConnectionService; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.XmppConnectionService; public class SQLiteAxolotlStore implements AxolotlStore { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java index 837b601c..cf950d6d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/XmppAxolotlMessage.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; import android.util.Base64; import android.util.Log; @@ -21,9 +21,9 @@ import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; public class XmppAxolotlMessage { public static final String CONTAINERTAG = "encrypted"; diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/XmppAxolotlSession.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java index 47b2133a..93ed32a2 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/XmppAxolotlSession.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.axolotl; +package eu.siacs.conversations.crypto.axolotl; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -22,8 +22,8 @@ import org.whispersystems.libaxolotl.protocol.WhisperMessage; import java.util.HashMap; import java.util.Map; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.Account; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; public class XmppAxolotlSession { private final SessionCipher cipher; diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/DigestMd5.java b/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java index f4c3f28e..8b16215b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/DigestMd5.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.sasl; +package eu.siacs.conversations.crypto.sasl; import android.util.Base64; @@ -8,9 +8,9 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.xml.TagWriter; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xml.TagWriter; public class DigestMd5 extends SaslMechanism { public DigestMd5(final TagWriter tagWriter, final Account account, final SecureRandom rng) { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/External.java b/src/main/java/eu/siacs/conversations/crypto/sasl/External.java index dc50cbbe..8fd91cf4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/External.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/External.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.crypto.sasl; +package eu.siacs.conversations.crypto.sasl; import android.util.Base64; import java.security.SecureRandom; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xml.TagWriter; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xml.TagWriter; public class External extends SaslMechanism { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/Plain.java b/src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java index 179c12de..40a55151 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/Plain.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.crypto.sasl; +package eu.siacs.conversations.crypto.sasl; import android.util.Base64; import java.nio.charset.Charset; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xml.TagWriter; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xml.TagWriter; public class Plain extends SaslMechanism { public Plain(final TagWriter tagWriter, final Account account) { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/SaslMechanism.java b/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java index 1f6d2bde..5b4b99ef 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/SaslMechanism.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java @@ -1,9 +1,9 @@ -package de.thedevstack.conversationsplus.crypto.sasl; +package eu.siacs.conversations.crypto.sasl; import java.security.SecureRandom; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xml.TagWriter; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xml.TagWriter; public abstract class SaslMechanism { diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/ScramSha1.java b/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha1.java index 3540d2cf..3a05446c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/ScramSha1.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha1.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.sasl; +package eu.siacs.conversations.crypto.sasl; import android.util.Base64; import android.util.LruCache; @@ -13,9 +13,9 @@ import java.nio.charset.Charset; import java.security.InvalidKeyException; import java.security.SecureRandom; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.xml.TagWriter; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xml.TagWriter; public class ScramSha1 extends SaslMechanism { // TODO: When channel binding (SCRAM-SHA1-PLUS) is supported in future, generalize this to indicate support and/or usage. diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/Tokenizer.java b/src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java index cc2805de..e37e0fa7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/sasl/Tokenizer.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.crypto.sasl; +package eu.siacs.conversations.crypto.sasl; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/AbstractEntity.java b/src/main/java/eu/siacs/conversations/entities/AbstractEntity.java index ebc0a8d5..957b0a14 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/AbstractEntity.java +++ b/src/main/java/eu/siacs/conversations/entities/AbstractEntity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.content.ContentValues; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index 2ee76504..9b4198c8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; @@ -20,18 +20,19 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.OtrService; -import de.thedevstack.conversationsplus.crypto.PgpDecryptionService; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlServiceImpl; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlServiceStub; -import de.thedevstack.conversationsplus.services.XmppConnectionService; import de.thedevstack.conversationsplus.utils.SimpleCryptoUtil; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.OtrService; +import eu.siacs.conversations.crypto.PgpDecryptionService; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.AxolotlServiceImpl; +import eu.siacs.conversations.crypto.axolotl.AxolotlServiceStub; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class Account extends AbstractEntity { diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Blockable.java b/src/main/java/eu/siacs/conversations/entities/Blockable.java index beff901d..dbcd55c4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Blockable.java +++ b/src/main/java/eu/siacs/conversations/entities/Blockable.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jid.Jid; public interface Blockable { public boolean isBlocked(); diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index 07a77eae..fa30443d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.graphics.Color; @@ -6,10 +6,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.utils.UIHelper; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; public class Bookmark extends Element implements ListItem { diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 8f73be1d..9b4be366 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; @@ -12,12 +12,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.utils.UIHelper; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; public class Contact implements ListItem, Blockable { public static final String TABLENAME = "contacts"; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index c0ae56fd..299c5f7d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; @@ -21,12 +21,13 @@ import java.util.Comparator; import java.util.Iterator; import java.util.List; +import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.MessageUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class Conversation extends AbstractEntity implements Blockable { public static final String TABLENAME = "conversations"; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/DownloadableFile.java b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java index 101475c3..4e63a66a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/DownloadableFile.java +++ b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java @@ -1,8 +1,8 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import java.io.File; -import de.thedevstack.conversationsplus.utils.MimeUtils; +import eu.siacs.conversations.utils.MimeUtils; public class DownloadableFile extends File { diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/ListItem.java b/src/main/java/eu/siacs/conversations/entities/ListItem.java index 24dc7e94..56804fbf 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/ListItem.java +++ b/src/main/java/eu/siacs/conversations/entities/ListItem.java @@ -1,8 +1,8 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import java.util.List; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jid.Jid; public interface ListItem extends Comparable<ListItem> { String getDisplayName(); diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index a81ba404..f524fc58 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; @@ -6,12 +6,15 @@ import android.database.Cursor; import java.net.MalformedURLException; import java.net.URL; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; +import de.thedevstack.conversationsplus.entities.FileParams; import de.thedevstack.conversationsplus.enums.FileStatus; -import de.thedevstack.conversationsplus.utils.FileUtils; -import de.thedevstack.conversationsplus.utils.MimeUtils; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import de.thedevstack.conversationsplus.utils.MessageUtil; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.utils.MimeUtils; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class Message extends AbstractEntity { @@ -64,7 +67,7 @@ public class Message extends AbstractEntity { protected String conversationUuid; protected Jid counterpart; protected Jid trueCounterpart; - protected String body; + private String body; protected String encryptedBody; protected long timeSent; protected int encryption; @@ -337,7 +340,7 @@ public class Message extends AbstractEntity { public void setType(int type) { this.type = type; - if (null != this.fileParams && (type == Message.TYPE_FILE || type == Message.TYPE_IMAGE)) { + if (null == this.fileParams && (type == Message.TYPE_FILE || type == Message.TYPE_IMAGE)) { this.setFileParams(new FileParams()); } } @@ -480,18 +483,6 @@ public class Message extends AbstractEntity { NOT_DECIDED, } - private String extractRelevantExtension(URL url) { - if (url == null) { - return null; - } - String path = url.getPath(); - return extractRelevantExtension(path); - } - - private String extractRelevantExtension(String path) { - return FileUtils.getRelevantExtension(path); - } - public String getMimeType() { // TODO: Move to fileparams if (relativeFilePath != null) { int start = relativeFilePath.lastIndexOf('.') + 1; @@ -502,7 +493,7 @@ public class Message extends AbstractEntity { } } else { try { - return MimeUtils.guessMimeTypeFromExtension(extractRelevantExtension(new URL(this.getBody()))); + return MimeUtils.guessMimeTypeFromExtension(FileUtils.getRelevantExtension(new URL(this.getBody()))); } catch (MalformedURLException e) { return null; } @@ -525,50 +516,9 @@ public class Message extends AbstractEntity { if (mTreatAsDownloadAble != Decision.NOT_DECIDED) { return mTreatAsDownloadAble; } - /** - * there are a few cases where spaces result in an unwanted behavior, e.g. - * "http://example.com/image.jpg" text that will not be shown /abc.png" - * or more than one image link in one message. - */ - if (getBody().contains(" ")) { - mTreatAsDownloadAble = Decision.NEVER; - return mTreatAsDownloadAble; - } - try { - URL url = new URL(body); - if (!url.getProtocol().equalsIgnoreCase("http") && !url.getProtocol().equalsIgnoreCase("https")) { - mTreatAsDownloadAble = Decision.NEVER; - return mTreatAsDownloadAble; - } - String extension = extractRelevantExtension(url); - if (extension == null) { - mTreatAsDownloadAble = Decision.NEVER; - return mTreatAsDownloadAble; - } - String ref = url.getRef(); - boolean encrypted = ref != null && ref.matches("([A-Fa-f0-9]{2}){48}"); - if (encrypted) { - if (MimeUtils.guessMimeTypeFromExtension(extension) != null) { - mTreatAsDownloadAble = Decision.MUST; - return mTreatAsDownloadAble; - } else { - mTreatAsDownloadAble = Decision.NEVER; - return mTreatAsDownloadAble; - } - } else if (Transferable.VALID_IMAGE_EXTENSIONS.contains(extension) - || Transferable.WELL_KNOWN_EXTENSIONS.contains(extension)) { - mTreatAsDownloadAble = Decision.SHOULD; - return mTreatAsDownloadAble; - } else { - mTreatAsDownloadAble = Decision.NEVER; - return mTreatAsDownloadAble; - } - - } catch (MalformedURLException e) { - mTreatAsDownloadAble = Decision.NEVER; - return mTreatAsDownloadAble; - } + MessageUtil.extractFileParamsFromBody(this); + return this.mTreatAsDownloadAble; } public void untie() { diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 1af538ec..7681a3d4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.annotation.SuppressLint; @@ -10,12 +10,12 @@ import java.util.List; import java.util.Map; import java.util.Set; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.forms.Field; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; +import eu.siacs.conversations.R; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; @SuppressLint("DefaultLocale") public class MucOptions { diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Presence.java b/src/main/java/eu/siacs/conversations/entities/Presence.java index d4f2871d..442f1bca 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Presence.java +++ b/src/main/java/eu/siacs/conversations/entities/Presence.java @@ -1,9 +1,9 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import java.lang.Comparable; import java.util.Locale; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; public class Presence implements Comparable { diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Presences.java b/src/main/java/eu/siacs/conversations/entities/Presences.java index d32e931c..813eda7a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Presences.java +++ b/src/main/java/eu/siacs/conversations/entities/Presences.java @@ -1,7 +1,10 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import java.util.Collections; import java.util.Hashtable; +import java.util.Iterator; + +import eu.siacs.conversations.xml.Element; public class Presences { private final Hashtable<String, Presence> presences = new Hashtable<>(); diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java b/src/main/java/eu/siacs/conversations/entities/Roster.java index ec1a9426..d3ad9181 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java +++ b/src/main/java/eu/siacs/conversations/entities/Roster.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jid.Jid; public class Roster { final Account account; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/ServiceDiscoveryResult.java b/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java index 562d95b7..a8f60e39 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/ServiceDiscoveryResult.java +++ b/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; @@ -15,10 +15,10 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.forms.Field; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class ServiceDiscoveryResult { public static final String TABLENAME = "discovery_results"; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Transferable.java b/src/main/java/eu/siacs/conversations/entities/Transferable.java index 8e2ca20e..5a47c451 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Transferable.java +++ b/src/main/java/eu/siacs/conversations/entities/Transferable.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/TransferablePlaceholder.java b/src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java index c51320d1..e065953e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/TransferablePlaceholder.java +++ b/src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.entities; +package eu.siacs.conversations.entities; public class TransferablePlaceholder implements Transferable { diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 2d825f2c..649f767d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.generator; +package eu.siacs.conversations.generator; import android.util.Base64; @@ -14,7 +14,7 @@ import java.util.TimeZone; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.tzur.conversations.Settings; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; public abstract class AbstractGenerator { private final String[] FEATURES = { diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 2d4c8f6a..012a5943 100644 --- a/src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.generator; +package eu.siacs.conversations.generator; import android.util.Base64; @@ -16,17 +16,18 @@ import java.util.List; import java.util.Set; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.services.MessageArchiveService; -import de.thedevstack.conversationsplus.utils.Xmlns; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.services.MessageArchiveService; +import eu.siacs.conversations.utils.Xmlns; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class IqGenerator extends AbstractGenerator { diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java index 678f2c75..582d64e6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.generator; +package eu.siacs.conversations.generator; import net.java.otr4j.OtrException; import net.java.otr4j.session.Session; @@ -10,16 +10,17 @@ import java.util.Locale; import java.util.TimeZone; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlMessage; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; import de.thedevstack.conversationsplus.entities.FileParams; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; import de.thedevstack.conversationsplus.xmpp.httpuploadim.HttpUploadHint; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; + +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; public class MessageGenerator extends AbstractGenerator { diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java b/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java index f370c6e0..9ac7d318 100644 --- a/src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java @@ -1,10 +1,10 @@ -package de.thedevstack.conversationsplus.generator; +package eu.siacs.conversations.generator; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Presence; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.stanzas.PresencePacket; public class PresenceGenerator extends AbstractGenerator { diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpConnectionManager.java b/src/main/java/eu/siacs/conversations/http/HttpConnectionManager.java index 686587c7..e3398f93 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/http/HttpConnectionManager.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.http; +package eu.siacs.conversations.http; import org.apache.http.conn.ssl.StrictHostnameVerifier; @@ -18,11 +18,13 @@ import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509TrustManager; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.services.AbstractConnectionManager; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.SSLSocketHelper; + +import de.thedevstack.conversationsplus.utils.MessageUtil; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.AbstractConnectionManager; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.SSLSocketHelper; public class HttpConnectionManager extends AbstractConnectionManager { private static HttpConnectionManager INSTANCE; @@ -38,10 +40,13 @@ public class HttpConnectionManager extends AbstractConnectionManager { } public static HttpDownloadConnection createNewDownloadConnection(Message message, boolean interactive) { - HttpDownloadConnection connection = new HttpDownloadConnection(INSTANCE); - connection.init(message,interactive); - INSTANCE.downloadConnections.add(connection); - return connection; + if (MessageUtil.needsDownload(message)) { + HttpDownloadConnection connection = new HttpDownloadConnection(INSTANCE); + connection.init(message, interactive); + INSTANCE.downloadConnections.add(connection); + return connection; + } + return null; } public void finishConnection(HttpDownloadConnection connection) { diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index d9fc9584..77b8e333 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.http; +package eu.siacs.conversations.http; import android.os.PowerManager; import android.util.Log; @@ -18,23 +18,25 @@ import javax.net.ssl.SSLHandshakeException; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; +import de.thedevstack.conversationsplus.entities.FileParams; import de.thedevstack.conversationsplus.enums.FileStatus; import de.thedevstack.conversationsplus.exceptions.RemoteFileNotFoundException; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.StreamUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.entities.TransferablePlaceholder; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.AbstractConnectionManager; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.FileUtils; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.AbstractConnectionManager; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.FileUtils; + public class HttpDownloadConnection implements Transferable { private HttpConnectionManager mHttpConnectionManager; @@ -75,8 +77,22 @@ public class HttpDownloadConnection implements Transferable { this.message = message; this.message.setTransferable(this); try { - mUrl = new URL(message.getFileParams().getUrl()); - final String sUrlFilename = mUrl.getPath().substring(mUrl.getPath().lastIndexOf('/')).toLowerCase(); + String url = (null != message && null != message.getFileParams()) ? message.getFileParams().getUrl() : null; + if (null == url) { + /* + * If this code is reached and the URL is null something went wrong. + * Try again to extract the file parameters from the message. + */ + MessageUtil.extractFileParamsFromBody(message); + url = (null != message.getFileParams()) ? message.getFileParams().getUrl() : null; + if (null == url) { + message.setTreatAsDownloadable(Message.Decision.NEVER); // TODO find sth better + this.cancel(); + return; + } + } + mUrl = new URL(url); + final String sUrlFilename = mUrl.getPath().substring(mUrl.getPath().lastIndexOf('/') + 1).toLowerCase(); final String lastPart = FileUtils.getLastExtension(sUrlFilename); if (!lastPart.isEmpty() && ("pgp".equals(lastPart) || "gpg".equals(lastPart))) { @@ -85,18 +101,25 @@ public class HttpDownloadConnection implements Transferable { && message.getEncryption() != Message.ENCRYPTION_AXOLOTL) { this.message.setEncryption(Message.ENCRYPTION_NONE); } + String extension; + String originalFilename; if (!lastPart.isEmpty() && VALID_CRYPTO_EXTENSIONS.contains(lastPart)) { extension = FileUtils.getSecondToLastExtension(sUrlFilename); + originalFilename = sUrlFilename.replace("." + lastPart, ""); } else { extension = lastPart; + originalFilename = sUrlFilename; } message.setRelativeFilePath(message.getUuid() + "." + extension); this.file = FileBackend.getFile(message, false); - String reference = mUrl.getRef(); - if (reference != null && reference.length() == 96) { - this.file.setKeyAndIv(CryptoHelper.hexToBytes(reference)); - } + + FileParams fileParams = message.getFileParams(); + if (null == fileParams) { + fileParams = new FileParams(); + message.setFileParams(fileParams); + } + fileParams.setOriginalFilename(originalFilename); if ((this.message.getEncryption() == Message.ENCRYPTION_OTR || this.message.getEncryption() == Message.ENCRYPTION_AXOLOTL) diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/AbstractParser.java b/src/main/java/eu/siacs/conversations/parser/AbstractParser.java index bebe41d0..ad368f11 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/AbstractParser.java +++ b/src/main/java/eu/siacs/conversations/parser/AbstractParser.java @@ -1,16 +1,16 @@ -package de.thedevstack.conversationsplus.parser; +package eu.siacs.conversations.parser; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public abstract class AbstractParser { diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java b/src/main/java/eu/siacs/conversations/parser/IqParser.java index e13936c5..c03ed42f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java +++ b/src/main/java/eu/siacs/conversations/parser/IqParser.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.parser; +package eu.siacs.conversations.parser; import android.support.annotation.NonNull; import android.util.Base64; @@ -23,18 +23,18 @@ import java.util.Map; import java.util.Set; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.Xmlns; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.Xmlns; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class IqParser extends AbstractParser implements OnIqPacketReceived { diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index b02677a8..b68e7014 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.parser; +package eu.siacs.conversations.parser; import android.util.Log; import android.util.Pair; @@ -18,28 +18,28 @@ import java.util.Set; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.AvatarUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.OtrService; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlServiceImpl; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlMessage; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Bookmark; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.services.MessageArchiveService; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnMessagePacketReceived; -import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.OtrService; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.AxolotlServiceImpl; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Bookmark; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.services.MessageArchiveService; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnMessagePacketReceived; +import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; public class MessageParser extends AbstractParser implements OnMessagePacketReceived { @@ -469,15 +469,18 @@ public class MessageParser extends AbstractParser implements if (message.getEncryption() == Message.ENCRYPTION_NONE || !ConversationsPlusPreferences.dontSaveEncrypted()) { mXmppConnectionService.databaseBackend.createMessage(message); } + MessageUtil.extractFileParamsFromBody(message); + FileParams fileParams = message.getFileParams(); + if (message.treatAsDownloadable() != Message.Decision.NEVER && message.treatAsDownloadable() != Message.Decision.NOT_DECIDED) { + if (null != fileParams) { + fileParams.setFileStatus(FileStatus.NEEDS_DOWNLOAD); + } + } if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && ConversationsPlusPreferences.autoAcceptFileSize() > 0 && (message.isHttpUploaded() || ConversationsPlusPreferences.autoDownloadFileLink())) { - FileParams fileParams = new FileParams(); - fileParams.setFileStatus(FileStatus.NEEDS_DOWNLOAD); - fileParams.setUrl(message.getBody()); - message.setFileParams(fileParams); - HttpConnectionManager.createNewDownloadConnection(message); + HttpConnectionManager.createNewDownloadConnection(message); } else { if (query == null) { mXmppConnectionService.getNotificationService().push(message); diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index e86e657e..3d933364 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.parser; +package eu.siacs.conversations.parser; import android.util.Log; @@ -6,26 +6,26 @@ import java.util.ArrayList; import java.util.List; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; import de.thedevstack.conversationsplus.utils.AvatarUtil; import de.thedevstack.conversationsplus.utils.UiUpdateHelper; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.PgpEngine; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.entities.Presence; -import de.thedevstack.conversationsplus.generator.PresenceGenerator; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnPresencePacketReceived; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; -import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.PgpEngine; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.generator.PresenceGenerator; +import eu.siacs.conversations.persistance.DatabaseBackend; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnPresencePacketReceived; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; +import eu.siacs.conversations.xmpp.stanzas.PresencePacket; public class PresenceParser extends AbstractParser implements OnPresencePacketReceived { diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index e721afbb..793b050f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.persistance; +package eu.siacs.conversations.persistance; import android.content.ContentValues; import android.content.Context; @@ -34,22 +34,24 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.json.JSONException; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; + import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlServiceImpl; -import de.thedevstack.conversationsplus.crypto.axolotl.SQLiteAxolotlStore; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Roster; -import de.thedevstack.conversationsplus.entities.ServiceDiscoveryResult; import de.thedevstack.conversationsplus.persistance.db.access.CursorHelper; import de.thedevstack.conversationsplus.persistance.db.access.MessageDatabaseAccess; import de.thedevstack.conversationsplus.utils.SimpleCryptoUtil; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.axolotl.AxolotlServiceImpl; +import eu.siacs.conversations.crypto.axolotl.SQLiteAxolotlStore; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Roster; +import eu.siacs.conversations.entities.ServiceDiscoveryResult; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class DatabaseBackend extends SQLiteOpenHelper { diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index a35ed043..c7cf722d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.persistance; +package eu.siacs.conversations.persistance; import android.content.Intent; import android.graphics.Bitmap; @@ -24,13 +24,14 @@ import de.thedevstack.conversationsplus.entities.FileParams; import de.thedevstack.conversationsplus.exceptions.FileCopyException; import de.thedevstack.conversationsplus.persistance.observers.FileDeletionObserver; import de.thedevstack.conversationsplus.utils.StreamUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.services.XmppConnectionService; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.XmppConnectionService; + public class FileBackend { private static final SimpleDateFormat imageDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US); private static FileBackend INSTANCE; @@ -107,7 +108,18 @@ public class FileBackend { } public static DownloadableFile getFile(Message message, boolean decrypted) { - return new DownloadableFile(getFilePath(message, decrypted)); + DownloadableFile downloadableFile = new DownloadableFile(getFilePath(message, decrypted)); + FileParams fileParams = message.getFileParams(); + if (null != fileParams) { + if (null != fileParams.getKey()) { + downloadableFile.setKey(fileParams.getKey()); + } + if (null != fileParams.getIv()) { + downloadableFile.setIv(fileParams.getIv()); + } + } + + return downloadableFile; } protected static String getFilePath(Message message, String extension) { diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/OnPhoneContactsMerged.java b/src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java index cfbb6ef1..6a457b17 100644 --- a/src/main/java/de/thedevstack/conversationsplus/persistance/OnPhoneContactsMerged.java +++ b/src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.persistance; +package eu.siacs.conversations.persistance; public interface OnPhoneContactsMerged { public void phoneContactsMerged(); diff --git a/src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java b/src/main/java/eu/siacs/conversations/providers/ConversationsPlusFileProvider.java index a718b161..2146ea53 100644 --- a/src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java +++ b/src/main/java/eu/siacs/conversations/providers/ConversationsPlusFileProvider.java @@ -1,10 +1,10 @@ -package de.thedevstack.conversationsplus.providers; +package eu.siacs.conversations.providers; import android.net.Uri; import android.support.v4.content.FileProvider; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.DownloadableFile; +import eu.siacs.conversations.entities.DownloadableFile; /** * Created by lookshe on 27.03.16. diff --git a/src/main/java/de/thedevstack/conversationsplus/services/AbstractConnectionManager.java b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java index 5456430a..dbee8720 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/AbstractConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.Manifest; import android.content.Context; @@ -30,9 +30,10 @@ import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.DownloadableFile; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.DownloadableFile; public class AbstractConnectionManager { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index ed9c259f..16d9539a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -20,26 +20,26 @@ import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.XmppSendUtil; import de.thedevstack.conversationsplus.xmpp.avatar.AvatarPacketGenerator; import de.thedevstack.conversationsplus.xmpp.avatar.AvatarPacketParser; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Bookmark; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.ListItem; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.generator.IqGenerator; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.ui.UiCallback; -import de.thedevstack.conversationsplus.utils.UIHelper; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnAdvancedStreamFeaturesLoaded; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Bookmark; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.generator.IqGenerator; +import eu.siacs.conversations.persistance.DatabaseBackend; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.ui.UiCallback; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.pep.Avatar; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class AvatarService implements OnAdvancedStreamFeaturesLoaded { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/ContactChooserTargetService.java b/src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java index 6256609c..e59c03d9 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/ContactChooserTargetService.java +++ b/src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.annotation.TargetApi; import android.content.ComponentName; @@ -16,8 +16,8 @@ import android.service.chooser.ChooserTargetService; import java.util.ArrayList; import java.util.List; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.ui.ShareWithActivity; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.ui.ShareWithActivity; @TargetApi(Build.VERSION_CODES.M) public class ContactChooserTargetService extends ChooserTargetService implements ServiceConnection { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java b/src/main/java/eu/siacs/conversations/services/EventReceiver.java index 85e92552..ceab1592 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java +++ b/src/main/java/eu/siacs/conversations/services/EventReceiver.java @@ -1,10 +1,10 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; +import eu.siacs.conversations.persistance.DatabaseBackend; public class EventReceiver extends BroadcastReceiver { @Override diff --git a/src/main/java/de/thedevstack/conversationsplus/services/ExportLogsService.java b/src/main/java/eu/siacs/conversations/services/ExportLogsService.java index 0dcfa05e..38c8e1d4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/ExportLogsService.java +++ b/src/main/java/eu/siacs/conversations/services/ExportLogsService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.app.NotificationManager; import android.app.Service; @@ -16,13 +16,13 @@ import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.DatabaseBackend; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.xmpp.jid.Jid; public class ExportLogsService extends Service { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index 6402f4ed..e76eb16b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.util.Pair; @@ -9,17 +9,18 @@ import java.util.Iterator; import java.util.List; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.generator.AbstractGenerator; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnAdvancedStreamFeaturesLoaded; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.generator.AbstractGenerator; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index f4388b21..d11661fa 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.app.Notification; import android.app.NotificationManager; @@ -32,15 +32,15 @@ import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.ImageUtil; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.tzur.conversations.Settings; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.ui.ConversationActivity; -import de.thedevstack.conversationsplus.ui.ManageAccountActivity; -import de.thedevstack.conversationsplus.utils.GeoHelper; -import de.thedevstack.conversationsplus.utils.UIHelper; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.ui.ManageAccountActivity; +import eu.siacs.conversations.utils.GeoHelper; +import eu.siacs.conversations.utils.UIHelper; public class NotificationService { diff --git a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 83cefc80..90f9027a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.services; +package eu.siacs.conversations.services; import android.annotation.SuppressLint; import android.app.AlarmManager; @@ -64,61 +64,64 @@ import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; import de.thedevstack.conversationsplus.utils.XmppSendUtil; import de.tzur.conversations.Settings; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.PgpEngine; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlMessage; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Blockable; -import de.thedevstack.conversationsplus.entities.Bookmark; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.entities.MucOptions.OnRenameListener; -import de.thedevstack.conversationsplus.entities.Presence; -import de.thedevstack.conversationsplus.entities.Roster; -import de.thedevstack.conversationsplus.entities.ServiceDiscoveryResult; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.entities.TransferablePlaceholder; -import de.thedevstack.conversationsplus.generator.IqGenerator; -import de.thedevstack.conversationsplus.generator.MessageGenerator; -import de.thedevstack.conversationsplus.generator.PresenceGenerator; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.parser.IqParser; -import de.thedevstack.conversationsplus.parser.MessageParser; -import de.thedevstack.conversationsplus.parser.PresenceParser; -import de.thedevstack.conversationsplus.persistance.DatabaseBackend; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.ui.UiCallback; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.ExceptionHelper; -import de.thedevstack.conversationsplus.utils.OnPhoneContactsLoadedListener; -import de.thedevstack.conversationsplus.utils.PhoneHelper; -import de.thedevstack.conversationsplus.utils.Xmlns; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnBindListener; -import de.thedevstack.conversationsplus.xmpp.OnContactStatusChanged; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; -import de.thedevstack.conversationsplus.xmpp.OnMessageAcknowledged; -import de.thedevstack.conversationsplus.xmpp.OnMessagePacketReceived; -import de.thedevstack.conversationsplus.xmpp.OnPresencePacketReceived; -import de.thedevstack.conversationsplus.xmpp.OnStatusChanged; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.forms.Field; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.jingle.JingleConnectionManager; -import de.thedevstack.conversationsplus.xmpp.jingle.OnJinglePacketReceived; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.JinglePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.PgpEngine; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Blockable; +import eu.siacs.conversations.entities.Bookmark; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.entities.MucOptions.OnRenameListener; +import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.entities.Roster; +import eu.siacs.conversations.entities.ServiceDiscoveryResult; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; +import eu.siacs.conversations.generator.IqGenerator; +import eu.siacs.conversations.generator.MessageGenerator; +import eu.siacs.conversations.generator.PresenceGenerator; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.parser.IqParser; +import eu.siacs.conversations.parser.MessageParser; +import eu.siacs.conversations.parser.PresenceParser; +import eu.siacs.conversations.persistance.DatabaseBackend; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.ui.UiCallback; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.ExceptionHelper; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.utils.OnPhoneContactsLoadedListener; +import eu.siacs.conversations.utils.PhoneHelper; +import eu.siacs.conversations.utils.Xmlns; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnBindListener; +import eu.siacs.conversations.xmpp.OnContactStatusChanged; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import eu.siacs.conversations.xmpp.OnMessageAcknowledged; +import eu.siacs.conversations.xmpp.OnMessagePacketReceived; +import eu.siacs.conversations.xmpp.OnPresencePacketReceived; +import eu.siacs.conversations.xmpp.OnStatusChanged; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; +import eu.siacs.conversations.xmpp.jingle.OnJinglePacketReceived; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; +import eu.siacs.conversations.xmpp.stanzas.PresencePacket; + import me.leolin.shortcutbadger.ShortcutBadger; public class XmppConnectionService extends Service implements OnPhoneContactsLoadedListener { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java index fd8a187a..a61b872a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/AboutActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java @@ -1,9 +1,9 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.Activity; import android.os.Bundle; -import de.thedevstack.conversationsplus.R; +import eu.siacs.conversations.R; public class AboutActivity extends Activity { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/AboutPreference.java b/src/main/java/eu/siacs/conversations/ui/AboutPreference.java index 8a02b680..b9e5c367 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/AboutPreference.java +++ b/src/main/java/eu/siacs/conversations/ui/AboutPreference.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.content.Context; import android.content.Intent; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/AbstractSearchableListItemActivity.java b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java index b8e57f47..1a9fc95c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/AbstractSearchableListItemActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.content.Context; import android.os.Bundle; @@ -15,9 +15,9 @@ import android.widget.ListView; import java.util.ArrayList; import java.util.List; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.ListItem; -import de.thedevstack.conversationsplus.ui.adapter.ListItemAdapter; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.ui.adapter.ListItemAdapter; public abstract class AbstractSearchableListItemActivity extends XmppActivity { private ListView mListView; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/BlockContactDialog.java b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java index 589f565c..9cf7e9f8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/BlockContactDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java @@ -1,12 +1,12 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Blockable; -import de.thedevstack.conversationsplus.services.XmppConnectionService; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Blockable; +import eu.siacs.conversations.services.XmppConnectionService; public final class BlockContactDialog { public static void show(final Context context, diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/BlocklistActivity.java b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java index 377d0e02..5a85c17b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/BlocklistActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.os.Bundle; import android.text.Editable; @@ -7,10 +7,10 @@ import android.widget.AdapterView; import java.util.Collections; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.jid.Jid; public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index 2e063757..9f4a4bc3 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.os.Bundle; import android.view.View; @@ -7,11 +7,12 @@ import android.widget.EditText; import android.widget.Toast; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.services.XmppConnectionService; import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.XmppConnectionService; + public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged { private Button mChangePasswordButton; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java index 29860434..c5357a5e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ChooseContactActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.content.Context; import android.content.Intent; @@ -19,12 +19,12 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.ListItem; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.xmpp.jid.Jid; public class ChooseContactActivity extends AbstractSearchableListItemActivity { private List<String> mActivatedAccounts = new ArrayList<String>(); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index 2a3cd7fe..eac2c1b8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.annotation.TargetApi; import android.app.AlertDialog; @@ -31,21 +31,22 @@ import java.util.Collections; import java.util.Comparator; import java.util.concurrent.atomic.AtomicInteger; -import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.PgpEngine; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Bookmark; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.entities.MucOptions.User; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnConversationUpdate; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnMucRosterUpdate; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.PgpEngine; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Bookmark; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.entities.MucOptions.User; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate; +import eu.siacs.conversations.services.XmppConnectionService.OnMucRosterUpdate; +import eu.siacs.conversations.xmpp.jid.Jid; public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged, XmppConnectionService.OnConferenceOptionsPushed { public static final String ACTION_VIEW_MUC = "view_muc"; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 3ca9fce7..b11564a9 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.app.PendingIntent; @@ -34,24 +34,24 @@ import java.util.List; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.PgpEngine; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.ListItem; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnAccountUpdate; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnRosterUpdate; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.UIHelper; -import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.PgpEngine; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; +import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class ContactDetailsActivity extends XmppActivity implements OnAccountUpdate, OnRosterUpdate, OnUpdateBlocklist, OnKeyStatusUpdated { public static final String ACTION_VIEW_CONTACT = "view_contact"; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 99d26b64..4466dd22 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.annotation.SuppressLint; import android.app.ActionBar; @@ -45,33 +45,35 @@ import java.util.concurrent.atomic.AtomicBoolean; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; 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; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlServiceImpl; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Blockable; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnAccountUpdate; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnConversationUpdate; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnRosterUpdate; -import de.thedevstack.conversationsplus.ui.adapter.ConversationAdapter; -import de.thedevstack.conversationsplus.utils.ExceptionHelper; -import de.thedevstack.conversationsplus.utils.FileUtils; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.AxolotlServiceImpl; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Blockable; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.http.HttpDownloadConnection; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; +import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate; +import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; +import eu.siacs.conversations.ui.adapter.ConversationAdapter; +import eu.siacs.conversations.utils.ExceptionHelper; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class ConversationActivity extends XmppActivity implements OnAccountUpdate, OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast { @@ -621,7 +623,10 @@ public class ConversationActivity extends XmppActivity Toast.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); } } else if (message.treatAsDownloadable() != Message.Decision.NEVER) { - HttpConnectionManager.createNewDownloadConnection(message, true); + HttpDownloadConnection downloadConnection = HttpConnectionManager.createNewDownloadConnection(message, true); + if (null == downloadConnection) { + Toast.makeText(this, R.string.file_not_on_remote_host, Toast.LENGTH_LONG).show(); + } } } diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 0c2f2960..08f49551 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.Activity; import android.app.AlertDialog; @@ -41,41 +41,46 @@ import net.java.otr4j.session.SessionStatus; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.NoSuchElementException; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.UUID; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.http.HttpDownloadConnection; import de.thedevstack.conversationsplus.services.filetransfer.http.delete.DeleteRemoteFileService; import de.thedevstack.conversationsplus.ui.dialogs.SimpleConfirmDialog; import de.thedevstack.conversationsplus.ui.dialogs.MessageDetailsDialog; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.entities.Presence; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.entities.TransferablePlaceholder; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.XmppActivity.OnPresenceSelected; -import de.thedevstack.conversationsplus.ui.XmppActivity.OnValueEdited; -import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter; -import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter.OnContactPictureClicked; -import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter.OnContactPictureLongClicked; -import de.thedevstack.conversationsplus.ui.listeners.ConversationSwipeRefreshListener; import de.thedevstack.conversationsplus.ui.listeners.DeleteFileCallback; import de.thedevstack.conversationsplus.ui.listeners.SimpleUserDecisionCallback; import de.thedevstack.conversationsplus.ui.listeners.UserDecisionListener; -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; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.http.HttpDownloadConnection; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.XmppActivity.OnPresenceSelected; +import eu.siacs.conversations.ui.XmppActivity.OnValueEdited; +import eu.siacs.conversations.ui.adapter.MessageAdapter; +import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureClicked; +import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureLongClicked; +import eu.siacs.conversations.ui.listeners.ConversationSwipeRefreshListener; +import eu.siacs.conversations.utils.GeoHelper; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.jid.Jid; + import github.ankushsachdeva.emojicon.EmojiconGridView; import github.ankushsachdeva.emojicon.EmojiconsPopup; import github.ankushsachdeva.emojicon.emoji.Emojicon; @@ -688,7 +693,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } private void downloadFile(Message message) { - HttpConnectionManager.createNewDownloadConnection(message,true); + HttpDownloadConnection downloadConnection = HttpConnectionManager.createNewDownloadConnection(message, true); + if (null == downloadConnection) { + Toast.makeText(activity, R.string.file_not_on_remote_host, Toast.LENGTH_LONG).show(); + } } private void cancelTransmission(Message message) { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 1a868949..d63516bc 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.app.AlertDialog.Builder; @@ -41,26 +41,27 @@ import java.util.concurrent.atomic.AtomicInteger; import de.thedevstack.conversationsplus.ConversationsPlusColors; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnAccountUpdate; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnCaptchaRequested; -import de.thedevstack.conversationsplus.ui.adapter.KnownHostsAdapter; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.UIHelper; import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.XmppConnection.Features; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; +import eu.siacs.conversations.services.XmppConnectionService.OnCaptchaRequested; +import eu.siacs.conversations.ui.adapter.KnownHostsAdapter; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.XmppConnection.Features; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.pep.Avatar; public class EditAccountActivity extends XmppActivity implements OnAccountUpdate, OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/EditMessage.java b/src/main/java/eu/siacs/conversations/ui/EditMessage.java index 5664434f..06868a98 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/EditMessage.java +++ b/src/main/java/eu/siacs/conversations/ui/EditMessage.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.content.Context; import android.os.Handler; import android.util.AttributeSet; import android.view.KeyEvent; -import de.thedevstack.conversationsplus.Config; +import eu.siacs.conversations.Config; import github.ankushsachdeva.emojicon.EmojiconEditText; public class EditMessage extends EmojiconEditText { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index 9e52d390..a6b3c73c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.content.Context; @@ -11,11 +11,11 @@ import android.widget.TextView; import java.util.List; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.ui.adapter.KnownHostsAdapter; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.ui.adapter.KnownHostsAdapter; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class EnterJidDialog { public interface OnEnterJidDialogPositiveListener { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java b/src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java index 54fe3910..bedb4172 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java +++ b/src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.Manifest; import android.content.Context; @@ -8,7 +8,7 @@ import android.os.Build; import android.preference.Preference; import android.util.AttributeSet; -import de.thedevstack.conversationsplus.services.ExportLogsService; +import eu.siacs.conversations.services.ExportLogsService; public class ExportLogsPreference extends Preference { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index e376b6b3..c83a0275 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.ActionBar; import android.app.AlertDialog; @@ -27,14 +27,14 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnAccountUpdate; -import de.thedevstack.conversationsplus.ui.adapter.AccountAdapter; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; +import eu.siacs.conversations.ui.adapter.AccountAdapter; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class ManageAccountActivity extends XmppActivity implements OnAccountUpdate, KeyChainAliasCallback, XmppConnectionService.OnAccountCreated { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index 6793d882..1916947b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/PublishProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.PendingIntent; import android.content.Intent; @@ -24,15 +24,16 @@ import java.io.FileNotFoundException; import de.thedevstack.conversationsplus.ConversationsPlusColors; import de.thedevstack.conversationsplus.utils.ImageUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.utils.ExifHelper; -import de.thedevstack.conversationsplus.utils.FileUtils; -import de.thedevstack.conversationsplus.utils.PhoneHelper; import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; -import de.thedevstack.conversationsplus.xmpp.pep.Avatar; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.utils.ExifHelper; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.utils.PhoneHelper; +import eu.siacs.conversations.xmpp.pep.Avatar; public class PublishProfilePictureActivity extends XmppActivity { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index 296f8f4f..6dd8a84f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.app.FragmentManager; @@ -24,12 +24,14 @@ import java.util.Locale; import de.duenndns.ssl.MemorizingTrustManager; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.services.ExportLogsService; import de.tzur.conversations.Settings; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.ExportLogsService; +import eu.siacs.conversations.xmpp.XmppConnection; + import github.ankushsachdeva.emojicon.EmojiconHandler; public class SettingsActivity extends XmppActivity implements diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/SettingsFragment.java b/src/main/java/eu/siacs/conversations/ui/SettingsFragment.java index a549ff94..e4185abc 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/SettingsFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsFragment.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.Dialog; import android.os.Bundle; @@ -11,7 +11,7 @@ import android.view.ViewParent; import android.widget.FrameLayout; import android.widget.LinearLayout; -import de.thedevstack.conversationsplus.R; +import eu.siacs.conversations.R; public class SettingsFragment extends PreferenceFragment { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index 28e8beb8..7fcd6b33 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.PendingIntent; import android.content.Intent; @@ -23,18 +23,19 @@ import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.ui.dialogs.UserDecisionDialog; import de.thedevstack.conversationsplus.ui.listeners.ResizePictureUserDecisionListener; import de.thedevstack.conversationsplus.ui.listeners.ShareWithResizePictureUserDecisionListener; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -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; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.adapter.ConversationAdapter; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 2dc8d1a5..188cd3fe 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.Manifest; import android.annotation.SuppressLint; @@ -57,23 +57,23 @@ import java.util.concurrent.atomic.AtomicBoolean; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Blockable; -import de.thedevstack.conversationsplus.entities.Bookmark; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.ListItem; -import de.thedevstack.conversationsplus.entities.Presence; -import de.thedevstack.conversationsplus.services.XmppConnectionService.OnRosterUpdate; -import de.thedevstack.conversationsplus.ui.adapter.KnownHostsAdapter; -import de.thedevstack.conversationsplus.ui.adapter.ListItemAdapter; -import de.thedevstack.conversationsplus.utils.XmppUri; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.XmppConnection; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Blockable; +import eu.siacs.conversations.entities.Bookmark; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate; +import eu.siacs.conversations.ui.adapter.KnownHostsAdapter; +import eu.siacs.conversations.ui.adapter.ListItemAdapter; +import eu.siacs.conversations.utils.XmppUri; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class StartConversationActivity extends XmppActivity implements OnRosterUpdate, OnUpdateBlocklist { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/TimePreference.java b/src/main/java/eu/siacs/conversations/ui/TimePreference.java index bfe7c8f4..e32b068c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/TimePreference.java +++ b/src/main/java/eu/siacs/conversations/ui/TimePreference.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.content.Context; import android.content.res.TypedArray; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index dfddbb78..02a9823d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.content.Intent; import android.os.Bundle; @@ -19,15 +19,16 @@ import java.util.Map; import java.util.Set; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; -import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdated { private List<Jid> contactJids; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/UiCallback.java b/src/main/java/eu/siacs/conversations/ui/UiCallback.java index d5291b80..d056d628 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/UiCallback.java +++ b/src/main/java/eu/siacs/conversations/ui/UiCallback.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.PendingIntent; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/VerifyOTRActivity.java b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java index 4f1c9fc7..a310b6ce 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/VerifyOTRActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.app.ActionBar; import android.app.AlertDialog; @@ -20,16 +20,17 @@ import net.java.otr4j.OtrException; import net.java.otr4j.session.Session; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.XmppUri; import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.XmppUri; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class VerifyOTRActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 726facac..26b7909b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui; +package eu.siacs.conversations.ui; import android.Manifest; import android.annotation.SuppressLint; @@ -73,23 +73,24 @@ import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusColors; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.ImageUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.MucOptions; -import de.thedevstack.conversationsplus.entities.Presences; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.services.XmppConnectionService.XmppConnectionBinder; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.ExceptionHelper; -import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; -import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.entities.Presences; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinder; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.ExceptionHelper; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public abstract class XmppActivity extends Activity { @@ -932,7 +933,7 @@ public abstract class XmppActivity extends Activity { public NdefMessage createNdefMessage(NfcEvent nfcEvent) { return new NdefMessage(new NdefRecord[]{ NdefRecord.createUri(getShareableUri()), - NdefRecord.createApplicationRecord("de.thedevstack.conversationsplus") + NdefRecord.createApplicationRecord("eu.siacs.conversations") }); } }, this); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java index ee209576..55d3f5a7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.adapter; +package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.view.LayoutInflater; @@ -12,13 +12,14 @@ import android.widget.TextView; import java.util.List; -import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.ui.ManageAccountActivity; -import de.thedevstack.conversationsplus.ui.XmppActivity; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.ui.ManageAccountActivity; +import eu.siacs.conversations.ui.XmppActivity; public class AccountAdapter extends ArrayAdapter<Account> { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index e0e672e3..317dcc78 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.adapter; +package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.content.res.Resources; @@ -24,15 +24,16 @@ import de.thedevstack.conversationsplus.ConversationsPlusColors; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener; import de.tzur.conversations.Settings; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.ui.ConversationActivity; -import de.thedevstack.conversationsplus.ui.XmppActivity; -import de.thedevstack.conversationsplus.utils.UIHelper; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Presences; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.ui.XmppActivity; +import eu.siacs.conversations.utils.UIHelper; public class ConversationAdapter extends ArrayAdapter<Conversation> { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/KnownHostsAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java index 41973089..39bfc082 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/KnownHostsAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.adapter; +package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.widget.ArrayAdapter; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java index a67f5bcd..29d706c7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.adapter; +package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.content.res.Resources; @@ -20,11 +20,12 @@ import java.util.concurrent.RejectedExecutionException; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.tzur.conversations.Settings; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.ListItem; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.ui.XmppActivity; -import de.thedevstack.conversationsplus.utils.UIHelper; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.ListItem; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.ui.XmppActivity; +import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.jid.Jid; public class ListItemAdapter extends ArrayAdapter<ListItem> { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index dd190576..0e0e086f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.adapter; +package eu.siacs.conversations.ui.adapter; import android.content.ActivityNotFoundException; import android.content.Intent; @@ -18,9 +18,7 @@ import android.text.style.ForegroundColorSpan; import android.text.style.RelativeSizeSpan; import android.text.style.StyleSpan; import android.text.util.Linkify; -import android.util.DisplayMetrics; import android.util.Patterns; -import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; @@ -33,7 +31,6 @@ import android.widget.TextView; import android.widget.Toast; import java.lang.ref.WeakReference; -import java.net.URL; import java.util.List; import java.util.concurrent.RejectedExecutionException; import java.util.regex.Matcher; @@ -42,23 +39,25 @@ import java.util.regex.Pattern; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusColors; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.DownloadableFile; import de.thedevstack.conversationsplus.entities.FileParams; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; import de.thedevstack.conversationsplus.enums.FileStatus; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.providers.ConversationsPlusFileProvider; -import de.thedevstack.conversationsplus.services.AvatarService; -import de.thedevstack.conversationsplus.ui.ConversationActivity; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.GeoHelper; import de.thedevstack.conversationsplus.utils.MessageUtil; -import de.thedevstack.conversationsplus.utils.UIHelper; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.providers.ConversationsPlusFileProvider; +import eu.siacs.conversations.services.AvatarService; +import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.GeoHelper; +import eu.siacs.conversations.utils.UIHelper; public class MessageAdapter extends ArrayAdapter<Message> { @@ -74,15 +73,12 @@ public class MessageAdapter extends ArrayAdapter<Message> { private ConversationActivity activity; - private DisplayMetrics metrics; - private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; public MessageAdapter(ConversationActivity activity, List<Message> messages) { super(activity, 0, messages); this.activity = activity; - metrics = getContext().getResources().getDisplayMetrics(); } public void setOnContactPictureClicked(OnContactPictureClicked listener) { @@ -133,14 +129,9 @@ public class MessageAdapter extends ArrayAdapter<Message> { boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI && message.getStatus() <= Message.STATUS_RECEIVED; if (message.hasFileAttached() || message.getTransferable() != null) { - FileParams params = message.getFileParams(); + FileParams params = message.getFileParams(); if (null != params) { - long size = params.getSize(); - if (size > (1.5 * 1024 * 1024)) { - filesize = size / (1024 * 1024)+ " MiB"; - } else if (size > 0) { - filesize = size / 1024 + " KiB"; - } + filesize = UIHelper.getHumanReadableFileSize(params.getSize()); } if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) { @@ -221,15 +212,11 @@ public class MessageAdapter extends ArrayAdapter<Message> { String formatedTime = UIHelper.readableTimeDifferenceFull(getContext(), message.getTimeSent()); if (message.getStatus() <= Message.STATUS_RECEIVED) { - if ((filesize != null) && (info != null)) { - viewHolder.time.setText(formatedTime + " \u00B7 " + filesize +" \u00B7 " + info); - } else if ((filesize == null) && (info != null)) { - viewHolder.time.setText(formatedTime + " \u00B7 " + info); - } else if ((filesize != null) && (info == null)) { - viewHolder.time.setText(formatedTime + " \u00B7 " + filesize); - } else { - viewHolder.time.setText(formatedTime); - } + StringBuilder timeText = new StringBuilder(); + timeText.append((null != formatedTime) ? formatedTime + ((null != info || null != filesize) ? " \u00B7 " : "") : ""); + timeText.append((null != filesize) ? filesize + ((null != info) ? " \u00B7 " : "") : ""); + timeText.append((null != info) ? info : ""); + viewHolder.time.setText(timeText); } else { if ((filesize != null) && (info != null)) { viewHolder.time.setText(filesize + " \u00B7 " + info); @@ -397,13 +384,38 @@ public class MessageAdapter extends ArrayAdapter<Message> { return count; } - private void displayDownloadableMessage(ViewHolder viewHolder, - final Message message, String text) { + private void displayDownloadButton(ViewHolder viewHolder, String btnText, OnClickListener onClickListener) { + viewHolder.download_button.setVisibility(View.VISIBLE); + viewHolder.download_button.setText(btnText); + viewHolder.download_button.setOnClickListener(onClickListener); + viewHolder.download_button.setOnLongClickListener(openContextMenu); + } + + private void displayFileInfoForFileMessage(final Message message, ViewHolder viewHolder) { + viewHolder.messageBody.setVisibility(View.VISIBLE); + StringBuilder fileInfos = new StringBuilder(); + String filename = UIHelper.getDisplayFilename(message); + fileInfos.append((null != filename && !filename.isEmpty()) ? (filename) : ""); + + int oldAutoLinkMask = viewHolder.messageBody.getAutoLinkMask(); + viewHolder.messageBody.setAutoLinkMask(0); + viewHolder.messageBody.setText(fileInfos); + viewHolder.messageBody.setAutoLinkMask(oldAutoLinkMask); + } + + private void displayDownloadableMessage(ViewHolder viewHolder, final Message message, int resId) { viewHolder.image.setVisibility(View.GONE); - viewHolder.messageBody.setVisibility(View.GONE); - viewHolder.download_button.setVisibility(View.VISIBLE); - viewHolder.download_button.setText(text); - viewHolder.download_button.setOnClickListener(new OnClickListener() { + FileParams fileParams = message.getFileParams(); + String btnText; + if (null != fileParams) { + this.displayFileInfoForFileMessage(message, viewHolder); + btnText = activity.getString(resId, ""); + } else { + viewHolder.messageBody.setVisibility(View.GONE); + btnText = activity.getString(resId, UIHelper.getFileDescriptionString(activity, message)); + } + + this.displayDownloadButton(viewHolder, btnText, new OnClickListener() { @Override public void onClick(View v) { @@ -414,10 +426,18 @@ public class MessageAdapter extends ArrayAdapter<Message> { private void displayOpenableMessage(ViewHolder viewHolder,final Message message) { viewHolder.image.setVisibility(View.GONE); - viewHolder.messageBody.setVisibility(View.GONE); - viewHolder.download_button.setVisibility(View.VISIBLE); - viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); - viewHolder.download_button.setOnClickListener(new OnClickListener() { + + FileParams fileParams = message.getFileParams(); + String btnText; + if (null != fileParams) { + this.displayFileInfoForFileMessage(message, viewHolder); + btnText = activity.getString(R.string.cplus_open); + } else { + viewHolder.messageBody.setVisibility(View.GONE); + btnText = activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message)); + } + + this.displayDownloadButton(viewHolder, btnText, new OnClickListener() { @Override public void onClick(View v) { @@ -474,6 +494,149 @@ public class MessageAdapter extends ArrayAdapter<Message> { }); } + private View displayStatusMessage(final Message message, ViewHolder viewHolder) { + if (null != viewHolder) { + final Conversation conversation = message.getConversation(); + + viewHolder.status_message.setVisibility(View.VISIBLE); + viewHolder.contact_picture.setVisibility(View.VISIBLE); + if (conversation.getMode() == Conversation.MODE_SINGLE) { + viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(conversation.getContact(), + activity.getPixel(32))); + viewHolder.contact_picture.setAlpha(0.5f); + } + viewHolder.status_message.setText(message.getBody()); + } + return viewHolder.view; + } + + private void displayFileMessage(final Message message, ViewHolder viewHolder) { + final FileParams fileParams = message.getFileParams(); + String mimeType = (null != fileParams) ? fileParams.getMimeType() : null; + if ((message.getType() == Message.TYPE_IMAGE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) + || (fileParams != null && fileParams.getWidth() > 0) + || (null != mimeType && mimeType.startsWith("image/"))) { + displayImageMessage(viewHolder, message); + } else if ((message.getType() == Message.TYPE_FILE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) + && null != fileParams && (FileStatus.NEEDS_DOWNLOAD != fileParams.getFileStatus() || 0 == fileParams.getWidth())) { + displayOpenableMessage(viewHolder, message); + } else if (Message.Decision.NEVER == message.treatAsDownloadable()) { + displayTextMessage(viewHolder, message, getItemViewType(message) == RECEIVED && !message.isValidInSession()); + } else { + displayDownloadableMessage(viewHolder, message, R.string.download_x_file); + } + } + + + private void loadAvatar(Message message, ImageView imageView) { + if (cancelPotentialWork(message, imageView)) { + int avatarPixel = imageView.getResources().getDimensionPixelOffset(R.dimen.msg_avatar_size); + final Bitmap bm = AvatarService.getInstance().get(message, avatarPixel, true); + if (bm != null) { + imageView.setImageBitmap(bm); + imageView.setBackgroundColor(0x00000000); + } else { + imageView.setBackgroundColor(UIHelper.getColorForName(UIHelper.getMessageDisplayName(message))); + imageView.setImageDrawable(null); + final BitmapWorkerTask task = new BitmapWorkerTask(imageView); + final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task); + imageView.setImageDrawable(asyncDrawable); + try { + task.execute(message); + } catch (final RejectedExecutionException ignored) { + } + } + } + } + + private void displayAvatar(final Message message, int type, ViewHolder viewHolder) { + if (type == RECEIVED) { + ImageView imageView = viewHolder.contact_picture; + if (null != imageView) { + this.loadAvatar(message, imageView); + imageView.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + if (MessageAdapter.this.mOnContactPictureClickedListener != null) { + MessageAdapter.this.mOnContactPictureClickedListener + .onContactPictureClicked(message); + } + + } + }); + if (message.getConversation().getMode() == Conversation.MODE_MULTI) { + imageView.setOnLongClickListener(new OnLongClickListener() { + + @Override + public boolean onLongClick(View v) { + if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { + MessageAdapter.this.mOnContactPictureLongClickedListener + .onContactPictureLongClicked(message); + return true; + } else { + return false; + } + } + }); + } + } + } + } + + private View initializeView(int type, ViewGroup parent) { + Integer viewResId = null; + + switch (type) { + case SENT: + viewResId = R.layout.message_sent; + break; + case RECEIVED: + viewResId = R.layout.message_received; + break; + case STATUS: + viewResId = R.layout.message_status; + break; + } + + return activity.getLayoutInflater().inflate(viewResId, parent, false); + } + + private ViewHolder initializeViewHolderAndView(Message message, int type, ViewGroup parent) { + View view = initializeView(type, parent); + ViewHolder viewHolder = new ViewHolder(view); + if (SENT == type + || RECEIVED == type) { + viewHolder.message_box = (LinearLayout) view.findViewById(R.id.message_box); + viewHolder.message_box.setVisibility(View.VISIBLE); + viewHolder.indicator = (ImageView) view.findViewById(R.id.security_indicator); + viewHolder.messageBody = (TextView) view.findViewById(R.id.message_body); + viewHolder.time = (TextView) view.findViewById(R.id.message_time); + viewHolder.indicatorReceived = (ImageView) view.findViewById(R.id.indicator_received); + } + if ((SENT == type + || RECEIVED == type)) { + viewHolder.download_button = (Button) view.findViewById(R.id.download_button); + viewHolder.image = (ImageView) view.findViewById(R.id.message_image); + } + if (RECEIVED == type) { // Extra block as preparation for new /me representation + viewHolder.contact_picture = (ImageView) view.findViewById(R.id.message_photo); + viewHolder.contact_picture.setVisibility(View.VISIBLE); + } + if (RECEIVED == type) { + viewHolder.encryption = (TextView) view.findViewById(R.id.message_encryption); + } + if (STATUS == type) { + viewHolder.contact_picture = (ImageView) view.findViewById(R.id.message_photo); + viewHolder.contact_picture.setVisibility(View.VISIBLE); + viewHolder.status_message = (TextView) view.findViewById(R.id.status_message); + viewHolder.status_message.setVisibility(View.VISIBLE); + } + view.setTag(viewHolder); + + return viewHolder; + } + @Override public View getView(int position, View view, ViewGroup parent) { final Message message = getItem(position); @@ -481,180 +644,81 @@ public class MessageAdapter extends ArrayAdapter<Message> { final Conversation conversation = message.getConversation(); final Account account = conversation.getAccount(); final int type = getItemViewType(position); - ViewHolder viewHolder; - if (view == null) { - viewHolder = new ViewHolder(); - switch (type) { - case SENT: - view = activity.getLayoutInflater().inflate( - R.layout.message_sent, parent, false); - viewHolder.message_box = (LinearLayout) view - .findViewById(R.id.message_box); - viewHolder.contact_picture = (ImageView) view - .findViewById(R.id.message_photo); - viewHolder.download_button = (Button) view - .findViewById(R.id.download_button); - viewHolder.indicator = (ImageView) view - .findViewById(R.id.security_indicator); - viewHolder.image = (ImageView) view - .findViewById(R.id.message_image); - viewHolder.messageBody = (TextView) view - .findViewById(R.id.message_body); - viewHolder.time = (TextView) view - .findViewById(R.id.message_time); - viewHolder.indicatorReceived = (ImageView) view - .findViewById(R.id.indicator_received); - viewHolder.remoteFileStatus = (TextView) view.findViewById(R.id.remote_file_status); - break; - case RECEIVED: - view = activity.getLayoutInflater().inflate( - R.layout.message_received, parent, false); - viewHolder.message_box = (LinearLayout) view - .findViewById(R.id.message_box); - viewHolder.contact_picture = (ImageView) view - .findViewById(R.id.message_photo); - viewHolder.download_button = (Button) view - .findViewById(R.id.download_button); - viewHolder.indicator = (ImageView) view - .findViewById(R.id.security_indicator); - viewHolder.image = (ImageView) view - .findViewById(R.id.message_image); - viewHolder.messageBody = (TextView) view - .findViewById(R.id.message_body); - viewHolder.time = (TextView) view - .findViewById(R.id.message_time); - viewHolder.indicatorReceived = (ImageView) view - .findViewById(R.id.indicator_received); - viewHolder.encryption = (TextView) view.findViewById(R.id.message_encryption); - break; - case STATUS: - view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false); - viewHolder.contact_picture = (ImageView) view.findViewById(R.id.message_photo); - viewHolder.status_message = (TextView) view.findViewById(R.id.status_message); - break; - default: - viewHolder = null; - break; - } - view.setTag(viewHolder); - } else { - viewHolder = (ViewHolder) view.getTag(); - if (viewHolder == null) { - return view; - } - } - - boolean darkBackground = (type == RECEIVED && !isInValidSession); - - if (type == STATUS) { - viewHolder.status_message.setVisibility(View.VISIBLE); - viewHolder.contact_picture.setVisibility(View.VISIBLE); - if (conversation.getMode() == Conversation.MODE_SINGLE) { - viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(conversation.getContact(), - activity.getPixel(32))); - viewHolder.contact_picture.setAlpha(0.5f); - } - viewHolder.status_message.setText(message.getBody()); - return view; - } else { - loadAvatar(message, viewHolder.contact_picture); - } + ViewHolder viewHolder; + if (null == view) { + viewHolder = initializeViewHolderAndView(message, type, parent); + view = viewHolder.view; + } else { + viewHolder = (ViewHolder) view.getTag(); + if (null == viewHolder) { + return view; + } + } - viewHolder.contact_picture - .setOnClickListener(new OnClickListener() { + if (type == STATUS) { + return displayStatusMessage(message, viewHolder); + } - @Override - public void onClick(View v) { - if (MessageAdapter.this.mOnContactPictureClickedListener != null) { - MessageAdapter.this.mOnContactPictureClickedListener - .onContactPictureClicked(message); - } + this.displayAvatar(message, type, viewHolder); - } - }); - viewHolder.contact_picture - .setOnLongClickListener(new OnLongClickListener() { - - @Override - public boolean onLongClick(View v) { - if (MessageAdapter.this.mOnContactPictureLongClickedListener != null) { - MessageAdapter.this.mOnContactPictureLongClickedListener - .onContactPictureLongClicked(message); - return true; - } else { - return false; - } - } - }); + boolean darkBackground = (type == RECEIVED && !isInValidSession); + this.displayStatus(viewHolder, message, type, darkBackground); final Transferable transferable = message.getTransferable(); - if (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING) { - if (transferable.getStatus() == Transferable.STATUS_OFFER) { - displayDownloadableMessage(viewHolder,message,activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message))); - } else if (transferable.getStatus() == Transferable.STATUS_OFFER_CHECK_FILESIZE) { - displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message))); - } else { - displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first,darkBackground); - } - } else if (message.getType() == Message.TYPE_IMAGE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) { - displayImageMessage(viewHolder, message); - } else if (message.getType() == Message.TYPE_FILE && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) { - if (message.getFileParams() != null && message.getFileParams().getWidth() > 0) { // TODO Use FileParams.getMimeType() - displayImageMessage(viewHolder,message); - } else { - displayOpenableMessage(viewHolder, message); - } - } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { - if (activity.hasPgp()) { - if (account.getPgpDecryptionService().isRunning()) { - displayInfoMessage(viewHolder, activity.getString(R.string.message_decrypting), darkBackground); - } else { - displayInfoMessage(viewHolder, activity.getString(R.string.pgp_message), darkBackground); - } - } else { - displayInfoMessage(viewHolder,activity.getString(R.string.install_openkeychain),darkBackground); - if (viewHolder != null) { - viewHolder.message_box - .setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - activity.showInstallPgpDialog(); - } - }); - } - } - } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { - displayDecryptionFailed(viewHolder,darkBackground); - } else if (message.hasFileAttached()) { // TODO: Move to a single block with Message.TYPE_FILE OR Message.TYPE_IMAGE - FileParams fileParams = message.getFileParams(); - String mimeType = (null != fileParams) ? fileParams.getMimeType() : null; - if (null != mimeType && mimeType.startsWith("image/")) { - displayImageMessage(viewHolder, message); + if (null != transferable) { + switch (transferable.getStatus()) { + case Transferable.STATUS_OFFER: + displayDownloadableMessage(viewHolder, message, R.string.download_x_file); + break; + case Transferable.STATUS_OFFER_CHECK_FILESIZE: + displayDownloadableMessage(viewHolder, message, R.string.check_x_filesize); + break; + case Transferable.STATUS_UPLOADING: + displayFileMessage(message, viewHolder); + break; + case Transferable.STATUS_DELETED: + case Transferable.STATUS_CHECKING: + case Transferable.STATUS_FAILED: + case Transferable.STATUS_UNKNOWN: + displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first,darkBackground); + break; + } + } else if (message.hasFileAttached()) { + if (message.trusted() + && MessageUtil.needsDownload(message) + && ConversationsPlusPreferences.autoAcceptFileSize() > 0 + && (message.isHttpUploaded() || ConversationsPlusPreferences.autoDownloadFileLink())) { + HttpConnectionManager.createNewDownloadConnection(message); + } else { + displayFileMessage(message, viewHolder); + } + } else if (GeoHelper.isGeoUri(message.getBody())) { + displayLocationMessage(viewHolder, message); + } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { + if (activity.hasPgp()) { + if (account.getPgpDecryptionService().isRunning()) { + displayInfoMessage(viewHolder, activity.getString(R.string.message_decrypting), darkBackground); + } else { + displayInfoMessage(viewHolder, activity.getString(R.string.pgp_message), darkBackground); + } } else { - displayOpenableMessage(viewHolder, message); + displayInfoMessage(viewHolder,activity.getString(R.string.install_openkeychain),darkBackground); + if (viewHolder != null) { + viewHolder.message_box + .setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + activity.showInstallPgpDialog(); + } + }); + } } + } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { + displayDecryptionFailed(viewHolder,darkBackground); } else { - if (GeoHelper.isGeoUri(message.getBody())) { - displayLocationMessage(viewHolder,message); - } else if (MessageUtil.needsDownload(message)) { - try { - URL url = new URL(message.getFileParams().getUrl()); - displayDownloadableMessage(viewHolder, - message, - activity.getString(R.string.check_x_filesize_on_host, - UIHelper.getFileDescriptionString(activity, message), - url.getHost())); - } catch (Exception e) { - displayDownloadableMessage(viewHolder, - message, - activity.getString(R.string.check_x_filesize, - UIHelper.getFileDescriptionString(activity, message))); - } - } else { - displayTextMessage(viewHolder, message, darkBackground); - } - } + displayTextMessage(viewHolder, message, darkBackground); + } if (type == RECEIVED) { if(isInValidSession) { @@ -666,8 +730,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { } } - displayStatus(viewHolder, message, type, darkBackground); - return view; } @@ -735,6 +797,10 @@ public class MessageAdapter extends ArrayAdapter<Message> { } private static class ViewHolder { + protected ViewHolder(View view) { + this.view = view; + } + protected View view; protected LinearLayout message_box; protected Button download_button; @@ -759,7 +825,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { @Override protected Bitmap doInBackground(Message... params) { - return AvatarService.getInstance().get(params[0], activity.getPixel(48), isCancelled()); + int avatarPixel = activity.getResources().getDimensionPixelOffset(R.dimen.msg_avatar_size); + return AvatarService.getInstance().get(params[0], avatarPixel, isCancelled()); } @Override @@ -774,26 +841,6 @@ public class MessageAdapter extends ArrayAdapter<Message> { } } - public void loadAvatar(Message message, ImageView imageView) { - if (cancelPotentialWork(message, imageView)) { - final Bitmap bm = AvatarService.getInstance().get(message, activity.getPixel(48), true); - if (bm != null) { - imageView.setImageBitmap(bm); - imageView.setBackgroundColor(0x00000000); - } else { - imageView.setBackgroundColor(UIHelper.getColorForName(UIHelper.getMessageDisplayName(message))); - imageView.setImageDrawable(null); - final BitmapWorkerTask task = new BitmapWorkerTask(imageView); - final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task); - imageView.setImageDrawable(asyncDrawable); - try { - task.execute(message); - } catch (final RejectedExecutionException ignored) { - } - } - } - } - public static boolean cancelPotentialWork(Message message, ImageView imageView) { final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormBooleanFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java index 04c3fe20..6cb357a9 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormBooleanFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.forms; +package eu.siacs.conversations.ui.forms; import android.content.Context; import android.widget.CheckBox; @@ -7,8 +7,8 @@ import android.widget.CompoundButton; import java.util.ArrayList; import java.util.List; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.xmpp.forms.Field; +import eu.siacs.conversations.R; +import eu.siacs.conversations.xmpp.forms.Field; public class FormBooleanFieldWrapper extends FormFieldWrapper { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormFieldFactory.java b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldFactory.java index e726b6cc..ee306472 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormFieldFactory.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldFactory.java @@ -1,10 +1,10 @@ -package de.thedevstack.conversationsplus.ui.forms; +package eu.siacs.conversations.ui.forms; import android.content.Context; import java.util.Hashtable; -import de.thedevstack.conversationsplus.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.forms.Field; diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java index 662d5bb5..cb504576 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.forms; +package eu.siacs.conversations.ui.forms; import android.content.Context; import android.text.SpannableString; @@ -10,8 +10,9 @@ import android.view.View; import java.util.List; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.xmpp.forms.Field; + +import eu.siacs.conversations.R; +import eu.siacs.conversations.xmpp.forms.Field; public abstract class FormFieldWrapper { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormJidSingleFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java index c86653bf..553e8f21 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormJidSingleFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java @@ -1,14 +1,14 @@ -package de.thedevstack.conversationsplus.ui.forms; +package eu.siacs.conversations.ui.forms; import android.content.Context; import android.text.InputType; import java.util.List; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.xmpp.forms.Field; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.R; +import eu.siacs.conversations.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class FormJidSingleFieldWrapper extends FormTextFieldWrapper { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormTextFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java index f825809c..b7dac951 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormTextFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.forms; +package eu.siacs.conversations.ui.forms; import android.content.Context; import android.text.Editable; @@ -10,8 +10,8 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.List; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.xmpp.forms.Field; +import eu.siacs.conversations.R; +import eu.siacs.conversations.xmpp.forms.Field; public class FormTextFieldWrapper extends FormFieldWrapper { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormWrapper.java index 8ff9efae..eafe95cc 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/forms/FormWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormWrapper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.forms; +package eu.siacs.conversations.ui.forms; import android.content.Context; import android.widget.LinearLayout; @@ -6,8 +6,8 @@ import android.widget.LinearLayout; import java.util.ArrayList; import java.util.List; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.forms.Field; public class FormWrapper { diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ConversationMoreMessagesLoadedListener.java b/src/main/java/eu/siacs/conversations/ui/listeners/ConversationMoreMessagesLoadedListener.java index 8e2909ad..08916206 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ConversationMoreMessagesLoadedListener.java +++ b/src/main/java/eu/siacs/conversations/ui/listeners/ConversationMoreMessagesLoadedListener.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.listeners; +package eu.siacs.conversations.ui.listeners; import android.view.View; import android.widget.ListView; @@ -8,12 +8,12 @@ import com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout; import java.util.List; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.ConversationActivity; -import de.thedevstack.conversationsplus.ui.ConversationFragment; -import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.ui.ConversationFragment; +import eu.siacs.conversations.ui.adapter.MessageAdapter; /** * This listener updates the UI when messages are loaded from the server. diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ConversationSwipeRefreshListener.java b/src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java index 6dc9f4a4..0cbde814 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ConversationSwipeRefreshListener.java +++ b/src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.ui.listeners; +package eu.siacs.conversations.ui.listeners; import android.widget.ListView; @@ -8,15 +8,15 @@ import com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayoutD import java.util.List; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.services.MessageArchiveService; -import de.thedevstack.conversationsplus.ui.ConversationActivity; -import de.thedevstack.conversationsplus.ui.ConversationFragment; -import de.thedevstack.conversationsplus.ui.adapter.MessageAdapter; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.MessageArchiveService; +import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.ui.ConversationFragment; +import eu.siacs.conversations.ui.adapter.MessageAdapter; /** * This listener starts loading messages from the server. diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/CryptoHelper.java b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java index 7e4a4fc5..1ef5fb3f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/CryptoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.os.Bundle; import android.util.Pair; @@ -21,11 +21,11 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public final class CryptoHelper { public static final String FILETRANSFER = "?FILETRANSFERv1:"; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java index a0fd9995..9caa53f7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/DNSHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.annotation.TargetApi; import android.content.Context; @@ -27,8 +27,8 @@ import de.measite.minidns.util.NameUtil; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.dto.SrvRecord; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.xmpp.jid.Jid; public class DNSHelper { private static final String CLIENT_SRV_PREFIX = "_xmpp-client._tcp."; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ExceptionHandler.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java index a810b089..4e3ec236 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ExceptionHandler.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.content.Context; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java index 913f2ab5..9c8db210 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ExceptionHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.app.AlertDialog; import android.content.Context; @@ -17,15 +17,15 @@ import java.util.List; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.ui.ConversationActivity; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.ConversationActivity; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class ExceptionHelper { public static void init(Context context) { diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ExifHelper.java b/src/main/java/eu/siacs/conversations/utils/ExifHelper.java index 031bdfa5..5e465e94 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ExifHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ExifHelper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import java.io.IOException; import java.io.InputStream; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java index ce289968..3633025f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/FileUtils.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.annotation.SuppressLint; import android.content.ContentResolver; @@ -13,10 +13,12 @@ import android.provider.MediaStore; import android.provider.OpenableColumns; import java.io.File; +import java.net.URL; import java.util.List; import de.thedevstack.conversationsplus.ConversationsPlusApplication; -import de.thedevstack.conversationsplus.entities.Transferable; + +import eu.siacs.conversations.entities.Transferable; public final class FileUtils { @@ -161,6 +163,14 @@ public final class FileUtils { return "com.android.providers.media.documents".equals(uri.getAuthority()); } + public static String getRelevantExtension(URL url) { + if (url == null) { + return null; + } + String path = url.getPath(); + return getRelevantExtension(path); + } + public static String getRelevantExtension(String path) { if (path == null || path.isEmpty()) { return null; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/GeoHelper.java b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java index 662f797a..74f91a98 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/GeoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.content.Intent; import android.net.Uri; @@ -9,8 +9,8 @@ import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; public class GeoHelper { private static Pattern GEO_URI = Pattern.compile("geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?(.*))?", Pattern.CASE_INSENSITIVE); diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/MimeUtils.java b/src/main/java/eu/siacs/conversations/utils/MimeUtils.java index fdf55d2d..d4544424 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/MimeUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/MimeUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import java.io.File; import java.io.FileInputStream; import java.io.IOException; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/OnPhoneContactsLoadedListener.java b/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java index eecee159..f18a4ed8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/OnPhoneContactsLoadedListener.java +++ b/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.os.Bundle; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/PRNGFixes.java b/src/main/java/eu/siacs/conversations/utils/PRNGFixes.java index 0751809c..5faa1fa7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/PRNGFixes.java +++ b/src/main/java/eu/siacs/conversations/utils/PRNGFixes.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.os.Build; import android.os.Process; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/PhoneHelper.java b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java index 86a67661..6c1b4bef 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/PhoneHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.Manifest; import android.content.Context; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/SSLSocketHelper.java b/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java index 1842e897..3a8c1c0a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/SSLSocketHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.os.Build; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/SerialSingleThreadExecutor.java b/src/main/java/eu/siacs/conversations/utils/SerialSingleThreadExecutor.java index 4871af43..bfb4668d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/SerialSingleThreadExecutor.java +++ b/src/main/java/eu/siacs/conversations/utils/SerialSingleThreadExecutor.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import java.util.ArrayDeque; import java.util.Queue; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/SocksSocketFactory.java b/src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java index 940399c3..04cfa2eb 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/SocksSocketFactory.java +++ b/src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java @@ -1,13 +1,14 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.nio.ByteBuffer; -import de.thedevstack.conversationsplus.Config; +import eu.siacs.conversations.Config; public class SocksSocketFactory { diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index f27aabb6..d9cdd34c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.content.Context; import android.text.format.DateFormat; @@ -13,13 +13,15 @@ import java.util.Date; import java.util.Locale; import de.thedevstack.conversationsplus.ConversationsPlusColors; -import de.thedevstack.conversationsplus.R; -import de.thedevstack.conversationsplus.entities.Contact; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Presence; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +import de.thedevstack.conversationsplus.entities.FileParams; +import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Contact; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.xmpp.jid.Jid; public class UIHelper { @@ -210,16 +212,26 @@ public class UIHelper { } else if (mime.startsWith("image/")) { return context.getString(R.string.image); } else if (mime.contains("pdf")) { - return context.getString(R.string.pdf_document) ; + return context.getString(R.string.pdf_document); } else if (mime.contains("application/vnd.android.package-archive")) { - return context.getString(R.string.apk) ; + return context.getString(R.string.apk); } else if (mime.contains("vcard")) { - return context.getString(R.string.vcard) ; + return context.getString(R.string.vcard); } else { - return message.getRelativeFilePath(); + String filename = getDisplayFilename(message); + if (null == filename) { + return context.getString(R.string.file); + } else { + return filename; + } } } + public static String getDisplayFilename(final Message message) { + String originalFilename = (null != message.getFileParams()) ? message.getFileParams().getOriginalFilename() : null; + return (null != originalFilename) ? originalFilename : message.getRelativeFilePath(); + } + public static String getMessageDisplayName(final Message message) { final Conversation conversation = message.getConversation(); if (message.getStatus() == Message.STATUS_RECEIVED) { @@ -280,7 +292,20 @@ public class UIHelper { return LOCATION_QUESTIONS.contains(body); } - public static String getHumanReadableFileSize(long filesize) { + public static String getHumanReadableFileSize(long size) { + String filesize; + if (size > (1.5 * 1024 * 1024)) { + filesize = size / (1024 * 1024)+ " MiB"; + } else if (size > 0) { + filesize = size / 1024 + " KiB"; + } else { + filesize = null; + } + + return filesize; + } + + public static String getHumanReadableDetailedFileSize(long filesize) { if (0 > filesize) { return "?"; } diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/XmlHelper.java b/src/main/java/eu/siacs/conversations/utils/XmlHelper.java index 1287f73f..4dee07cf 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/XmlHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/XmlHelper.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; public class XmlHelper { public static String encodeEntities(String content) { diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java b/src/main/java/eu/siacs/conversations/utils/Xmlns.java index 35adf6ec..ad30b3e6 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java +++ b/src/main/java/eu/siacs/conversations/utils/Xmlns.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; -import de.thedevstack.conversationsplus.Config; +import eu.siacs.conversations.Config; public final class Xmlns { public static final String BLOCKING = "urn:xmpp:blocking"; diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java index 5d3a2694..92c0241e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/XmppUri.java +++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java @@ -1,12 +1,12 @@ -package de.thedevstack.conversationsplus.utils; +package eu.siacs.conversations.utils; import android.net.Uri; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class XmppUri { diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/Element.java b/src/main/java/eu/siacs/conversations/xml/Element.java index 429f98db..9152c679 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xml/Element.java +++ b/src/main/java/eu/siacs/conversations/xml/Element.java @@ -1,14 +1,14 @@ -package de.thedevstack.conversationsplus.xml; +package eu.siacs.conversations.xml; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.utils.XmlHelper; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.XmlHelper; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; public class Element { private final String name; diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/Tag.java b/src/main/java/eu/siacs/conversations/xml/Tag.java index 84e37363..b9ef979f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xml/Tag.java +++ b/src/main/java/eu/siacs/conversations/xml/Tag.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.xml; +package eu.siacs.conversations.xml; import java.util.Hashtable; import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; -import de.thedevstack.conversationsplus.utils.XmlHelper; +import eu.siacs.conversations.utils.XmlHelper; public class Tag { public static final int NO = -1; diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/TagWriter.java b/src/main/java/eu/siacs/conversations/xml/TagWriter.java index c0f028af..f11c1846 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xml/TagWriter.java +++ b/src/main/java/eu/siacs/conversations/xml/TagWriter.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.xml; +package eu.siacs.conversations.xml; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.concurrent.LinkedBlockingQueue; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class TagWriter { diff --git a/src/main/java/de/thedevstack/conversationsplus/xml/XmlReader.java b/src/main/java/eu/siacs/conversations/xml/XmlReader.java index e02f4fc0..74e65fcd 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xml/XmlReader.java +++ b/src/main/java/eu/siacs/conversations/xml/XmlReader.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xml; +package eu.siacs.conversations.xml; import android.os.PowerManager; import android.os.PowerManager.WakeLock; @@ -12,7 +12,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; +import eu.siacs.conversations.Config; public class XmlReader { private XmlPullParser parser; diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnAdvancedStreamFeaturesLoaded.java b/src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java index 0692232c..e45eba73 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnAdvancedStreamFeaturesLoaded.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp; +package eu.siacs.conversations.xmpp; -import de.thedevstack.conversationsplus.entities.Account; +import eu.siacs.conversations.entities.Account; public interface OnAdvancedStreamFeaturesLoaded { public void onAdvancedStreamFeaturesAvailable(final Account account); diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java b/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java new file mode 100644 index 00000000..f09cf33d --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java @@ -0,0 +1,7 @@ +package eu.siacs.conversations.xmpp; + +import eu.siacs.conversations.entities.Account; + +public interface OnBindListener { + public void onBind(Account account); +} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnContactStatusChanged.java b/src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java index 009b33df..20b17f02 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnContactStatusChanged.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp; +package eu.siacs.conversations.xmpp; -import de.thedevstack.conversationsplus.entities.Contact; +import eu.siacs.conversations.entities.Contact; public interface OnContactStatusChanged { public void onContactStatusChanged(final Contact contact, final boolean online); diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnIqPacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/OnIqPacketReceived.java new file mode 100644 index 00000000..a4cff986 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/OnIqPacketReceived.java @@ -0,0 +1,8 @@ +package eu.siacs.conversations.xmpp; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + +public interface OnIqPacketReceived extends PacketReceived { + public void onIqPacketReceived(Account account, IqPacket packet); +} diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java b/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java new file mode 100644 index 00000000..e7fc582e --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java @@ -0,0 +1,7 @@ +package eu.siacs.conversations.xmpp; + +import eu.siacs.conversations.crypto.axolotl.AxolotlService; + +public interface OnKeyStatusUpdated { + public void onKeyStatusUpdated(AxolotlService.FetchStatus report); +} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessageAcknowledged.java b/src/main/java/eu/siacs/conversations/xmpp/OnMessageAcknowledged.java index 7cfa557d..5f670d93 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnMessageAcknowledged.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnMessageAcknowledged.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp; +package eu.siacs.conversations.xmpp; -import de.thedevstack.conversationsplus.entities.Account; +import eu.siacs.conversations.entities.Account; public interface OnMessageAcknowledged { public void onMessageAcknowledged(Account account, String id); diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java new file mode 100644 index 00000000..325e945f --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java @@ -0,0 +1,8 @@ +package eu.siacs.conversations.xmpp; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; + +public interface OnMessagePacketReceived extends PacketReceived { + public void onMessagePacketReceived(Account account, MessagePacket packet); +} diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java new file mode 100644 index 00000000..95c1acfc --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java @@ -0,0 +1,8 @@ +package eu.siacs.conversations.xmpp; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.stanzas.PresencePacket; + +public interface OnPresencePacketReceived extends PacketReceived { + public void onPresencePacketReceived(Account account, PresencePacket packet); +} diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java b/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java new file mode 100644 index 00000000..ad1d98cb --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java @@ -0,0 +1,7 @@ +package eu.siacs.conversations.xmpp; + +import eu.siacs.conversations.entities.Account; + +public interface OnStatusChanged { + public void onStatusChanged(Account account); +} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnUpdateBlocklist.java b/src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java index ea7b8c62..92e72cfa 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/OnUpdateBlocklist.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp; +package eu.siacs.conversations.xmpp; public interface OnUpdateBlocklist { // Use an enum instead of a boolean to make sure we don't run into the boolean trap diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/PacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java index 6274aaa2..d4502d73 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/PacketReceived.java +++ b/src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp; +package eu.siacs.conversations.xmpp; public abstract interface PacketReceived { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index c5a8fe3b..a5d0321d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp; +package eu.siacs.conversations.xmpp; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; import java.net.ConnectException; +import java.net.IDN; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; @@ -52,42 +53,43 @@ import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.dto.SrvRecord; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.XmppDomainVerifier; -import de.thedevstack.conversationsplus.crypto.sasl.DigestMd5; -import de.thedevstack.conversationsplus.crypto.sasl.External; -import de.thedevstack.conversationsplus.crypto.sasl.Plain; -import de.thedevstack.conversationsplus.crypto.sasl.SaslMechanism; -import de.thedevstack.conversationsplus.crypto.sasl.ScramSha1; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.ServiceDiscoveryResult; -import de.thedevstack.conversationsplus.generator.IqGenerator; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.DNSHelper; -import de.thedevstack.conversationsplus.utils.SSLSocketHelper; -import de.thedevstack.conversationsplus.utils.Xmlns; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xml.Tag; -import de.thedevstack.conversationsplus.xml.TagWriter; -import de.thedevstack.conversationsplus.xml.XmlReader; -import de.thedevstack.conversationsplus.xmpp.forms.Data; -import de.thedevstack.conversationsplus.xmpp.forms.Field; -import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.jingle.OnJinglePacketReceived; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.JinglePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractAcknowledgeableStanza; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.csi.ActivePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.csi.InactivePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt.AckPacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt.EnablePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt.RequestPacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt.ResumePacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.XmppDomainVerifier; +import eu.siacs.conversations.crypto.sasl.DigestMd5; +import eu.siacs.conversations.crypto.sasl.External; +import eu.siacs.conversations.crypto.sasl.Plain; +import eu.siacs.conversations.crypto.sasl.SaslMechanism; +import eu.siacs.conversations.crypto.sasl.ScramSha1; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.ServiceDiscoveryResult; +import eu.siacs.conversations.generator.IqGenerator; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.DNSHelper; +import eu.siacs.conversations.utils.SSLSocketHelper; +import eu.siacs.conversations.utils.SocksSocketFactory; +import eu.siacs.conversations.utils.Xmlns; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Tag; +import eu.siacs.conversations.xml.TagWriter; +import eu.siacs.conversations.xml.XmlReader; +import eu.siacs.conversations.xmpp.forms.Data; +import eu.siacs.conversations.xmpp.forms.Field; +import eu.siacs.conversations.xmpp.jid.InvalidJidException; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jingle.OnJinglePacketReceived; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import eu.siacs.conversations.xmpp.stanzas.AbstractAcknowledgeableStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; +import eu.siacs.conversations.xmpp.stanzas.PresencePacket; +import eu.siacs.conversations.xmpp.stanzas.csi.ActivePacket; +import eu.siacs.conversations.xmpp.stanzas.csi.InactivePacket; +import eu.siacs.conversations.xmpp.stanzas.streammgmt.AckPacket; +import eu.siacs.conversations.xmpp.stanzas.streammgmt.EnablePacket; +import eu.siacs.conversations.xmpp.stanzas.streammgmt.RequestPacket; +import eu.siacs.conversations.xmpp.stanzas.streammgmt.ResumePacket; public class XmppConnection implements Runnable { private static final int DEFAULT_PORT = 5222; diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/chatstate/ChatState.java b/src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java index 323d99c2..3e371562 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/chatstate/ChatState.java +++ b/src/main/java/eu/siacs/conversations/xmpp/chatstate/ChatState.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.chatstate; +package eu.siacs.conversations.xmpp.chatstate; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; public enum ChatState { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Data.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Data.java index caa1890e..8dabcb5b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Data.java +++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Data.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.xmpp.forms; +package eu.siacs.conversations.xmpp.forms; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; public class Data extends Element { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java index 88b3155c..020b34b9 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java +++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java @@ -1,11 +1,11 @@ -package de.thedevstack.conversationsplus.xmpp.forms; +package eu.siacs.conversations.xmpp.forms; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; public class Field extends Element { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jid/InvalidJidException.java b/src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java index 3c8dd717..164e8849 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jid/InvalidJidException.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jid; +package eu.siacs.conversations.xmpp.jid; public class InvalidJidException extends Exception { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jid/Jid.java b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java index bb32e821..a15abe14 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jid/Jid.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jid; +package eu.siacs.conversations.xmpp.jid; import android.util.LruCache; @@ -6,7 +6,7 @@ import net.java.otr4j.session.SessionID; import java.net.IDN; -import de.thedevstack.conversationsplus.Config; +import eu.siacs.conversations.Config; import gnu.inet.encoding.Stringprep; import gnu.inet.encoding.StringprepException; diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleCandidate.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java index bf282293..dcadb92f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleCandidate.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java @@ -1,10 +1,10 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; import java.util.ArrayList; import java.util.List; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; public class JingleCandidate { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index ca823926..fca0597f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -1,14 +1,11 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; -import android.content.Intent; -import android.net.Uri; import android.util.Pair; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -19,28 +16,29 @@ import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.StreamUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; -import de.thedevstack.conversationsplus.crypto.axolotl.OnMessageCreatedCallback; -import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlMessage; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.Conversation; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.entities.Message; -import de.thedevstack.conversationsplus.entities.Transferable; -import de.thedevstack.conversationsplus.entities.TransferablePlaceholder; -import de.thedevstack.conversationsplus.persistance.FileBackend; -import de.thedevstack.conversationsplus.services.AbstractConnectionManager; -import de.thedevstack.conversationsplus.services.XmppConnectionService; -import de.thedevstack.conversationsplus.utils.FileUtils; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.Content; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.JinglePacket; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.Reason; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.crypto.axolotl.OnMessageCreatedCallback; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.services.AbstractConnectionManager; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.FileUtils; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jingle.stanzas.Content; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import eu.siacs.conversations.xmpp.jingle.stanzas.Reason; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class JingleConnection implements Transferable { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 30ed9024..19ac354d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; import android.annotation.SuppressLint; @@ -9,19 +9,21 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import de.thedevstack.android.logcat.Logging; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.Account; -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; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.jingle.stanzas.JinglePacket; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.services.AbstractConnectionManager; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.Xmlns; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class JingleConnectionManager extends AbstractConnectionManager { private List<JingleConnection> connections = new CopyOnWriteArrayList<>(); diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleInbandTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java index 7c830d0b..3800b94f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleInbandTransport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; import android.util.Base64; @@ -11,14 +11,14 @@ import java.util.Arrays; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.utils.StreamUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class JingleInbandTransport extends JingleTransport { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleSocks5Transport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java index 6480251f..318a35f7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleSocks5Transport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; import android.os.PowerManager; @@ -16,10 +16,10 @@ import java.security.NoSuchAlgorithmException; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.utils.StreamUtil; -import de.thedevstack.conversationsplus.Config; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.utils.CryptoHelper; -import de.thedevstack.conversationsplus.utils.SocksSocketFactory; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.SocksSocketFactory; public class JingleSocks5Transport extends JingleTransport { private JingleCandidate candidate; diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleTransport.java index ee0fefff..e832d3f5 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleTransport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleTransport.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; -import de.thedevstack.conversationsplus.entities.DownloadableFile; +import eu.siacs.conversations.entities.DownloadableFile; public abstract class JingleTransport { public abstract void connect(final OnTransportConnected callback); diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnFileTransmissionStatusChanged.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnFileTransmissionStatusChanged.java index 762b4551..91cba39f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnFileTransmissionStatusChanged.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnFileTransmissionStatusChanged.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; -import de.thedevstack.conversationsplus.entities.DownloadableFile; +import eu.siacs.conversations.entities.DownloadableFile; public interface OnFileTransmissionStatusChanged { void onFileTransmitted(DownloadableFile file); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/OnJinglePacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnJinglePacketReceived.java new file mode 100644 index 00000000..9a60b392 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnJinglePacketReceived.java @@ -0,0 +1,9 @@ +package eu.siacs.conversations.xmpp.jingle; + +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xmpp.PacketReceived; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; + +public interface OnJinglePacketReceived extends PacketReceived { + void onJinglePacketReceived(Account account, JinglePacket packet); +} diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnPrimaryCandidateFound.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnPrimaryCandidateFound.java index 4fe31d3b..76e33717 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnPrimaryCandidateFound.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnPrimaryCandidateFound.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; public interface OnPrimaryCandidateFound { void onPrimaryCandidateFound(boolean success, JingleCandidate canditate); diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnTransportConnected.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java index 91a79a83..38f03c5d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/OnTransportConnected.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.jingle; +package eu.siacs.conversations.xmpp.jingle; public interface OnTransportConnected { public void failed(); diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/Content.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java index 336a8c14..f752cc5d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/Content.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java @@ -1,7 +1,7 @@ -package de.thedevstack.conversationsplus.xmpp.jingle.stanzas; +package eu.siacs.conversations.xmpp.jingle.stanzas; -import de.thedevstack.conversationsplus.entities.DownloadableFile; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.entities.DownloadableFile; +import eu.siacs.conversations.xml.Element; public class Content extends Element { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/JinglePacket.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java index db771a0a..4f73a83a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/JinglePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java @@ -1,8 +1,8 @@ -package de.thedevstack.conversationsplus.xmpp.jingle.stanzas; +package eu.siacs.conversations.xmpp.jingle.stanzas; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class JinglePacket extends IqPacket { Content content = null; diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/Reason.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java index a442d8d3..610d5e76 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/stanzas/Reason.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.jingle.stanzas; +package eu.siacs.conversations.xmpp.jingle.stanzas; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; public class Reason extends Element { private Reason(String name) { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/pep/Avatar.java b/src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java index 9c1c8b9c..38bb5c8f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/pep/Avatar.java +++ b/src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java @@ -1,9 +1,9 @@ -package de.thedevstack.conversationsplus.xmpp.pep; +package eu.siacs.conversations.xmpp.pep; import android.util.Base64; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; public class Avatar { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/AbstractAcknowledgeableStanza.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractAcknowledgeableStanza.java index 49d9f799..fa5e6fbd 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/AbstractAcknowledgeableStanza.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractAcknowledgeableStanza.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas; +package eu.siacs.conversations.xmpp.stanzas; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; abstract public class AbstractAcknowledgeableStanza extends AbstractStanza { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/AbstractStanza.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java index 78c71541..a6144df2 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/AbstractStanza.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java @@ -1,8 +1,8 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas; +package eu.siacs.conversations.xmpp.stanzas; -import de.thedevstack.conversationsplus.entities.Account; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.jid.Jid; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.jid.Jid; public class AbstractStanza extends Element { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/IqPacket.java index d86831e0..302dc78e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/IqPacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/IqPacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas; +package eu.siacs.conversations.xmpp.stanzas; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.xml.Element; public class IqPacket extends AbstractAcknowledgeableStanza { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/MessagePacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java index e14cdacd..941b4b5f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/MessagePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java @@ -1,9 +1,9 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas; +package eu.siacs.conversations.xmpp.stanzas; import android.util.Pair; -import de.thedevstack.conversationsplus.parser.AbstractParser; -import de.thedevstack.conversationsplus.xml.Element; +import eu.siacs.conversations.parser.AbstractParser; +import eu.siacs.conversations.xml.Element; public class MessagePacket extends AbstractAcknowledgeableStanza { public static final int TYPE_CHAT = 0; diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java index 5fd21b3b..c321498d 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java @@ -1,4 +1,4 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas; +package eu.siacs.conversations.xmpp.stanzas; public class PresencePacket extends AbstractAcknowledgeableStanza { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/csi/ActivePacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/csi/ActivePacket.java index 47538a64..78ab66d8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/csi/ActivePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/csi/ActivePacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas.csi; +package eu.siacs.conversations.xmpp.stanzas.csi; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class ActivePacket extends AbstractStanza { public ActivePacket() { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/csi/InactivePacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/csi/InactivePacket.java index ca5904a5..f109280f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/csi/InactivePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/csi/InactivePacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas.csi; +package eu.siacs.conversations.xmpp.stanzas.csi; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class InactivePacket extends AbstractStanza { public InactivePacket() { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/AckPacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java index fe1740da..f93b5d87 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/AckPacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt; +package eu.siacs.conversations.xmpp.stanzas.streammgmt; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class AckPacket extends AbstractStanza { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/EnablePacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java index ce416f27..78cd81ed 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/EnablePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt; +package eu.siacs.conversations.xmpp.stanzas.streammgmt; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class EnablePacket extends AbstractStanza { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/RequestPacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java index eb6217ae..98cfc748 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/RequestPacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt; +package eu.siacs.conversations.xmpp.stanzas.streammgmt; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class RequestPacket extends AbstractStanza { diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/ResumePacket.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java index 90bf566e..9cdcfa5e 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/streammgmt/ResumePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java @@ -1,6 +1,6 @@ -package de.thedevstack.conversationsplus.xmpp.stanzas.streammgmt; +package eu.siacs.conversations.xmpp.stanzas.streammgmt; -import de.thedevstack.conversationsplus.xmpp.stanzas.AbstractStanza; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public class ResumePacket extends AbstractStanza { |