adding flags to get_identity and set_identity
authorVolker Birk <vb@pep-project.org>
Wed, 27 Jul 2016 12:51:19 +0200
changeset 929b094dd6bb553
parent 928 c87f1fdaff36
child 930 c201a657e628
adding flags to get_identity and set_identity
src/pEpEngine.c
     1.1 --- a/src/pEpEngine.c	Wed Jul 27 12:35:51 2016 +0200
     1.2 +++ b/src/pEpEngine.c	Wed Jul 27 12:51:19 2016 +0200
     1.3 @@ -270,7 +270,7 @@
     1.4          sql_log = "insert into log (title, entity, description, comment)"
     1.5                    "values (?1, ?2, ?3, ?4);";
     1.6  
     1.7 -        sql_get_identity =  "select fpr, username, comm_type, lang"
     1.8 +        sql_get_identity =  "select fpr, username, comm_type, lang, flags"
     1.9                              "   from identity"
    1.10                              "   join person on id = identity.user_id"
    1.11                              "   join pgp_keypair on fpr = identity.main_key_id"
    1.12 @@ -292,7 +292,8 @@
    1.13                                "values (upper(replace(?1,' ',''))) ;";
    1.14  
    1.15          sql_set_identity = "insert or replace into identity (address, main_key_id, "
    1.16 -                           "user_id) values (?1, upper(replace(?2,' ','')), ?3) ;";
    1.17 +                           "user_id, flags) values (?1, upper(replace(?2,' ','')),"
    1.18 +                           "?3, ?4) ;";
    1.19  
    1.20          sql_set_trust = "insert or replace into trust (user_id, pgp_keypair_fpr, comm_type) "
    1.21                          "values (?1, upper(replace(?2,' ','')), ?3) ;";
    1.22 @@ -877,6 +878,7 @@
    1.23              _identity->lang[1] = _lang[1];
    1.24              _identity->lang[2] = 0;
    1.25          }
    1.26 +        _identity->flags = (unsigned int) sqlite3_column_int(session->get_identity, 4);
    1.27          *identity = _identity;
    1.28          break;
    1.29      default:
    1.30 @@ -952,6 +954,7 @@
    1.31              SQLITE_STATIC);
    1.32      sqlite3_bind_text(session->set_identity, 3, identity->user_id, -1,
    1.33              SQLITE_STATIC);
    1.34 +    sqlite3_bind_int(session->set_trust, 4, identity->flags);
    1.35      result = sqlite3_step(session->set_identity);
    1.36      sqlite3_reset(session->set_identity);
    1.37      if (result != SQLITE_DONE) {