Browse Source

renaming safeword into trustword

doc_update_sequoia
Volker Birk 7 years ago
parent
commit
128186c2d8
3 changed files with 36 additions and 36 deletions
  1. +16
    -16
      src/pEpEngine.c
  2. +18
    -18
      src/pEpEngine.h
  3. +2
    -2
      src/pEp_internal.h

+ 16
- 16
src/pEpEngine.c View File

@ -10,7 +10,7 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
PEP_STATUS status = PEP_STATUS_OK;
int int_result;
static const char *sql_log;
static const char *sql_safeword;
static const char *sql_trustword;
static const char *sql_get_identity;
static const char *sql_set_person;
static const char *sql_set_pgp_keypair;
@ -176,7 +176,7 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
" and pgp_keypair_fpr = identity.main_key_id"
" where address = ?1 ;";
sql_safeword = "select id, word from wordlist where lang = lower(?1) "
sql_trustword = "select id, word from wordlist where lang = lower(?1) "
"and id = ?2 ;";
sql_set_person = "insert or replace into person (id, username, lang) "
@ -199,8 +199,8 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
&_session->log, NULL);
assert(int_result == SQLITE_OK);
int_result = sqlite3_prepare_v2(_session->system_db, sql_safeword,
strlen(sql_safeword), &_session->safeword, NULL);
int_result = sqlite3_prepare_v2(_session->system_db, sql_trustword,
strlen(sql_trustword), &_session->trustword, NULL);
assert(int_result == SQLITE_OK);
int_result = sqlite3_prepare_v2(_session->db, sql_get_identity,
@ -269,8 +269,8 @@ DYNAMIC_API void release(PEP_SESSION session)
if (session) {
if (session->db) {
if (session->safeword)
sqlite3_finalize(session->safeword);
if (session->trustword)
sqlite3_finalize(session->trustword);
if (session->log)
sqlite3_finalize(session->log);
if (session->get_identity)
@ -336,7 +336,7 @@ DYNAMIC_API PEP_STATUS log_event(
return status;
}
DYNAMIC_API PEP_STATUS safeword(
DYNAMIC_API PEP_STATUS trustword(
PEP_SESSION session, uint16_t value, const char *lang,
char **word, size_t *wsize
)
@ -363,26 +363,26 @@ DYNAMIC_API PEP_STATUS safeword(
|| (lang[1] >= 'a' && lang[1] <= 'z'));
assert(lang[2] == 0);
sqlite3_reset(session->safeword);
sqlite3_bind_text(session->safeword, 1, lang, -1, SQLITE_STATIC);
sqlite3_bind_int(session->safeword, 2, value);
sqlite3_reset(session->trustword);
sqlite3_bind_text(session->trustword, 1, lang, -1, SQLITE_STATIC);
sqlite3_bind_int(session->trustword, 2, value);
result = sqlite3_step(session->safeword);
result = sqlite3_step(session->trustword);
if (result == SQLITE_ROW) {
*word = strdup((const char *) sqlite3_column_text(session->safeword,
*word = strdup((const char *) sqlite3_column_text(session->trustword,
1));
if (*word)
*wsize = sqlite3_column_bytes(session->safeword, 1);
*wsize = sqlite3_column_bytes(session->trustword, 1);
else
status = PEP_SAFEWORD_NOT_FOUND;
} else
status = PEP_SAFEWORD_NOT_FOUND;
sqlite3_reset(session->safeword);
sqlite3_reset(session->trustword);
return status;
}
DYNAMIC_API PEP_STATUS safewords(
DYNAMIC_API PEP_STATUS trustwords(
PEP_SESSION session, const char *fingerprint, const char *lang,
char **words, size_t *wsize, int max_words
)
@ -440,7 +440,7 @@ DYNAMIC_API PEP_STATUS safewords(
source++;
}
_status = safeword(session, value, lang, &word, &_wsize);
_status = trustword(session, value, lang, &word, &_wsize);
if (_status == PEP_OUT_OF_MEMORY) {
free(buffer);
return PEP_OUT_OF_MEMORY;


+ 18
- 18
src/pEpEngine.h View File

@ -217,49 +217,49 @@ DYNAMIC_API PEP_STATUS log_event(
);
// safeword() - get the corresponding safeword for a 16 bit value
// trustword() - get the corresponding trustword for a 16 bit value
//
// parameters:
// session (in) session handle
// value (in) value to find a safeword for
// value (in) value to find a trustword for
// lang (in) C string with ISO 3166-1 ALPHA-2 language code
// word (out) pointer to C string with safeword UTF-8 encoded
// NULL if language is not supported or safeword
// word (out) pointer to C string with trustword UTF-8 encoded
// NULL if language is not supported or trustword
// wordlist is damaged or unavailable
// wsize (out) length of safeword
// wsize (out) length of trustword
//
// return value:
// PEP_STATUS_OK safeword retrieved
// PEP_SAFEWORD_NOT_FOUND safeword not found
// PEP_STATUS_OK trustword retrieved
// PEP_SAFEWORD_NOT_FOUND trustword not found
//
// caveat:
// the word pointer goes to the ownership of the caller
// the caller is responsible to free() it (on Windoze use pEp_free())
DYNAMIC_API PEP_STATUS safeword(
DYNAMIC_API PEP_STATUS trustword(
PEP_SESSION session, uint16_t value, const char *lang,
char **word, size_t *wsize
);
// safewords() - get safewords for a string of hex values of a fingerprint
// trustwords() - get trustwords for a string of hex values of a fingerprint
//
// parameters:
// session (in) session handle
// fingerprint (in) C string with hex values to find safewords for
// fingerprint (in) C string with hex values to find trustwords for
// lang (in) C string with ISO 3166-1 ALPHA-2 language code
// words (out) pointer to C string with safewords UTF-8 encoded,
// words (out) pointer to C string with trustwords UTF-8 encoded,
// separated by a blank each
// NULL if language is not supported or safeword
// NULL if language is not supported or trustword
// wordlist is damaged or unavailable
// wsize (out) length of safewords string
// wsize (out) length of trustwords string
// max_words (in) only generate a string with max_words;
// if max_words == 0 there is no such limit
//
// return value:
// PEP_STATUS_OK safewords retrieved
// PEP_STATUS_OK trustwords retrieved
// PEP_OUT_OF_MEMORY out of memory
// PEP_SAFEWORD_NOT_FOUND at least one safeword not found
// PEP_SAFEWORD_NOT_FOUND at least one trustword not found
//
// caveat:
// the word pointer goes to the ownership of the caller
@ -267,11 +267,11 @@ DYNAMIC_API PEP_STATUS safeword(
//
// DON'T USE THIS FUNCTION FROM HIGH LEVEL LANGUAGES!
//
// Better implement a simple one in the adapter yourself using safeword(), and
// return a list of safewords.
// Better implement a simple one in the adapter yourself using trustword(), and
// return a list of trustwords.
// This function is provided for being used by C and C++ programs only.
DYNAMIC_API PEP_STATUS safewords(
DYNAMIC_API PEP_STATUS trustwords(
PEP_SESSION session, const char *fingerprint, const char *lang,
char **words, size_t *wsize, int max_words
);


+ 2
- 2
src/pEp_internal.h View File

@ -1,6 +1,6 @@
#define PEP_ENGINE_VERSION "0.5.0"
// this is 20 safewords with 79 chars max
// this is 20 trustwords with 79 chars max
#define MAX_SAFEWORDS_SPACE (20 * 80)
// XML parameters string
@ -77,7 +77,7 @@ typedef struct _pEpSession {
sqlite3 *system_db;
sqlite3_stmt *log;
sqlite3_stmt *safeword;
sqlite3_stmt *trustword;
sqlite3_stmt *get_identity;
sqlite3_stmt *set_person;
sqlite3_stmt *set_pgp_keypair;


Loading…
Cancel
Save