Update initInboundSessionWithAccountFrom() return code:

- return code is a basic error code (0 OK, -1  KO)
Remove TODO comments
This commit is contained in:
pedroGitt 2016-11-08 11:25:10 +01:00
parent 1fd908c72a
commit d944d5fad7

View file

@ -267,21 +267,18 @@ public class OlmSession extends CommonSerializeUtils implements Serializable {
* @param aAccount the account to associate with this session * @param aAccount the account to associate with this session
* @param aTheirIdentityKey the sender identity key * @param aTheirIdentityKey the sender identity key
* @param aPreKeyMsg PRE KEY message * @param aPreKeyMsg PRE KEY message
* @return this if operation succeed, null otherwise * @return 0 if operation succeed, -1 otherwise
* TODO unit test missing: initInboundSessionWithAccountFrom
*/ */
public OlmSession initInboundSessionWithAccountFrom(OlmAccount aAccount, String aTheirIdentityKey, String aPreKeyMsg) { public int initInboundSessionWithAccountFrom(OlmAccount aAccount, String aTheirIdentityKey, String aPreKeyMsg) {
OlmSession retObj=null; int retCode=-1;
if((null==aAccount) || TextUtils.isEmpty(aPreKeyMsg)){ if((null==aAccount) || TextUtils.isEmpty(aPreKeyMsg)){
Log.e(LOG_TAG, "## initInboundSessionWithAccount(): invalid input parameters"); Log.e(LOG_TAG, "## initInboundSessionWithAccount(): invalid input parameters");
} else { } else {
if(0 == initInboundSessionFromIdKeyJni(aAccount.getOlmAccountId(), aTheirIdentityKey, aPreKeyMsg)){ retCode = initInboundSessionFromIdKeyJni(aAccount.getOlmAccountId(), aTheirIdentityKey, aPreKeyMsg);
retObj = this;
}
} }
return retObj; return retCode;
} }
private native int initInboundSessionFromIdKeyJni(long aOlmAccountId, String aTheirIdentityKey, String aOneTimeKeyMsg); private native int initInboundSessionFromIdKeyJni(long aOlmAccountId, String aTheirIdentityKey, String aOneTimeKeyMsg);
@ -305,7 +302,6 @@ public class OlmSession extends CommonSerializeUtils implements Serializable {
* Public API for {@link #matchesInboundSessionJni(String)}. * Public API for {@link #matchesInboundSessionJni(String)}.
* @param aOneTimeKeyMsg PRE KEY message * @param aOneTimeKeyMsg PRE KEY message
* @return this if operation succeed, null otherwise * @return this if operation succeed, null otherwise
* TODO unit test missing: matchesInboundSession
*/ */
public boolean matchesInboundSession(String aOneTimeKeyMsg) { public boolean matchesInboundSession(String aOneTimeKeyMsg) {
boolean retCode = false; boolean retCode = false;
@ -326,7 +322,6 @@ public class OlmSession extends CommonSerializeUtils implements Serializable {
* @param aTheirIdentityKey the sender identity key * @param aTheirIdentityKey the sender identity key
* @param aOneTimeKeyMsg PRE KEY message * @param aOneTimeKeyMsg PRE KEY message
* @return this if operation succeed, null otherwise * @return this if operation succeed, null otherwise
* TODO unit test missing: matchesInboundSessionFrom
*/ */
public boolean matchesInboundSessionFrom(String aTheirIdentityKey, String aOneTimeKeyMsg) { public boolean matchesInboundSessionFrom(String aTheirIdentityKey, String aOneTimeKeyMsg) {
boolean retCode = false; boolean retCode = false;