]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added mail_guid_128_to_string(). Used it in several places.
authorTimo Sirainen <tss@iki.fi>
Thu, 18 Feb 2010 06:20:22 +0000 (08:20 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 18 Feb 2010 06:20:22 +0000 (08:20 +0200)
--HG--
branch : HEAD

src/dsync/dsync-data.c
src/dsync/dsync-proxy.c
src/dsync/dsync-worker-local.c
src/dsync/test-dsync-common.c
src/imap/imap-status.c
src/lib-storage/mail-storage.h
src/lib-storage/mail.c

index 02648e121d2cb33f06d6c241f8e662338ed5f0f3..19f70cd674f04df531d761dd06dee4b62fa4300e 100644 (file)
@@ -107,7 +107,7 @@ int dsync_guid_cmp(const mailbox_guid_t *guid1, const mailbox_guid_t *guid2)
 
 const char *dsync_guid_to_str(const mailbox_guid_t *guid)
 {
-       return binary_to_hex(guid->guid, sizeof(guid->guid));
+       return mail_guid_128_to_string(guid->guid);
 }
 
 const char *dsync_get_guid_128_str(const char *guid, unsigned char *dest,
index caf400810c3f14840b590bb641a2d864c257cfd4..dd6da9863dbe682004524c06a905a57a08e1e8c5 100644 (file)
@@ -275,7 +275,7 @@ int dsync_proxy_mailbox_import(pool_t pool, const char *str,
 void dsync_proxy_mailbox_guid_export(string_t *str,
                                     const mailbox_guid_t *mailbox)
 {
-       str_append(str, binary_to_hex(mailbox->guid, sizeof(mailbox->guid)));
+       str_append(str, dsync_guid_to_str(mailbox));
 }
 
 int dsync_proxy_mailbox_guid_import(const char *str, mailbox_guid_t *guid_r)
index e4afc0d3bd39e7941fa48de0428a083d4a8d73fa..f120b58eecc86ed99e51abfd2247cb9ecaa375ea 100644 (file)
@@ -702,7 +702,7 @@ static int local_mailbox_open(struct local_dsync_worker *worker,
        lbox = hash_table_lookup(worker->mailbox_hash, guid);
        if (lbox == NULL) {
                i_error("Trying to open a non-listed mailbox with guid=%s",
-                       binary_to_hex(guid->guid, sizeof(guid->guid)));
+                       dsync_guid_to_str(guid));
                return -1;
        }
 
@@ -720,7 +720,7 @@ static int local_mailbox_open(struct local_dsync_worker *worker,
        if (memcmp(mailbox_guid, guid->guid, sizeof(guid->guid)) != 0) {
                i_error("Mailbox %s changed its GUID (%s -> %s)",
                        lbox->storage_name, dsync_guid_to_str(guid),
-                       binary_to_hex(mailbox_guid, sizeof(mailbox_guid)));
+                       mail_guid_128_to_string(mailbox_guid));
                mailbox_free(&box);
                return -1;
        }
index 8db63db362f7cb36ae3857742737e894e6fc7934..e3c831a00cc739efe354ad49d80176aabb4fbba3 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "array.h"
+#include "hex-binary.h"
 #include "sha1.h"
 #include "dsync-data.h"
 #include "test-dsync-common.h"
@@ -83,3 +84,8 @@ bool mail_guid_128_is_empty(const uint8_t guid_128[MAIL_GUID_128_SIZE])
 
        return memcmp(empty_guid, guid_128, sizeof(empty_guid)) == 0;
 }
+
+const char *mail_guid_128_to_string(const uint8_t guid_128[MAIL_GUID_128_SIZE])
+{
+       return binary_to_hex(guid_128, MAIL_GUID_128_SIZE);
+}
index 496ce037f6809f3ae53d63a48774d310fd11b85d..3f41623868251dfc81f56fb27ef43f6d83c25a3e 100644 (file)
@@ -123,8 +123,7 @@ void imap_status_send(struct client *client, const char *mailbox,
        }
        if (items->guid) {
                str_printfa(str, "X-GUID %s ",
-                           binary_to_hex(result->mailbox_guid,
-                                         sizeof(result->mailbox_guid)));
+                           mail_guid_128_to_string(result->mailbox_guid));
        }
 
        if (items != 0)
index 646f45eedc8d6295e67d3d1bd6892509292c01a4..dbc14b5eb324cc3f539fa3663c183686b324dccb 100644 (file)
@@ -689,5 +689,7 @@ void mail_generate_guid_128_hash(const char *guid,
                                 uint8_t guid_128[MAIL_GUID_128_SIZE]);
 /* Returns TRUE if GUID is empty (not set / unknown). */
 bool mail_guid_128_is_empty(const uint8_t guid_128[MAIL_GUID_128_SIZE]);
+/* Returns GUID as a hex string. */
+const char *mail_guid_128_to_string(const uint8_t guid_128[MAIL_GUID_128_SIZE]);
 
 #endif
index c441a2a5f7bf0a131c77384131e05ccb8317feb6..05e02a970d83f95dfaca6aded13096bd40e65143 100644 (file)
@@ -334,3 +334,8 @@ bool mail_guid_128_is_empty(const uint8_t guid_128[MAIL_GUID_128_SIZE])
        }
        return TRUE;
 }
+
+const char *mail_guid_128_to_string(const uint8_t guid_128[MAIL_GUID_128_SIZE])
+{
+       return binary_to_hex(guid_128, MAIL_GUID_128_SIZE);
+}