001/** 002 * 003 * Copyright 2017 Paul Schaub 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.omemo.listener; 018 019import org.jivesoftware.smack.packet.Message; 020 021import org.jivesoftware.smackx.omemo.internal.CipherAndAuthTag; 022import org.jivesoftware.smackx.omemo.internal.OmemoMessageInformation; 023 024/** 025 * Listener interface that allows implementations to receive decrypted OMEMO messages. 026 * 027 * @author Paul Schaub 028 */ 029public interface OmemoMessageListener { 030 /** 031 * Gets called, whenever an OmemoMessage has been received and was successfully decrypted. 032 * 033 * @param decryptedBody Decrypted body 034 * @param encryptedMessage Encrypted Message 035 * @param wrappingMessage Wrapping carbon message, in case the message was a carbon copy, else null. 036 * @param omemoInformation Information about the messages encryption etc. 037 */ 038 void onOmemoMessageReceived(String decryptedBody, Message encryptedMessage, Message wrappingMessage, OmemoMessageInformation omemoInformation); 039 040 /** 041 * Gets called, whenever an OmemoElement without a body (an OmemoKeyTransportElement) is received. 042 * 043 * @param cipherAndAuthTag transported Cipher along with an optional AuthTag 044 * @param message Message that contained the KeyTransport 045 * @param wrappingMessage Wrapping message (eg. carbon), or null 046 * @param omemoInformation Information about the messages encryption etc. 047 */ 048 void onOmemoKeyTransportReceived(CipherAndAuthTag cipherAndAuthTag, Message message, Message wrappingMessage, OmemoMessageInformation omemoInformation); 049}