summaryrefslogtreecommitdiffstats
path: root/autocrypt
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-07-30 19:14:56 -0700
committerKevin McCarthy <kevin@8t8.us>2019-08-03 14:08:09 -0700
commit361156045e886b0aeba6920992aec4c20536d23c (patch)
tree04c2178a73ff243df8ae8c6d7516e928af5042ab /autocrypt
parent71e881a6d070a2d12ce688e256e953c9482819e8 (diff)
Convert peer_update to just pass the peer object.
Unlike get and insert, there is no need for an addres parameter that needs to be normalized, since the address is already in the peer object.
Diffstat (limited to 'autocrypt')
-rw-r--r--autocrypt/autocrypt.c4
-rw-r--r--autocrypt/autocrypt_db.c8
-rw-r--r--autocrypt/autocrypt_private.h2
3 files changed, 5 insertions, 9 deletions
diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c
index 73584650..82620035 100644
--- a/autocrypt/autocrypt.c
+++ b/autocrypt/autocrypt.c
@@ -308,7 +308,7 @@ int mutt_autocrypt_process_autocrypt_header (HEADER *hdr, ENVELOPE *env)
goto cleanup;
if (update_db &&
- mutt_autocrypt_db_peer_update (env->from, peer))
+ mutt_autocrypt_db_peer_update (peer))
goto cleanup;
if (insert_db_history)
@@ -440,7 +440,7 @@ int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *prot_headers)
goto cleanup;
if (update_db &&
- mutt_autocrypt_db_peer_update (peer_addr, peer))
+ mutt_autocrypt_db_peer_update (peer))
goto cleanup;
if (insert_db_history)
diff --git a/autocrypt/autocrypt_db.c b/autocrypt/autocrypt_db.c
index d8a397bd..7fad7068 100644
--- a/autocrypt/autocrypt_db.c
+++ b/autocrypt/autocrypt_db.c
@@ -476,12 +476,9 @@ cleanup:
return rv;
}
-int mutt_autocrypt_db_peer_update (ADDRESS *addr, AUTOCRYPT_PEER *peer)
+int mutt_autocrypt_db_peer_update (AUTOCRYPT_PEER *peer)
{
int rv = -1;
- ADDRESS *norm_addr = NULL;
-
- norm_addr = copy_normalize_addr (addr);
if (!PeerUpdateStmt)
{
@@ -546,7 +543,7 @@ int mutt_autocrypt_db_peer_update (ADDRESS *addr, AUTOCRYPT_PEER *peer)
goto cleanup;
if (sqlite3_bind_text (PeerUpdateStmt,
9,
- norm_addr->mailbox,
+ peer->email_addr,
-1,
SQLITE_STATIC) != SQLITE_OK)
goto cleanup;
@@ -557,7 +554,6 @@ int mutt_autocrypt_db_peer_update (ADDRESS *addr, AUTOCRYPT_PEER *peer)
rv = 0;
cleanup:
- rfc822_free_address (&norm_addr);
sqlite3_reset (PeerUpdateStmt);
return rv;
}
diff --git a/autocrypt/autocrypt_private.h b/autocrypt/autocrypt_private.h
index 3e370da6..1c8a038f 100644
--- a/autocrypt/autocrypt_private.h
+++ b/autocrypt/autocrypt_private.h
@@ -38,7 +38,7 @@ AUTOCRYPT_PEER *mutt_autocrypt_db_peer_new (void);
void mutt_autocrypt_db_peer_free (AUTOCRYPT_PEER **peer);
int mutt_autocrypt_db_peer_get (ADDRESS *addr, AUTOCRYPT_PEER **peer);
int mutt_autocrypt_db_peer_insert (ADDRESS *addr, AUTOCRYPT_PEER *peer);
-int mutt_autocrypt_db_peer_update (ADDRESS *addr, AUTOCRYPT_PEER *peer);
+int mutt_autocrypt_db_peer_update (AUTOCRYPT_PEER *peer);
AUTOCRYPT_PEER_HISTORY *mutt_autocrypt_db_peer_history_new (void);
void mutt_autocrypt_db_peer_history_free (AUTOCRYPT_PEER_HISTORY **peerhist);