src/keymanagement.c
branchENGINE-289
changeset 2288 8aee10631677
parent 2265 73c0738de68c
child 2301 62ed2fc84b3a
     1.1 --- a/src/keymanagement.c	Mon Nov 20 16:04:50 2017 +0100
     1.2 +++ b/src/keymanagement.c	Mon Nov 20 17:44:50 2017 +0100
     1.3 @@ -12,6 +12,7 @@
     1.4  #include "pEp_internal.h"
     1.5  #include "keymanagement.h"
     1.6  
     1.7 +#include "sync_fsm.h"
     1.8  #include "blacklist.h"
     1.9  
    1.10  #ifndef EMPTYSTR
    1.11 @@ -92,7 +93,9 @@
    1.12      if (!(session && identity && !EMPTYSTR(identity->address)))
    1.13          return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
    1.14  
    1.15 +    // dunno if we should keep this function shortcut.
    1.16      if (_identity_me(identity)) {
    1.17 +        identity->me = true;
    1.18          return _myself(session, identity, false, true);
    1.19      }
    1.20  
    1.21 @@ -279,7 +282,7 @@
    1.22  
    1.23          if (EMPTYSTR(temp_id->username)) { // mitigate
    1.24              free(temp_id->username);
    1.25 -            temp_id->username = strdup("anonymous");
    1.26 +            temp_id->username = strdup("Anonymous");
    1.27              assert(temp_id->username);
    1.28              if (temp_id->username == NULL){
    1.29                  status = PEP_OUT_OF_MEMORY;
    1.30 @@ -312,11 +315,12 @@
    1.31      free(identity->user_id);
    1.32      identity->user_id = strdup(temp_id->user_id);
    1.33      free(identity->username);
    1.34 -    identity->username = strdup(temp_id->username ? temp_id->username : "anonymous");
    1.35 +    identity->username = strdup(temp_id->username ? temp_id->username : "Anonymous");
    1.36      identity->comm_type = temp_id->comm_type;
    1.37      identity->lang[0] = temp_id->lang[0];
    1.38      identity->lang[1] = temp_id->lang[1];
    1.39      identity->lang[2] = 0;
    1.40 +    identity->me = temp_id->me;
    1.41      identity->flags = temp_id->flags;
    1.42  
    1.43  exit_free :
    1.44 @@ -434,6 +438,7 @@
    1.45          return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
    1.46  
    1.47      identity->comm_type = PEP_ct_pEp;
    1.48 +    identity->me = true;
    1.49      if(ignore_flags)
    1.50          identity->flags = 0;
    1.51      
    1.52 @@ -837,6 +842,7 @@
    1.53          case SQLITE_ROW:
    1.54              count = sqlite3_column_int(session->own_key_is_listed, 0);
    1.55              *listed = count > 0;
    1.56 +            status = PEP_STATUS_OK;
    1.57              break;
    1.58              
    1.59          default:
    1.60 @@ -904,6 +910,7 @@
    1.61                      ident->lang[1] = lang[1];
    1.62                      ident->lang[2] = 0;
    1.63                  }
    1.64 +                ident->me = true;
    1.65                  ident->flags = flags;
    1.66  
    1.67                  _bl = identity_list_add(_bl, ident);