Mercurial > dovecot > core-2.2
changeset 10751:5ec28d7a5d13 HEAD
Added mail_guid_128_to_string(). Used it in several places.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 18 Feb 2010 08:20:22 +0200 |
parents | 6936dbe28947 |
children | 6aa76d89195d |
files | 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 |
diffstat | 7 files changed, 18 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dsync/dsync-data.c Thu Feb 18 07:51:44 2010 +0200 +++ b/src/dsync/dsync-data.c Thu Feb 18 08:20:22 2010 +0200 @@ -107,7 +107,7 @@ 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,
--- a/src/dsync/dsync-proxy.c Thu Feb 18 07:51:44 2010 +0200 +++ b/src/dsync/dsync-proxy.c Thu Feb 18 08:20:22 2010 +0200 @@ -275,7 +275,7 @@ 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)
--- a/src/dsync/dsync-worker-local.c Thu Feb 18 07:51:44 2010 +0200 +++ b/src/dsync/dsync-worker-local.c Thu Feb 18 08:20:22 2010 +0200 @@ -702,7 +702,7 @@ 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 @@ 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; }
--- a/src/dsync/test-dsync-common.c Thu Feb 18 07:51:44 2010 +0200 +++ b/src/dsync/test-dsync-common.c Thu Feb 18 08:20:22 2010 +0200 @@ -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 @@ 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); +}
--- a/src/imap/imap-status.c Thu Feb 18 07:51:44 2010 +0200 +++ b/src/imap/imap-status.c Thu Feb 18 08:20:22 2010 +0200 @@ -123,8 +123,7 @@ } 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)
--- a/src/lib-storage/mail-storage.h Thu Feb 18 07:51:44 2010 +0200 +++ b/src/lib-storage/mail-storage.h Thu Feb 18 08:20:22 2010 +0200 @@ -689,5 +689,7 @@ 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