working on trustwords dialog for KeySync
authorVolker Birk <vb@pep-project.org>
Sat, 16 Jul 2016 09:15:33 +0200
changeset 884d64d366512a0
parent 883 096ff09932ad
child 885 ca89e40342d4
working on trustwords dialog for KeySync
src/pEpEngine.h
src/sync_actions.c
     1.1 --- a/src/pEpEngine.h	Thu Jul 14 13:33:24 2016 +0200
     1.2 +++ b/src/pEpEngine.h	Sat Jul 16 09:15:33 2016 +0200
     1.3 @@ -71,6 +71,8 @@
     1.4      PEP_CONTRAINTS_VIOLATED                         = 0x0802,
     1.5      PEP_CANNOT_ENCODE                               = 0x0803,
     1.6  
     1.7 +    PEP_SYNC_NO_TRUSTWORDS_CALLBACK                 = 0x0901,
     1.8 +
     1.9      PEP_COMMIT_FAILED                               = 0xff01,
    1.10  
    1.11      PEP_CANNOT_CREATE_TEMP_FILE                     = -5,
     2.1 --- a/src/sync_actions.c	Thu Jul 14 13:33:24 2016 +0200
     2.2 +++ b/src/sync_actions.c	Sat Jul 16 09:15:33 2016 +0200
     2.3 @@ -2,12 +2,11 @@
     2.4  
     2.5  #include <assert.h>
     2.6  #include "pEp_internal.h"
     2.7 -#include "keymanagement.h"
     2.8  #include "message.h"
     2.9  #include "sync_fsm.h"
    2.10  
    2.11  
    2.12 -// showHandshake() - 
    2.13 +// showHandshake() - trigger the handshake dialog of the application
    2.14  //
    2.15  //  params:
    2.16  //      session (in)        session handle
    2.17 @@ -24,21 +23,30 @@
    2.18      )
    2.19  {
    2.20      PEP_STATUS status = PEP_STATUS_OK;
    2.21 -
    2.22      assert(session);
    2.23      assert(partner);
    2.24 +    assert(session->showHandshake);
    2.25      if (!(session && partner))
    2.26          return PEP_ILLEGAL_VALUE;
    2.27 +    if (!session->showHandshake)
    2.28 +        return PEP_SYNC_NO_TRUSTWORDS_CALLBACK;
    2.29  
    2.30 -    // working code
    2.31 +    pEp_identity *me = NULL;
    2.32 +    status = get_identity(session, partner->address, PEP_OWN_USERID, &me);
    2.33 +    if (status != PEP_STATUS_OK)
    2.34 +        goto error;
    2.35 +    
    2.36 +    status = session->showHandshake(session, me, partner);
    2.37 +    if (status != PEP_STATUS_OK)
    2.38 +        goto error;
    2.39  
    2.40 -
    2.41 +    free_identity(me);
    2.42      return status;
    2.43  
    2.44  enomem:
    2.45      status = PEP_OUT_OF_MEMORY;
    2.46  error:
    2.47 -    // free...
    2.48 +    free_identity(me);
    2.49      return status;
    2.50  }
    2.51