]> granicus.if.org Git - mutt/commitdiff
Convert peer_update to just pass the peer object.
authorKevin McCarthy <kevin@8t8.us>
Wed, 31 Jul 2019 02:14:56 +0000 (19:14 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 3 Aug 2019 21:08:09 +0000 (14:08 -0700)
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.

autocrypt/autocrypt.c
autocrypt/autocrypt_db.c
autocrypt/autocrypt_private.h

index 73584650ce902f64b63537c1f4d46cda7b0bb629..826200355a74b172acba09e82d1ef2a756a4b2db 100644 (file)
@@ -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)
index d8a397bd726637830312c6b840ced4615fa5af23..7fad7068db897da49f1adccc6f83063800b45a01 100644 (file)
@@ -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;
 }
index 3e370da6236e56d36e590f7eaf0e202eb3625b4f..1c8a038f3a4299567f4d5de1fde2f7141d2fc575 100644 (file)
@@ -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);