renaming safeword into trustword
authorVolker Birk <vb@pep-project.org>
Fri, 01 May 2015 11:35:09 +0200
changeset 23326383354c776
parent 232 3d44d9bb18e5
child 234 6904a5742e86
renaming safeword into trustword
src/pEpEngine.c
src/pEpEngine.h
src/pEp_internal.h
     1.1 --- a/src/pEpEngine.c	Fri May 01 00:23:03 2015 +0200
     1.2 +++ b/src/pEpEngine.c	Fri May 01 11:35:09 2015 +0200
     1.3 @@ -10,7 +10,7 @@
     1.4      PEP_STATUS status = PEP_STATUS_OK;
     1.5  	int int_result;
     1.6  	static const char *sql_log;
     1.7 -	static const char *sql_safeword;
     1.8 +	static const char *sql_trustword;
     1.9  	static const char *sql_get_identity;
    1.10  	static const char *sql_set_person;
    1.11  	static const char *sql_set_pgp_keypair;
    1.12 @@ -176,7 +176,7 @@
    1.13                              "       and pgp_keypair_fpr = identity.main_key_id"
    1.14                              "   where address = ?1 ;";
    1.15  
    1.16 -        sql_safeword = "select id, word from wordlist where lang = lower(?1) "
    1.17 +        sql_trustword = "select id, word from wordlist where lang = lower(?1) "
    1.18                         "and id = ?2 ;";
    1.19  
    1.20          sql_set_person = "insert or replace into person (id, username, lang) "
    1.21 @@ -199,8 +199,8 @@
    1.22              &_session->log, NULL);
    1.23  	assert(int_result == SQLITE_OK);
    1.24  
    1.25 -    int_result = sqlite3_prepare_v2(_session->system_db, sql_safeword,
    1.26 -            strlen(sql_safeword), &_session->safeword, NULL);
    1.27 +    int_result = sqlite3_prepare_v2(_session->system_db, sql_trustword,
    1.28 +            strlen(sql_trustword), &_session->trustword, NULL);
    1.29  	assert(int_result == SQLITE_OK);
    1.30  
    1.31      int_result = sqlite3_prepare_v2(_session->db, sql_get_identity,
    1.32 @@ -269,8 +269,8 @@
    1.33  
    1.34  	if (session) {
    1.35  		if (session->db) {
    1.36 -            if (session->safeword)
    1.37 -                sqlite3_finalize(session->safeword);
    1.38 +            if (session->trustword)
    1.39 +                sqlite3_finalize(session->trustword);
    1.40              if (session->log)
    1.41                  sqlite3_finalize(session->log);
    1.42              if (session->get_identity)
    1.43 @@ -336,7 +336,7 @@
    1.44  	return status;
    1.45  }
    1.46  
    1.47 -DYNAMIC_API PEP_STATUS safeword(
    1.48 +DYNAMIC_API PEP_STATUS trustword(
    1.49              PEP_SESSION session, uint16_t value, const char *lang,
    1.50              char **word, size_t *wsize
    1.51          )
    1.52 @@ -363,26 +363,26 @@
    1.53              || (lang[1] >= 'a' && lang[1] <= 'z'));
    1.54  	assert(lang[2] == 0);
    1.55  
    1.56 -	sqlite3_reset(session->safeword);
    1.57 -    sqlite3_bind_text(session->safeword, 1, lang, -1, SQLITE_STATIC);
    1.58 -	sqlite3_bind_int(session->safeword, 2, value);
    1.59 +	sqlite3_reset(session->trustword);
    1.60 +    sqlite3_bind_text(session->trustword, 1, lang, -1, SQLITE_STATIC);
    1.61 +	sqlite3_bind_int(session->trustword, 2, value);
    1.62  
    1.63 -	result = sqlite3_step(session->safeword);
    1.64 +	result = sqlite3_step(session->trustword);
    1.65  	if (result == SQLITE_ROW) {
    1.66 -        *word = strdup((const char *) sqlite3_column_text(session->safeword,
    1.67 +        *word = strdup((const char *) sqlite3_column_text(session->trustword,
    1.68                      1));
    1.69  		if (*word)
    1.70 -            *wsize = sqlite3_column_bytes(session->safeword, 1);
    1.71 +            *wsize = sqlite3_column_bytes(session->trustword, 1);
    1.72  		else
    1.73  			status = PEP_SAFEWORD_NOT_FOUND;
    1.74  	} else
    1.75  		status = PEP_SAFEWORD_NOT_FOUND;
    1.76  
    1.77 -	sqlite3_reset(session->safeword);
    1.78 +	sqlite3_reset(session->trustword);
    1.79  	return status;
    1.80  }
    1.81  
    1.82 -DYNAMIC_API PEP_STATUS safewords(
    1.83 +DYNAMIC_API PEP_STATUS trustwords(
    1.84          PEP_SESSION session, const char *fingerprint, const char *lang,
    1.85          char **words, size_t *wsize, int max_words
    1.86      )
    1.87 @@ -440,7 +440,7 @@
    1.88  			source++;
    1.89  		}
    1.90  
    1.91 -		_status = safeword(session, value, lang, &word, &_wsize);
    1.92 +		_status = trustword(session, value, lang, &word, &_wsize);
    1.93          if (_status == PEP_OUT_OF_MEMORY) {
    1.94              free(buffer);
    1.95              return PEP_OUT_OF_MEMORY;
     2.1 --- a/src/pEpEngine.h	Fri May 01 00:23:03 2015 +0200
     2.2 +++ b/src/pEpEngine.h	Fri May 01 11:35:09 2015 +0200
     2.3 @@ -217,49 +217,49 @@
     2.4      );
     2.5  
     2.6  
     2.7 -// safeword() - get the corresponding safeword for a 16 bit value
     2.8 +// trustword() - get the corresponding trustword for a 16 bit value
     2.9  //
    2.10  //	parameters:
    2.11  //		session (in)		    session handle
    2.12 -//		value (in)			    value to find a safeword for
    2.13 +//		value (in)			    value to find a trustword for
    2.14  //		lang (in)			    C string with ISO 3166-1 ALPHA-2 language code
    2.15 -//		word (out)			    pointer to C string with safeword UTF-8 encoded
    2.16 -//							    NULL if language is not supported or safeword
    2.17 +//		word (out)			    pointer to C string with trustword UTF-8 encoded
    2.18 +//							    NULL if language is not supported or trustword
    2.19  //							    wordlist is damaged or unavailable
    2.20 -//		wsize (out)			    length of safeword
    2.21 +//		wsize (out)			    length of trustword
    2.22  //
    2.23  //	return value:
    2.24 -//	    PEP_STATUS_OK           safeword retrieved
    2.25 -//	    PEP_SAFEWORD_NOT_FOUND  safeword not found
    2.26 +//	    PEP_STATUS_OK           trustword retrieved
    2.27 +//	    PEP_SAFEWORD_NOT_FOUND  trustword not found
    2.28  //
    2.29  //	caveat:
    2.30  //		the word pointer goes to the ownership of the caller
    2.31  //      the caller is responsible to free() it (on Windoze use pEp_free())
    2.32  
    2.33 -DYNAMIC_API PEP_STATUS safeword(
    2.34 +DYNAMIC_API PEP_STATUS trustword(
    2.35              PEP_SESSION session, uint16_t value, const char *lang,
    2.36              char **word, size_t *wsize
    2.37          );
    2.38  
    2.39  
    2.40 -// safewords() - get safewords for a string of hex values of a fingerprint
    2.41 +// trustwords() - get trustwords for a string of hex values of a fingerprint
    2.42  //
    2.43  //	parameters:
    2.44  //		session (in)		session handle
    2.45 -//		fingerprint (in)	C string with hex values to find safewords for
    2.46 +//		fingerprint (in)	C string with hex values to find trustwords for
    2.47  //		lang (in)			C string with ISO 3166-1 ALPHA-2 language code
    2.48 -//		words (out)			pointer to C string with safewords UTF-8 encoded,
    2.49 +//		words (out)			pointer to C string with trustwords UTF-8 encoded,
    2.50  //		                    separated by a blank each
    2.51 -//							NULL if language is not supported or safeword
    2.52 +//							NULL if language is not supported or trustword
    2.53  //							wordlist is damaged or unavailable
    2.54 -//		wsize (out)			length of safewords string
    2.55 +//		wsize (out)			length of trustwords string
    2.56  //		max_words (in)		only generate a string with max_words;
    2.57  //							if max_words == 0 there is no such limit
    2.58  //
    2.59  //	return value:
    2.60 -//	    PEP_STATUS_OK           safewords retrieved
    2.61 +//	    PEP_STATUS_OK           trustwords retrieved
    2.62  //      PEP_OUT_OF_MEMORY       out of memory
    2.63 -//	    PEP_SAFEWORD_NOT_FOUND  at least one safeword not found
    2.64 +//	    PEP_SAFEWORD_NOT_FOUND  at least one trustword not found
    2.65  //
    2.66  //	caveat:
    2.67  //		the word pointer goes to the ownership of the caller
    2.68 @@ -267,11 +267,11 @@
    2.69  //
    2.70  //  DON'T USE THIS FUNCTION FROM HIGH LEVEL LANGUAGES!
    2.71  //
    2.72 -//  Better implement a simple one in the adapter yourself using safeword(), and
    2.73 -//  return a list of safewords.
    2.74 +//  Better implement a simple one in the adapter yourself using trustword(), and
    2.75 +//  return a list of trustwords.
    2.76  //  This function is provided for being used by C and C++ programs only.
    2.77  
    2.78 -DYNAMIC_API PEP_STATUS safewords(
    2.79 +DYNAMIC_API PEP_STATUS trustwords(
    2.80          PEP_SESSION session, const char *fingerprint, const char *lang,
    2.81          char **words, size_t *wsize, int max_words
    2.82      );
     3.1 --- a/src/pEp_internal.h	Fri May 01 00:23:03 2015 +0200
     3.2 +++ b/src/pEp_internal.h	Fri May 01 11:35:09 2015 +0200
     3.3 @@ -1,6 +1,6 @@
     3.4  #define PEP_ENGINE_VERSION "0.5.0"
     3.5  
     3.6 -// this is 20 safewords with 79 chars max
     3.7 +// this is 20 trustwords with 79 chars max
     3.8  #define MAX_SAFEWORDS_SPACE (20 * 80)
     3.9  
    3.10  // XML parameters string
    3.11 @@ -77,7 +77,7 @@
    3.12      sqlite3 *system_db;
    3.13  
    3.14      sqlite3_stmt *log;
    3.15 -    sqlite3_stmt *safeword;
    3.16 +    sqlite3_stmt *trustword;
    3.17      sqlite3_stmt *get_identity;
    3.18      sqlite3_stmt *set_person;
    3.19      sqlite3_stmt *set_pgp_keypair;