changeset 3863:55df57c028d4 HEAD

Added "bool" type and changed all ints that were used as booleans to bool.
author Timo Sirainen <tss@iki.fi>
date Fri, 13 Jan 2006 22:25:57 +0200
parents ea1571f17b96
children 6124ca416a6c
files configure.in src/auth/auth-cache.c src/auth/auth-cache.h src/auth/auth-client-connection.c src/auth/auth-master-connection.c src/auth/auth-master-listener.c src/auth/auth-master-listener.h src/auth/auth-request-handler.c src/auth/auth-request-handler.h src/auth/auth-request.c src/auth/auth-request.h src/auth/auth-worker-client.c src/auth/auth.c src/auth/auth.h src/auth/common.h src/auth/db-ldap.c src/auth/db-ldap.h src/auth/db-passwd-file.c src/auth/db-passwd-file.h src/auth/main.c src/auth/mech-apop.c src/auth/mech-cram-md5.c src/auth/mech-digest-md5.c src/auth/mech-ntlm.c src/auth/mech-rpa.c src/auth/passdb-bsdauth.c src/auth/passdb-cache.c src/auth/passdb-cache.h src/auth/passdb-pam.c src/auth/passdb-passwd.c src/auth/passdb-shadow.c src/auth/passdb.h src/auth/password-scheme.c src/auth/password-scheme.h src/auth/userdb-ldap.c src/auth/userdb-prefetch.c src/auth/userdb.h src/imap-login/client-authenticate.c src/imap-login/client-authenticate.h src/imap-login/client.c src/imap-login/client.h src/imap/client.c src/imap/client.h src/imap/cmd-append.c src/imap/cmd-authenticate.c src/imap/cmd-capability.c src/imap/cmd-check.c src/imap/cmd-close.c src/imap/cmd-copy.c src/imap/cmd-create.c src/imap/cmd-delete.c src/imap/cmd-examine.c src/imap/cmd-expunge.c src/imap/cmd-fetch.c src/imap/cmd-idle.c src/imap/cmd-list.c src/imap/cmd-login.c src/imap/cmd-logout.c src/imap/cmd-lsub.c src/imap/cmd-namespace.c src/imap/cmd-noop.c src/imap/cmd-rename.c src/imap/cmd-search.c src/imap/cmd-select.c src/imap/cmd-sort.c src/imap/cmd-status.c src/imap/cmd-store.c src/imap/cmd-subscribe.c src/imap/cmd-thread.c src/imap/cmd-uid.c src/imap/cmd-unselect.c src/imap/cmd-unsubscribe.c src/imap/commands-util.c src/imap/commands-util.h src/imap/commands.c src/imap/commands.h src/imap/imap-expunge.c src/imap/imap-expunge.h src/imap/imap-fetch-body.c src/imap/imap-fetch.c src/imap/imap-fetch.h src/imap/imap-search.c src/imap/imap-search.h src/imap/imap-sort.c src/imap/imap-sync.c src/imap/imap-sync.h src/imap/imap-thread.c src/imap/namespace.c src/lib-auth/auth-client.c src/lib-auth/auth-client.h src/lib-auth/auth-server-connection.c src/lib-auth/auth-server-connection.h src/lib-auth/auth-server-request.c src/lib-auth/auth-server-request.h src/lib-charset/charset-iconv.c src/lib-charset/charset-utf8.c src/lib-charset/charset-utf8.h src/lib-dict/dict-client.c src/lib-dict/dict-private.h src/lib-dict/dict-sql.c src/lib-dict/dict.c src/lib-dict/dict.h src/lib-imap/imap-base-subject.c src/lib-imap/imap-base-subject.h src/lib-imap/imap-bodystructure.c src/lib-imap/imap-bodystructure.h src/lib-imap/imap-date.c src/lib-imap/imap-date.h src/lib-imap/imap-envelope.c src/lib-imap/imap-envelope.h src/lib-imap/imap-match.c src/lib-imap/imap-match.h src/lib-imap/imap-parser.c src/lib-imap/imap-parser.h src/lib-imap/imap-quote.c src/lib-imap/imap-quote.h src/lib-index/mail-cache-compress.c src/lib-index/mail-cache-lookup.c src/lib-index/mail-cache-transaction.c src/lib-index/mail-cache.c src/lib-index/mail-cache.h src/lib-index/mail-index-fsck.c src/lib-index/mail-index-lock.c src/lib-index/mail-index-private.h src/lib-index/mail-index-sync-ext.c src/lib-index/mail-index-sync-private.h src/lib-index/mail-index-sync-update.c src/lib-index/mail-index-sync.c src/lib-index/mail-index-transaction-private.h src/lib-index/mail-index-transaction.c src/lib-index/mail-index-view-private.h src/lib-index/mail-index-view-sync.c src/lib-index/mail-index-view.c src/lib-index/mail-index.c src/lib-index/mail-index.h src/lib-index/mail-transaction-log-append.c src/lib-index/mail-transaction-log-private.h src/lib-index/mail-transaction-log-view.c src/lib-index/mail-transaction-log.c src/lib-index/mail-transaction-log.h src/lib-mail/istream-header-filter.c src/lib-mail/istream-header-filter.h src/lib-mail/message-address.c src/lib-mail/message-body-search.c src/lib-mail/message-body-search.h src/lib-mail/message-content-parser.c src/lib-mail/message-content-parser.h src/lib-mail/message-date.c src/lib-mail/message-date.h src/lib-mail/message-header-decode.c src/lib-mail/message-header-decode.h src/lib-mail/message-header-search.c src/lib-mail/message-header-search.h src/lib-mail/message-parser.c src/lib-mail/message-parser.h src/lib-mail/message-part-serialize.c src/lib-mail/message-send.c src/lib-mail/message-send.h src/lib-mail/message-size.c src/lib-mail/message-size.h src/lib-ntlm/ntlm-encrypt.c src/lib-ntlm/ntlm-message.c src/lib-ntlm/ntlm-message.h src/lib-ntlm/ntlm.h src/lib-settings/settings.c src/lib-settings/settings.h src/lib-sql/driver-mysql.c src/lib-sql/driver-pgsql.c src/lib-storage/index/dbox/dbox-list.c src/lib-storage/index/dbox/dbox-mail.c src/lib-storage/index/dbox/dbox-save.c src/lib-storage/index/dbox/dbox-storage.c src/lib-storage/index/dbox/dbox-storage.h src/lib-storage/index/dbox/dbox-sync-expunge.c src/lib-storage/index/dbox/dbox-sync.c src/lib-storage/index/dbox/dbox-sync.h src/lib-storage/index/dbox/dbox-uidlist.c src/lib-storage/index/index-mail-headers.c src/lib-storage/index/index-mail.c src/lib-storage/index/index-mailbox-check.c src/lib-storage/index/index-search.c src/lib-storage/index/index-storage.c src/lib-storage/index/index-storage.h src/lib-storage/index/index-sync.c src/lib-storage/index/maildir/maildir-copy.c src/lib-storage/index/maildir/maildir-list.c src/lib-storage/index/maildir/maildir-mail.c src/lib-storage/index/maildir/maildir-save.c src/lib-storage/index/maildir/maildir-storage.c src/lib-storage/index/maildir/maildir-storage.h src/lib-storage/index/maildir/maildir-sync.c src/lib-storage/index/maildir/maildir-uidlist.c src/lib-storage/index/maildir/maildir-uidlist.h src/lib-storage/index/mbox/istream-raw-mbox.c src/lib-storage/index/mbox/istream-raw-mbox.h src/lib-storage/index/mbox/mbox-file.c src/lib-storage/index/mbox/mbox-file.h src/lib-storage/index/mbox/mbox-list.c src/lib-storage/index/mbox/mbox-lock.c src/lib-storage/index/mbox/mbox-mail.c src/lib-storage/index/mbox/mbox-md5.c src/lib-storage/index/mbox/mbox-save.c src/lib-storage/index/mbox/mbox-storage.c src/lib-storage/index/mbox/mbox-storage.h src/lib-storage/index/mbox/mbox-sync-parse.c src/lib-storage/index/mbox/mbox-sync-private.h src/lib-storage/index/mbox/mbox-sync-rewrite.c src/lib-storage/index/mbox/mbox-sync-update.c src/lib-storage/index/mbox/mbox-sync.c src/lib-storage/index/mbox/mbox-transaction.c src/lib-storage/mail-search.c src/lib-storage/mail-search.h src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.c src/lib-storage/mail-storage.h src/lib-storage/mailbox-tree.c src/lib-storage/mailbox-tree.h src/lib-storage/subscription-file/subscription-file.c src/lib-storage/subscription-file/subscription-file.h src/lib/array.h src/lib/buffer.c src/lib/buffer.h src/lib/compat.h src/lib/data-stack.c src/lib/data-stack.h src/lib/fd-close-on-exec.c src/lib/fd-close-on-exec.h src/lib/fd-set-nonblock.c src/lib/fd-set-nonblock.h src/lib/file-dotlock.c src/lib/file-dotlock.h src/lib/hash.c src/lib/hash.h src/lib/hex-binary.c src/lib/ioloop-epoll.c src/lib/ioloop-notify-dn.c src/lib/ioloop-notify-inotify.c src/lib/ioloop-poll.c src/lib/ioloop.c src/lib/ioloop.h src/lib/istream-data.c src/lib/istream-file.c src/lib/istream-internal.h src/lib/istream-limit.c src/lib/istream-mmap.c src/lib/istream-seekable.c src/lib/istream.c src/lib/istream.h src/lib/lib-signals.c src/lib/lib-signals.h src/lib/mempool-alloconly.c src/lib/module-dir.c src/lib/module-dir.h src/lib/network.c src/lib/network.h src/lib/ostream-crlf.c src/lib/ostream-file.c src/lib/ostream-internal.h src/lib/ostream.c src/lib/ostream.h src/lib/printf-upper-bound.c src/lib/restrict-access.c src/lib/restrict-access.h src/lib/restrict-process-size.h src/lib/seq-range-array.c src/lib/seq-range-array.h src/lib/strfuncs.c src/lib/strfuncs.h src/lib/unlink-directory.c src/lib/unlink-directory.h src/lib/var-expand.c src/login-common/client-common.c src/login-common/client-common.h src/login-common/common.h src/login-common/main.c src/login-common/master.c src/login-common/master.h src/login-common/sasl-server.c src/login-common/ssl-proxy-gnutls.c src/login-common/ssl-proxy-openssl.c src/login-common/ssl-proxy.c src/login-common/ssl-proxy.h src/master/auth-process.c src/master/common.h src/master/log.c src/master/login-process.c src/master/mail-process.c src/master/mail-process.h src/master/main.c src/master/master-login-interface.h src/master/master-settings.c src/master/master-settings.h src/master/ssl-init.c src/master/syslog-util.c src/master/syslog-util.h src/plugins/imap-quota/imap-quota-plugin.c src/plugins/quota/quota-dict.c src/plugins/quota/quota-dirsize.c src/plugins/quota/quota-fs.c src/plugins/quota/quota-private.h src/plugins/quota/quota-storage.c src/plugins/quota/quota.c src/plugins/quota/quota.h src/plugins/trash/trash-plugin.c src/plugins/zlib/istream-zlib.c src/plugins/zlib/zlib-plugin.c src/pop3-login/client-authenticate.c src/pop3-login/client-authenticate.h src/pop3-login/client.c src/pop3-login/client.h src/pop3/client.c src/pop3/commands.c src/pop3/common.h src/pop3/main.c src/util/rawlog.c
diffstat 315 files changed, 1339 insertions(+), 1271 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Fri Jan 13 17:11:47 2006 +0200
+++ b/configure.in	Fri Jan 13 22:25:57 2006 +0200
@@ -716,6 +716,8 @@
   AC_DEFINE(HAVE_SOCKLEN_T,, Define to 'int' if you don't have socklen_t)
 fi
 
+AC_CHECK_TYPES(_Bool)
+
 AC_DEFINE_UNQUOTED(MEM_ALIGN_SIZE, $mem_align, Required memory alignment)
 
 dnl * find random source
--- a/src/auth/auth-cache.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-cache.c	Fri Jan 13 22:25:57 2006 +0200
@@ -152,7 +152,7 @@
 
 const char *auth_cache_lookup(struct auth_cache *cache,
 			      const struct auth_request *request,
-			      const char *key, int *expired_r)
+			      const char *key, bool *expired_r)
 {
 	string_t *str;
 	struct cache_node *node;
--- a/src/auth/auth-cache.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-cache.h	Fri Jan 13 22:25:57 2006 +0200
@@ -21,7 +21,7 @@
    auth_cache_parse_key(). */
 const char *auth_cache_lookup(struct auth_cache *cache,
 			      const struct auth_request *request,
-			      const char *key, int *expired_r);
+			      const char *key, bool *expired_r);
 /* Insert key => value into cache. */
 void auth_cache_insert(struct auth_cache *cache,
 		       const struct auth_request *request,
--- a/src/auth/auth-client-connection.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-client-connection.c	Fri Jan 13 22:25:57 2006 +0200
@@ -69,7 +69,7 @@
 	auth_client_send(conn, "%s", reply);
 }
 
-static int
+static bool
 auth_client_input_cpid(struct auth_client_connection *conn, const char *args)
 {
         struct auth_client_connection *old;
@@ -130,7 +130,7 @@
 	return 1;
 }
 
-static int
+static bool
 auth_client_handle_line(struct auth_client_connection *conn, const char *line)
 {
 	if (conn->auth->verbose_debug)
@@ -153,7 +153,7 @@
 {
 	struct auth_client_connection *conn = context;
 	char *line;
-	int ret;
+	bool ret;
 
 	switch (i_stream_read(conn->input)) {
 	case 0:
--- a/src/auth/auth-master-connection.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-master-connection.c	Fri Jan 13 22:25:57 2006 +0200
@@ -46,7 +46,7 @@
 	(void)o_stream_sendv(conn->output, iov, 2);
 }
 
-static int
+static bool
 master_input_request(struct auth_master_connection *conn, const char *args)
 {
 	struct auth_client_connection *client_conn;
@@ -100,7 +100,7 @@
 	auth_request_unref(auth_request);
 }
 
-static int
+static bool
 master_input_user(struct auth_master_connection *conn, const char *args)
 {
 	struct auth_request *auth_request;
@@ -141,7 +141,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 master_input_die(struct auth_master_connection *conn)
 {
 	return TRUE;
@@ -151,7 +151,7 @@
 {
 	struct auth_master_connection *conn = context;
  	char *line;
-	int ret;
+	bool ret;
 
 	switch (i_stream_read(conn->input)) {
 	case 0:
--- a/src/auth/auth-master-listener.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-master-listener.c	Fri Jan 13 22:25:57 2006 +0200
@@ -153,7 +153,7 @@
 		auth_master_listener_send_handshakes(listeners[i]);
 }
 
-int auth_master_listeners_masters_left(void)
+bool auth_master_listeners_masters_left(void)
 {
         struct auth_master_listener *const *listeners;
 	unsigned int i, count;
--- a/src/auth/auth-master-listener.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-master-listener.h	Fri Jan 13 22:25:57 2006 +0200
@@ -25,7 +25,7 @@
 			      enum listener_type type);
 
 void auth_master_listeners_send_handshake(void);
-int auth_master_listeners_masters_left(void);
+bool auth_master_listeners_masters_left(void);
 
 void auth_master_listeners_init(void);
 void auth_master_listeners_deinit(void);
--- a/src/auth/auth-request-handler.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-request-handler.c	Fri Jan 13 22:25:57 2006 +0200
@@ -232,8 +232,8 @@
 	auth_request_handler_remove(handler, request);
 }
 
-int auth_request_handler_auth_begin(struct auth_request_handler *handler,
-				    const char *args)
+bool auth_request_handler_auth_begin(struct auth_request_handler *handler,
+				     const char *args)
 {
 	struct mech_module *mech;
 	struct auth_request *request;
@@ -242,7 +242,7 @@
 	size_t initial_resp_len;
 	unsigned int id;
 	buffer_t *buf;
-	int valid_client_cert;
+	bool valid_client_cert;
 
 	/* <id> <mechanism> [...] */
 	list = t_strsplit(args, "\t");
@@ -328,8 +328,8 @@
 	return TRUE;
 }
 
-int auth_request_handler_auth_continue(struct auth_request_handler *handler,
-				       const char *args)
+bool auth_request_handler_auth_continue(struct auth_request_handler *handler,
+					const char *args)
 {
 	struct auth_request *request;
 	const char *data;
--- a/src/auth/auth-request-handler.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-request-handler.h	Fri Jan 13 22:25:57 2006 +0200
@@ -18,10 +18,10 @@
 
 void auth_request_handler_check_timeouts(struct auth_request_handler *handler);
 
-int auth_request_handler_auth_begin(struct auth_request_handler *handler,
-				    const char *args);
-int auth_request_handler_auth_continue(struct auth_request_handler *handler,
-				       const char *args);
+bool auth_request_handler_auth_begin(struct auth_request_handler *handler,
+				     const char *args);
+bool auth_request_handler_auth_continue(struct auth_request_handler *handler,
+					const char *args);
 void auth_request_handler_master_request(struct auth_request_handler *handler,
 					 struct auth_master_connection *master,
 					 unsigned int id,
--- a/src/auth/auth-request.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-request.c	Fri Jan 13 22:25:57 2006 +0200
@@ -87,7 +87,7 @@
 	request->refcount++;
 }
 
-int auth_request_unref(struct auth_request *request)
+bool auth_request_unref(struct auth_request *request)
 {
 	i_assert(request->refcount > 0);
 	if (--request->refcount > 0)
@@ -117,8 +117,8 @@
 	}
 }
 
-int auth_request_import(struct auth_request *request,
-			const char *key, const char *value)
+bool auth_request_import(struct auth_request *request,
+			 const char *key, const char *value)
 {
 	if (strcmp(key, "user") == 0)
 		request->user = p_strdup(request->pool, value);
@@ -241,7 +241,7 @@
 	auth_cache_insert(passdb_cache, request, passdb->cache_key, str_c(str));
 }
 
-static int
+static bool
 auth_request_handle_passdb_callback(enum passdb_result *result,
 				    struct auth_request *request)
 {
@@ -471,8 +471,8 @@
 		userdb->iface->lookup(request, auth_request_userdb_callback);
 }
 
-int auth_request_set_username(struct auth_request *request,
-			      const char *username, const char **error_r)
+bool auth_request_set_username(struct auth_request *request,
+			       const char *username, const char **error_r)
 {
 	unsigned char *p;
 
--- a/src/auth/auth-request.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-request.h	Fri Jan 13 22:25:57 2006 +0200
@@ -69,7 +69,7 @@
 		 mech_callback_t *callback, void *context);
 struct auth_request *auth_request_new_dummy(struct auth *auth);
 void auth_request_ref(struct auth_request *request);
-int auth_request_unref(struct auth_request *request);
+bool auth_request_unref(struct auth_request *request);
 
 void auth_request_success(struct auth_request *request,
 			  const void *data, size_t data_size);
@@ -77,8 +77,8 @@
 void auth_request_internal_failure(struct auth_request *request);
 
 void auth_request_export(struct auth_request *request, string_t *str);
-int auth_request_import(struct auth_request *request,
-			const char *key, const char *value);
+bool auth_request_import(struct auth_request *request,
+			 const char *key, const char *value);
 
 void auth_request_initial(struct auth_request *request,
 			  const unsigned char *data, size_t data_size);
@@ -94,8 +94,8 @@
 void auth_request_lookup_user(struct auth_request *request,
 			      userdb_callback_t *callback);
 
-int auth_request_set_username(struct auth_request *request,
-			      const char *username, const char **error_r);
+bool auth_request_set_username(struct auth_request *request,
+			       const char *username, const char **error_r);
 
 void auth_request_set_field(struct auth_request *request,
 			    const char *name, const char *value,
--- a/src/auth/auth-worker-client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth-worker-client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -279,7 +279,7 @@
 		lookup(auth_request, lookup_user_callback);
 }
 
-static int
+static bool
 auth_worker_handle_line(struct auth_worker_client *client, const char *line)
 {
 	const char *p;
@@ -306,7 +306,7 @@
 {
 	struct auth_worker_client *client = context;
 	char *line;
-	int ret;
+	bool ret;
 
 	switch (i_stream_read(client->input)) {
 	case 0:
--- a/src/auth/auth.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth.c	Fri Jan 13 22:25:57 2006 +0200
@@ -101,7 +101,7 @@
 	auth->mech_modules = list;
 }
 
-static int auth_passdb_list_have_plain(struct auth *auth)
+static bool auth_passdb_list_have_plain(struct auth *auth)
 {
 	struct auth_passdb *passdb;
 
@@ -112,7 +112,7 @@
 	return FALSE;
 }
 
-static int auth_passdb_list_have_credentials(struct auth *auth)
+static bool auth_passdb_list_have_credentials(struct auth *auth)
 {
 	struct auth_passdb *passdb;
 
--- a/src/auth/auth.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/auth.h	Fri Jan 13 22:25:57 2006 +0200
@@ -41,10 +41,10 @@
 	const char *anonymous_username;
 	char username_chars[256];
         char username_translation[256];
-	int ssl_require_client_cert;
-        int ssl_username_from_cert;
+	bool ssl_require_client_cert;
+        bool ssl_username_from_cert;
 
-	int verbose, verbose_debug;
+	bool verbose, verbose_debug;
 };
 
 const string_t *auth_mechanisms_get_list(struct auth *auth);
--- a/src/auth/common.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/common.h	Fri Jan 13 22:25:57 2006 +0200
@@ -9,7 +9,7 @@
 #define WORKER_SERVER_FD 4
 
 extern struct ioloop *ioloop;
-extern int standalone, worker;
+extern bool standalone, worker;
 extern time_t process_start_time;
 
 #endif
--- a/src/auth/db-ldap.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/db-ldap.c	Fri Jan 13 22:25:57 2006 +0200
@@ -70,7 +70,7 @@
 
 static struct ldap_connection *ldap_connections = NULL;
 
-static void ldap_conn_close(struct ldap_connection *conn, int flush_requests);
+static void ldap_conn_close(struct ldap_connection *conn, bool flush_requests);
 
 static int deref2str(const char *str)
 {
@@ -212,7 +212,7 @@
 	}
 }
 
-int db_ldap_connect(struct ldap_connection *conn)
+bool db_ldap_connect(struct ldap_connection *conn)
 {
 	int ret, fd;
 
@@ -280,7 +280,7 @@
 	return TRUE;
 }
 
-static void ldap_conn_close(struct ldap_connection *conn, int flush_requests)
+static void ldap_conn_close(struct ldap_connection *conn, bool flush_requests)
 {
 	struct hash_iterate_context *iter;
 	void *key, *value;
--- a/src/auth/db-ldap.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/db-ldap.h	Fri Jan 13 22:25:57 2006 +0200
@@ -15,7 +15,7 @@
 	const char *uris;
 	const char *dn;
 	const char *dnpass;
-	int auth_bind;
+	bool auth_bind;
 	const char *auth_bind_userdn;
 	const char *deref;
 	const char *scope;
@@ -31,6 +31,7 @@
 	const char *user_global_uid;
 	const char *user_global_gid;
 
+	/* ... */
 	int ldap_deref, ldap_scope;
 	uid_t uid;
 	gid_t gid;
@@ -74,7 +75,7 @@
 struct ldap_connection *db_ldap_init(const char *config_path);
 void db_ldap_unref(struct ldap_connection *conn);
 
-int db_ldap_connect(struct ldap_connection *conn);
+bool db_ldap_connect(struct ldap_connection *conn);
 
 const char *ldap_escape(const char *str);
 const char *ldap_get_error(struct ldap_connection *conn);
--- a/src/auth/db-passwd-file.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/db-passwd-file.c	Fri Jan 13 22:25:57 2006 +0200
@@ -137,7 +137,7 @@
 	return pw;
 }
 
-static int passwd_file_open(struct passwd_file *pw)
+static bool passwd_file_open(struct passwd_file *pw)
 {
 	const char *no_args = NULL;
 	struct istream *input;
@@ -213,7 +213,7 @@
 	i_free(pw);
 }
 
-static int passwd_file_sync(struct passwd_file *pw)
+static bool passwd_file_sync(struct passwd_file *pw)
 {
 	struct stat st;
 
@@ -246,11 +246,11 @@
 	return NULL;
 }
 
-struct db_passwd_file *db_passwd_file_parse(const char *path, int userdb)
+struct db_passwd_file *db_passwd_file_parse(const char *path, bool userdb)
 {
 	struct db_passwd_file *db;
 	const char *p;
-	int percents = FALSE;
+	bool percents = FALSE;
 
 	db = db_passwd_file_find(path);
 	if (db != NULL) {
--- a/src/auth/db-passwd-file.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/db-passwd-file.h	Fri Jan 13 22:25:57 2006 +0200
@@ -42,7 +42,7 @@
 struct passwd_user *
 db_passwd_file_lookup(struct db_passwd_file *db, struct auth_request *request);
 
-struct db_passwd_file *db_passwd_file_parse(const char *path, int userdb);
+struct db_passwd_file *db_passwd_file_parse(const char *path, bool userdb);
 void db_passwd_file_unref(struct db_passwd_file *db);
 
 #endif
--- a/src/auth/main.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/main.c	Fri Jan 13 22:25:57 2006 +0200
@@ -28,7 +28,7 @@
 #include <sys/stat.h>
 
 struct ioloop *ioloop;
-int standalone = FALSE, worker = FALSE;
+bool standalone = FALSE, worker = FALSE;
 time_t process_start_time;
 
 static struct auth *auth;
@@ -198,7 +198,7 @@
 	restrict_access_by_env(FALSE);
 }
 
-static void main_init(int nodaemon)
+static void main_init(bool nodaemon)
 {
 	struct auth_master_listener *listener;
 
@@ -284,7 +284,7 @@
 
 int main(int argc __attr_unused__, char *argv[])
 {
-	int foreground = FALSE;
+	bool foreground = FALSE;
 
 #ifdef DEBUG
 	if (getenv("GDB") == NULL)
--- a/src/auth/mech-apop.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/mech-apop.c	Fri Jan 13 22:25:57 2006 +0200
@@ -32,8 +32,8 @@
 	unsigned char digest[16];
 };
 
-static int verify_credentials(struct apop_auth_request *request,
-			      const char *credentials)
+static bool verify_credentials(struct apop_auth_request *request,
+			       const char *credentials)
 {
 	unsigned char digest[16];
 	struct md5_context ctx;
--- a/src/auth/mech-cram-md5.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/mech-cram-md5.c	Fri Jan 13 22:25:57 2006 +0200
@@ -46,8 +46,8 @@
 			       dec2str(ioloop_time), my_hostname);
 }
 
-static int verify_credentials(struct cram_auth_request *request,
-			      const char *credentials)
+static bool verify_credentials(struct cram_auth_request *request,
+			       const char *credentials)
 {
 	
 	unsigned char digest[16], context_digest[32];
@@ -80,9 +80,9 @@
 	return TRUE;
 }
 
-static int parse_cram_response(struct cram_auth_request *request,
-			       const unsigned char *data, size_t size,
-			       const char **error_r)
+static bool parse_cram_response(struct cram_auth_request *request,
+				const unsigned char *data, size_t size,
+				const char **error_r)
 {
 	size_t i, space;
 
--- a/src/auth/mech-digest-md5.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/mech-digest-md5.c	Fri Jan 13 22:25:57 2006 +0200
@@ -59,7 +59,8 @@
 	string_t *str;
 	const char *const *tmp;
 	unsigned char nonce[16];
-	int i, first_qop;
+	int i;
+	bool first_qop;
 
 	/*
 	   realm="hostname" (multiple allowed)
@@ -109,8 +110,8 @@
 	return str;
 }
 
-static int verify_credentials(struct digest_auth_request *request,
-			      const char *credentials)
+static bool verify_credentials(struct digest_auth_request *request,
+			       const char *credentials)
 {
 	struct md5_context ctx;
 	unsigned char digest[16];
@@ -222,7 +223,7 @@
 	return TRUE;
 }
 
-static int verify_realm(struct digest_auth_request *request, const char *realm)
+static bool verify_realm(struct digest_auth_request *request, const char *realm)
 {
 	const char *const *tmp;
 
@@ -238,7 +239,7 @@
 	return FALSE;
 }
 
-static int parse_next(char **data, char **key, char **value)
+static bool parse_next(char **data, char **key, char **value)
 {
 	/* @UNSAFE */
 	char *p, *dest;
@@ -291,8 +292,8 @@
 	return TRUE;
 }
 
-static int auth_handle_response(struct digest_auth_request *request,
-				char *key, char *value, const char **error)
+static bool auth_handle_response(struct digest_auth_request *request,
+				 char *key, char *value, const char **error)
 {
 	int i;
 
@@ -449,12 +450,12 @@
 	return TRUE;
 }
 
-static int parse_digest_response(struct digest_auth_request *request,
-				 const unsigned char *data, size_t size,
-				 const char **error)
+static bool parse_digest_response(struct digest_auth_request *request,
+				  const unsigned char *data, size_t size,
+				  const char **error)
 {
 	char *copy, *key, *value;
-	int failed;
+	bool failed;
 
 	/*
 	   realm="realm"
--- a/src/auth/mech-ntlm.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/mech-ntlm.c	Fri Jan 13 22:25:57 2006 +0200
@@ -25,8 +25,8 @@
 	pool_t pool;
 
 	/* requested: */
-	int ntlm2_negotiated;
-	int unicode_negotiated;
+	bool ntlm2_negotiated;
+	bool unicode_negotiated;
 	const unsigned char *challenge;
 
 	/* received: */
--- a/src/auth/mech-rpa.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/mech-rpa.c	Fri Jan 13 22:25:57 2006 +0200
@@ -177,7 +177,7 @@
 	return p + sizeof(rpa_oid);
 }
 
-static int
+static bool
 rpa_parse_token1(const void *data, size_t data_size, const char **error)
 {
 	const unsigned char *end = ((unsigned char *) data) + data_size;
@@ -238,7 +238,7 @@
 	return len;
 }
 
-static int
+static bool
 rpa_verify_realm(struct rpa_auth_request *request, const char *realm)
 {
 	const char *default_realm;
@@ -254,10 +254,10 @@
 			request->auth_request.auth->default_realm :
 			my_hostname;
 
-	return strcasecmp(realm, default_realm) == 0 ? TRUE : FALSE;
+	return strcasecmp(realm, default_realm) == 0;
 }
 
-static int
+static bool
 rpa_parse_token3(struct rpa_auth_request *request, const void *data,
 		 size_t data_size, const char **error)
 {
@@ -439,8 +439,8 @@
 	return buffer_free_without_data(buf);
 }
 
-static int verify_credentials(struct rpa_auth_request *request,
-			      const char *credentials)
+static bool verify_credentials(struct rpa_auth_request *request,
+			       const char *credentials)
 {
 	unsigned char response[16];
 	buffer_t *hash_buffer;
--- a/src/auth/passdb-bsdauth.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb-bsdauth.c	Fri Jan 13 22:25:57 2006 +0200
@@ -40,7 +40,7 @@
 	/* clear the passwords from memory */
 	safe_memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
 
-	if (!result) {
+	if (result == 0) {
 		auth_request_log_info(request, "bsdauth", "password mismatch");
 		callback(PASSDB_RESULT_PASSWORD_MISMATCH, request);
 		return;
--- a/src/auth/passdb-cache.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb-cache.c	Fri Jan 13 22:25:57 2006 +0200
@@ -32,12 +32,13 @@
 	}
 }
 
-int passdb_cache_verify_plain(struct auth_request *request, const char *key,
-			      const char *password,
-			      enum passdb_result *result_r, int use_expired)
+bool passdb_cache_verify_plain(struct auth_request *request, const char *key,
+			       const char *password,
+			       enum passdb_result *result_r, int use_expired)
 {
 	const char *value, *cached_pw, *scheme, *const *list;
-	int ret, expired;
+	int ret;
+	bool expired;
 
 	if (passdb_cache == NULL || key == NULL)
 		return FALSE;
@@ -81,14 +82,14 @@
 	return TRUE;
 }
 
-int passdb_cache_lookup_credentials(struct auth_request *request,
-				    const char *key, const char **password_r,
-				    const char **scheme_r,
-				    enum passdb_result *result_r,
-				    int use_expired)
+bool passdb_cache_lookup_credentials(struct auth_request *request,
+				     const char *key, const char **password_r,
+				     const char **scheme_r,
+				     enum passdb_result *result_r,
+				     bool use_expired)
 {
 	const char *value, *const *list;
-	int expired;
+	bool expired;
 
 	if (passdb_cache == NULL)
 		return FALSE;
--- a/src/auth/passdb-cache.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb-cache.h	Fri Jan 13 22:25:57 2006 +0200
@@ -6,14 +6,14 @@
 enum passdb_result;
 extern struct auth_cache *passdb_cache;
 
-int passdb_cache_verify_plain(struct auth_request *request, const char *key,
-			      const char *password,
-			      enum passdb_result *result_r, int use_expired);
-int passdb_cache_lookup_credentials(struct auth_request *request,
-				    const char *key, const char **password_r,
-				    const char **scheme_r,
-				    enum passdb_result *result_r,
-				    int use_expired);
+bool passdb_cache_verify_plain(struct auth_request *request, const char *key,
+			       const char *password,
+			       enum passdb_result *result_r, int use_expired);
+bool passdb_cache_lookup_credentials(struct auth_request *request,
+				     const char *key, const char **password_r,
+				     const char **scheme_r,
+				     enum passdb_result *result_r,
+				     bool use_expired);
 
 void passdb_cache_init(void);
 void passdb_cache_deinit(void);
--- a/src/auth/passdb-pam.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb-pam.c	Fri Jan 13 22:25:57 2006 +0200
@@ -61,7 +61,7 @@
 struct pam_passdb_module {
 	struct passdb_module module;
 
-	int pam_session;
+	bool pam_session;
 	const char *service_name, *pam_cache_key;
 	struct timeout *to_wait;
 };
--- a/src/auth/passdb-passwd.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb-passwd.c	Fri Jan 13 22:25:57 2006 +0200
@@ -18,7 +18,7 @@
 		    verify_plain_callback_t *callback)
 {
 	struct passwd *pw;
-	int result;
+	bool result;
 
 	pw = getpwnam(request->user);
 	if (pw == NULL) {
--- a/src/auth/passdb-shadow.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb-shadow.c	Fri Jan 13 22:25:57 2006 +0200
@@ -18,7 +18,7 @@
 		    verify_plain_callback_t *callback)
 {
 	struct spwd *spw;
-	int result;
+	bool result;
 
 	spw = getspnam(request->user);
 	if (spw == NULL) {
--- a/src/auth/passdb.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/passdb.h	Fri Jan 13 22:25:57 2006 +0200
@@ -60,7 +60,7 @@
 	const char *default_pass_scheme;
 	/* If blocking is set to TRUE, use child processes to access
 	   this passdb. */
-	int blocking;
+	bool blocking;
 
 	struct passdb_module_interface iface;
 };
--- a/src/auth/password-scheme.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/password-scheme.c	Fri Jan 13 22:25:57 2006 +0200
@@ -100,8 +100,8 @@
 	return NULL;
 }
 
-static int crypt_verify(const char *plaintext, const char *password,
-			const char *user __attr_unused__)
+static bool crypt_verify(const char *plaintext, const char *password,
+			 const char *user __attr_unused__)
 {
 	return strcmp(mycrypt(plaintext, password), password) == 0;
 }
@@ -118,8 +118,8 @@
 	return t_strdup(mycrypt(plaintext, salt));
 }
 
-static int md5_verify(const char *plaintext, const char *password,
-		      const char *user __attr_unused__)
+static bool md5_verify(const char *plaintext, const char *password,
+		       const char *user __attr_unused__)
 {
 	const char *str;
 
@@ -152,8 +152,8 @@
 	return str_c(str);
 }
 
-static int sha1_verify(const char *plaintext, const char *password,
-		      const char *user __attr_unused__)
+static bool sha1_verify(const char *plaintext, const char *password,
+			const char *user __attr_unused__)
 {
 	unsigned char sha1_digest[SHA1_RESULTLEN];
 	const char *data;
@@ -200,8 +200,8 @@
 	return str_c(str);
 }
 
-static int ssha_verify(const char *plaintext, const char *password,
-			    const char *user __attr_unused__)
+static bool ssha_verify(const char *plaintext, const char *password,
+			const char *user __attr_unused__)
 {
 	unsigned char sha1_digest[SHA1_RESULTLEN];
 	buffer_t *buf;
@@ -252,8 +252,8 @@
 	return str_c(str);
 }
 
-static int smd5_verify(const char *plaintext, const char *password,
-		       const char *user __attr_unused__)
+static bool smd5_verify(const char *plaintext, const char *password,
+			const char *user __attr_unused__)
 {
 	unsigned char md5_digest[16];
 	buffer_t *buf;
@@ -284,8 +284,8 @@
 	return memcmp(md5_digest, data, 16) == 0;
 }
 
-static int plain_verify(const char *plaintext, const char *password,
-			const char *user __attr_unused__)
+static bool plain_verify(const char *plaintext, const char *password,
+			 const char *user __attr_unused__)
 {
 	return strcmp(password, plaintext) == 0;
 }
@@ -296,8 +296,8 @@
 	return plaintext;
 }
 
-static int hmac_md5_verify(const char *plaintext, const char *password,
-			   const char *user __attr_unused__)
+static bool hmac_md5_verify(const char *plaintext, const char *password,
+			    const char *user __attr_unused__)
 {
 	return strcmp(password_generate_cram_md5(plaintext), password) == 0;
 }
@@ -308,8 +308,8 @@
 	return password_generate_cram_md5(plaintext);
 }
 
-static int digest_md5_verify(const char *plaintext, const char *password,
-			     const char *user)
+static bool digest_md5_verify(const char *plaintext, const char *password,
+			      const char *user)
 {
 	unsigned char digest[16];
 	const char *realm, *str;
@@ -344,8 +344,8 @@
 	return binary_to_hex(digest, sizeof(digest));
 }
 
-static int plain_md5_verify(const char *plaintext, const char *password,
-			    const char *user __attr_unused__)
+static bool plain_md5_verify(const char *plaintext, const char *password,
+			     const char *user __attr_unused__)
 {
 	unsigned char digest[16];
 	const char *str;
@@ -376,8 +376,8 @@
 	return str_c(str);
 }
 
-static int ldap_md5_verify(const char *plaintext, const char *password,
-			   const char *user __attr_unused__)
+static bool ldap_md5_verify(const char *plaintext, const char *password,
+			    const char *user __attr_unused__)
 {
 	unsigned char md5_digest[16];
 	buffer_t *buf;
@@ -405,8 +405,8 @@
 	return memcmp(md5_digest, data, 16) == 0;
 }
 
-static int lm_verify(const char *plaintext, const char *password,
-		       const char *user __attr_unused__)
+static bool lm_verify(const char *plaintext, const char *password,
+		      const char *user __attr_unused__)
 {
 	return strcasecmp(password, password_generate_lm(plaintext)) == 0;
 }
@@ -417,8 +417,8 @@
 	return password_generate_lm(plaintext);
 }
 
-static int ntlm_verify(const char *plaintext, const char *password,
-		       const char *user __attr_unused__)
+static bool ntlm_verify(const char *plaintext, const char *password,
+			const char *user __attr_unused__)
 {
 	return strcasecmp(password, password_generate_ntlm(plaintext)) == 0;
 }
@@ -429,8 +429,8 @@
 	return password_generate_ntlm(plaintext);
 }
 
-static int rpa_verify(const char *plaintext, const char *password,
-		      const char *user __attr_unused__)
+static bool rpa_verify(const char *plaintext, const char *password,
+		       const char *user __attr_unused__)
 {
 	return strcasecmp(password, password_generate_rpa(plaintext)) == 0;
 }
--- a/src/auth/password-scheme.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/password-scheme.h	Fri Jan 13 22:25:57 2006 +0200
@@ -4,8 +4,8 @@
 struct password_scheme {
 	const char *name;
 
-	int (*password_verify)(const char *plaintext, const char *password,
-			       const char *user);
+	bool (*password_verify)(const char *plaintext, const char *password,
+				const char *user);
 	const char *(*password_generate)(const char *plaintext,
 					 const char *user);
 };
--- a/src/auth/userdb-ldap.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/userdb-ldap.c	Fri Jan 13 22:25:57 2006 +0200
@@ -29,9 +29,9 @@
 	"", "home", "mail", "system_user", "uid", "gid", NULL
 };
 
-static int append_uid_list(struct auth_request *auth_request,
-                           struct auth_stream_reply *reply,
-			   const char *name, char **vals)
+static bool append_uid_list(struct auth_request *auth_request,
+			    struct auth_stream_reply *reply,
+			    const char *name, char **vals)
 {
 	uid_t uid;
 
@@ -46,9 +46,9 @@
 	return TRUE;
 }
 
-static int append_gid_list(struct auth_request *auth_request,
-                           struct auth_stream_reply *reply,
-			   const char *name, char **vals)
+static bool append_gid_list(struct auth_request *auth_request,
+			    struct auth_stream_reply *reply,
+			    const char *name, char **vals)
 {
 	gid_t gid;
 
@@ -72,7 +72,7 @@
 	const char *name;
 	char *attr, **vals;
 	unsigned int i;
-	int seen_uid = FALSE, seen_gid = FALSE;
+	bool seen_uid = FALSE, seen_gid = FALSE;
 
 	reply = auth_stream_reply_init(auth_request);
 	auth_stream_reply_add(reply, NULL, auth_request->user);
--- a/src/auth/userdb-prefetch.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/userdb-prefetch.c	Fri Jan 13 22:25:57 2006 +0200
@@ -17,7 +17,7 @@
 	string_t *str;
 	uid_t uid;
 	gid_t gid;
-	int uid_seen, gid_seen;
+	bool uid_seen, gid_seen;
 
 	if (auth_request->extra_fields == NULL) {
 		auth_request_log_error(auth_request, "prefetch",
--- a/src/auth/userdb.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/auth/userdb.h	Fri Jan 13 22:25:57 2006 +0200
@@ -11,7 +11,7 @@
 struct userdb_module {
 	/* If blocking is set to TRUE, use child processes to access
 	   this userdb. */
-	int blocking;
+	bool blocking;
 
 	const struct userdb_module_interface *iface;
 };
--- a/src/imap-login/client-authenticate.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap-login/client-authenticate.c	Fri Jan 13 22:25:57 2006 +0200
@@ -17,7 +17,7 @@
 
 #include <stdlib.h>
 
-const char *client_authenticate_get_capabilities(int secured)
+const char *client_authenticate_get_capabilities(bool secured)
 {
 	const struct auth_mech_desc *mech;
 	unsigned int i, count;
@@ -79,13 +79,13 @@
 	safe_memset(line, 0, strlen(line));
 }
 
-static int client_handle_args(struct imap_client *client,
-			      const char *const *args, int nologin)
+static bool client_handle_args(struct imap_client *client,
+			       const char *const *args, bool nologin)
 {
 	const char *reason = NULL, *host = NULL, *destuser = NULL, *pass = NULL;
 	string_t *reply;
 	unsigned int port = 143;
-	int proxy = FALSE, temp = FALSE;
+	bool proxy = FALSE, temp = FALSE;
 
 	for (; *args != NULL; args++) {
 		if (strcmp(*args, "nologin") == 0)
@@ -244,7 +244,7 @@
 
 	mech_name = IMAP_ARG_STR(&args[0]);
 	if (*mech_name == '\0')
-		return FALSE;
+		return 0;
 
 	client_ref(client);
 	sasl_server_auth_begin(&client->common, "IMAP", mech_name, NULL,
--- a/src/imap-login/client-authenticate.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap-login/client-authenticate.h	Fri Jan 13 22:25:57 2006 +0200
@@ -1,7 +1,7 @@
 #ifndef __CLIENT_AUTHENTICATE_H
 #define __CLIENT_AUTHENTICATE_H
 
-const char *client_authenticate_get_capabilities(int secured);
+const char *client_authenticate_get_capabilities(bool secured);
 
 int cmd_login(struct imap_client *client, struct imap_arg *args);
 int cmd_authenticate(struct imap_client *client, struct imap_arg *args);
--- a/src/imap-login/client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap-login/client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -75,7 +75,7 @@
 
 /* Skip incoming data until newline is found,
    returns TRUE if newline was found. */
-int client_skip_line(struct imap_client *client)
+bool client_skip_line(struct imap_client *client)
 {
 	const unsigned char *data;
 	size_t i, data_size;
@@ -109,7 +109,7 @@
 	client_send_line(client, t_strconcat("* CAPABILITY ",
 					     get_capability(client), NULL));
 	client_send_tagline(client, "OK Capability completed.");
-	return TRUE;
+	return 1;
 }
 
 static void client_start_tls(struct imap_client *client)
@@ -159,12 +159,12 @@
 {
 	if (client->common.tls) {
 		client_send_tagline(client, "BAD TLS is already active.");
-		return TRUE;
+		return 1;
 	}
 
 	if (!ssl_initialized) {
 		client_send_tagline(client, "BAD TLS support isn't enabled.");
-		return TRUE;
+		return 1;
 	}
 
 	/* remove input handler, SSL proxy gives us a new fd. we also have to
@@ -187,13 +187,13 @@
 	} else {
 		client_start_tls(client);
 	}
-	return TRUE;
+	return 1;
 }
 
 static int cmd_noop(struct imap_client *client)
 {
 	client_send_tagline(client, "OK NOOP completed.");
-	return TRUE;
+	return 1;
 }
 
 static int cmd_logout(struct imap_client *client)
@@ -201,7 +201,7 @@
 	client_send_line(client, "* BYE Logging out");
 	client_send_tagline(client, "OK Logout completed.");
 	client_destroy(client, "Aborted login");
-	return TRUE;
+	return 1;
 }
 
 static int client_command_execute(struct imap_client *client, const char *cmd,
@@ -224,11 +224,12 @@
 	return -1;
 }
 
-static int client_handle_input(struct imap_client *client)
+static bool client_handle_input(struct imap_client *client)
 {
 	struct imap_arg *args;
 	const char *msg;
-	int ret, fatal;
+	int ret;
+	bool fatal;
 
 	i_assert(!client->common.authenticating);
 
@@ -307,7 +308,7 @@
 	return ret != 0;
 }
 
-int client_read(struct imap_client *client)
+bool client_read(struct imap_client *client)
 {
 	switch (i_stream_read(client->input)) {
 	case -2:
@@ -405,7 +406,7 @@
 	client->greeting_sent = TRUE;
 }
 
-struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip,
+struct client *client_create(int fd, bool ssl, const struct ip_addr *local_ip,
 			     const struct ip_addr *ip)
 {
 	struct imap_client *client;
@@ -520,7 +521,7 @@
 	client->refcount++;
 }
 
-int client_unref(struct imap_client *client)
+bool client_unref(struct imap_client *client)
 {
 	if (--client->refcount > 0)
 		return TRUE;
--- a/src/imap-login/client.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap-login/client.h	Fri Jan 13 22:25:57 2006 +0200
@@ -38,12 +38,12 @@
 void client_send_line(struct imap_client *client, const char *line);
 void client_send_tagline(struct imap_client *client, const char *line);
 
-int client_read(struct imap_client *client);
-int client_skip_line(struct imap_client *client);
+bool client_read(struct imap_client *client);
+bool client_skip_line(struct imap_client *client);
 void client_input(void *context);
 
 void client_ref(struct imap_client *client);
-int client_unref(struct imap_client *client);
+bool client_unref(struct imap_client *client);
 
 void clients_init(void);
 void clients_deinit(void);
--- a/src/imap/client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -149,7 +149,7 @@
 {
 	struct client *client = cmd->client;
 	const char *error, *cmd_name;
-	int fatal;
+	bool fatal;
 
 	if (msg == NULL) {
 		msg = imap_parser_get_error(client->parser, &fatal);
@@ -182,8 +182,8 @@
 	cmd->param_error = TRUE;
 }
 
-int client_read_args(struct client_command_context *cmd, unsigned int count,
-		     unsigned int flags, struct imap_arg **args)
+bool client_read_args(struct client_command_context *cmd, unsigned int count,
+		      unsigned int flags, struct imap_arg **args)
 {
 	int ret;
 
@@ -204,8 +204,8 @@
 	}
 }
 
-int client_read_string_args(struct client_command_context *cmd,
-			    unsigned int count, ...)
+bool client_read_string_args(struct client_command_context *cmd,
+			     unsigned int count, ...)
 {
 	struct imap_arg *imap_args;
 	va_list va;
@@ -273,7 +273,7 @@
 
 /* Skip incoming data until newline is found,
    returns TRUE if newline was found. */
-static int client_skip_line(struct client *client)
+static bool client_skip_line(struct client *client)
 {
 	const unsigned char *data;
 	size_t i, data_size;
@@ -292,7 +292,7 @@
 	return !client->input_skip_line;
 }
 
-static int client_handle_input(struct client_command_context *cmd)
+static bool client_handle_input(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 
@@ -414,7 +414,8 @@
 {
 	struct client *client = context;
 	struct client_command_context *cmd = &client->cmd;
-	int ret, finished;
+	int ret;
+	bool finished;
 
 	client->last_output = ioloop_time;
 
--- a/src/imap/client.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/client.h	Fri Jan 13 22:25:57 2006 +0200
@@ -75,12 +75,12 @@
 
 /* Read a number of arguments. Returns TRUE if everything was read or
    FALSE if either needs more data or error occurred. */
-int client_read_args(struct client_command_context *cmd, unsigned int count,
-		     unsigned int flags, struct imap_arg **args);
+bool client_read_args(struct client_command_context *cmd, unsigned int count,
+		      unsigned int flags, struct imap_arg **args);
 /* Reads a number of string arguments. ... is a list of pointers where to
    store the arguments. */
-int client_read_string_args(struct client_command_context *cmd,
-			    unsigned int count, ...);
+bool client_read_string_args(struct client_command_context *cmd,
+			     unsigned int count, ...);
 
 void clients_init(void);
 void clients_deinit(void);
--- a/src/imap/cmd-append.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-append.c	Fri Jan 13 22:25:57 2006 +0200
@@ -26,7 +26,7 @@
 	struct mail_save_context *save_ctx;
 };
 
-static int cmd_append_continue_message(struct client_command_context *cmd);
+static bool cmd_append_continue_message(struct client_command_context *cmd);
 
 static void client_input(void *context)
 {
@@ -72,7 +72,7 @@
    set when successful. */
 static int validate_args(struct imap_arg *args, struct imap_arg_list **flags,
 			 const char **internal_date, uoff_t *msg_size,
-			 int *nonsync)
+			 bool *nonsync)
 {
 	/* [<flags>] */
 	if (args->type != IMAP_ARG_LIST)
@@ -123,7 +123,7 @@
 		mailbox_close(ctx->box);
 }
 
-static int cmd_append_continue_cancel(struct client_command_context *cmd)
+static bool cmd_append_continue_cancel(struct client_command_context *cmd)
 {
 	struct cmd_append_context *ctx = cmd->context;
 	size_t size;
@@ -139,7 +139,7 @@
 	return FALSE;
 }
 
-static int cmd_append_cancel(struct cmd_append_context *ctx, int nonsync)
+static bool cmd_append_cancel(struct cmd_append_context *ctx, bool nonsync)
 {
 	if (!nonsync) {
 		cmd_append_finish(ctx);
@@ -158,7 +158,7 @@
 	return cmd_append_continue_cancel(ctx->cmd);
 }
 
-static int cmd_append_continue_parsing(struct client_command_context *cmd)
+static bool cmd_append_continue_parsing(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct cmd_append_context *ctx = cmd->context;
@@ -169,7 +169,8 @@
 	struct mail_keywords *keywords;
 	const char *internal_date_str;
 	time_t internal_date;
-	int ret, timezone_offset, nonsync;
+	int ret, timezone_offset;
+	bool nonsync;
 
 	/* if error occurs, the CRLF is already read. */
 	client->input_skip_line = FALSE;
@@ -278,12 +279,12 @@
 	return cmd_append_continue_message(cmd);
 }
 
-static int cmd_append_continue_message(struct client_command_context *cmd)
+static bool cmd_append_continue_message(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct cmd_append_context *ctx = cmd->context;
 	size_t size;
-	int failed;
+	bool failed;
 
 	if (ctx->save_ctx != NULL) {
 		if (mailbox_save_continue(ctx->save_ctx) < 0) {
@@ -302,7 +303,7 @@
 
 	if (ctx->input->eof || client->input->closed) {
 		/* finished */
-		int all_written = ctx->input->v_offset == ctx->msg_size;
+		bool all_written = ctx->input->v_offset == ctx->msg_size;
 
 		i_stream_unref(ctx->input);
 		ctx->input = NULL;
@@ -365,7 +366,7 @@
 	return box;
 }
 
-int cmd_append(struct client_command_context *cmd)
+bool cmd_append(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
         struct cmd_append_context *ctx;
--- a/src/imap/cmd-authenticate.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-authenticate.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_authenticate(struct client_command_context *cmd)
+bool cmd_authenticate(struct client_command_context *cmd)
 {
 	client_send_tagline(cmd, "OK Already authenticated.");
 	return TRUE;
--- a/src/imap/cmd-capability.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-capability.c	Fri Jan 13 22:25:57 2006 +0200
@@ -4,7 +4,7 @@
 #include "commands.h"
 #include "str.h"
 
-int cmd_capability(struct client_command_context *cmd)
+bool cmd_capability(struct client_command_context *cmd)
 {
 	client_send_line(cmd->client,
 			 t_strconcat("* CAPABILITY ",
--- a/src/imap/cmd-check.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-check.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_check(struct client_command_context *cmd)
+bool cmd_check(struct client_command_context *cmd)
 {
 	if (!client_verify_open_mailbox(cmd))
 		return TRUE;
--- a/src/imap/cmd-close.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-close.c	Fri Jan 13 22:25:57 2006 +0200
@@ -4,7 +4,7 @@
 #include "commands.h"
 #include "imap-expunge.h"
 
-int cmd_close(struct client_command_context *cmd)
+bool cmd_close(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct mailbox *mailbox = client->mailbox;
--- a/src/imap/cmd-copy.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-copy.c	Fri Jan 13 22:25:57 2006 +0200
@@ -47,7 +47,7 @@
 	return ret;
 }
 
-int cmd_copy(struct client_command_context *cmd)
+bool cmd_copy(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct mail_storage *storage;
--- a/src/imap/cmd-create.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-create.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,11 +3,11 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_create(struct client_command_context *cmd)
+bool cmd_create(struct client_command_context *cmd)
 {
 	struct mail_storage *storage;
 	const char *mailbox, *full_mailbox;
-	int directory;
+	bool directory;
 	size_t len;
 
 	/* <mailbox> */
--- a/src/imap/cmd-delete.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-delete.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_delete(struct client_command_context *cmd)
+bool cmd_delete(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct mail_storage *storage;
--- a/src/imap/cmd-examine.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-examine.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_examine(struct client_command_context *cmd)
+bool cmd_examine(struct client_command_context *cmd)
 {
 	return _cmd_select_full(cmd, TRUE);
 }
--- a/src/imap/cmd-expunge.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-expunge.c	Fri Jan 13 22:25:57 2006 +0200
@@ -5,7 +5,7 @@
 #include "imap-search.h"
 #include "imap-expunge.h"
 
-int cmd_uid_expunge(struct client_command_context *cmd)
+bool cmd_uid_expunge(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct imap_arg *args;
@@ -37,7 +37,7 @@
 	}
 }
 
-int cmd_expunge(struct client_command_context *cmd)
+bool cmd_expunge(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 
--- a/src/imap/cmd-fetch.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-fetch.c	Fri Jan 13 22:25:57 2006 +0200
@@ -17,7 +17,7 @@
 	"FLAGS", "INTERNALDATE", "RFC822.SIZE", "ENVELOPE", "BODY", NULL
 };
 
-static int
+static bool
 fetch_parse_args(struct imap_fetch_context *ctx, struct imap_arg *arg)
 {
 	const char *str, *const *macro;
@@ -68,11 +68,11 @@
 	return TRUE;
 }
 
-static int cmd_fetch_finish(struct imap_fetch_context *ctx)
+static bool cmd_fetch_finish(struct imap_fetch_context *ctx)
 {
 	struct client_command_context *cmd = ctx->cmd;
 	static const char *ok_message = "OK Fetch completed.";
-	int failed, partial;
+	bool failed, partial;
 
 	partial = ctx->partial_fetch;
 	failed = ctx->failed;
@@ -83,7 +83,7 @@
 	if (failed || (partial && !cmd->uid)) {
 		struct mail_storage *storage;
 		const char *error;
-		int syntax, temporary_error;
+		bool syntax, temporary_error;
 
                 storage = mailbox_get_storage(cmd->client->mailbox);
 		error = mail_storage_get_last_error(storage, &syntax,
@@ -108,7 +108,7 @@
 			ok_message);
 }
 
-static int cmd_fetch_continue(struct client_command_context *cmd)
+static bool cmd_fetch_continue(struct client_command_context *cmd)
 {
         struct imap_fetch_context *ctx = cmd->context;
 	int ret;
@@ -127,7 +127,7 @@
 	return cmd_fetch_finish(ctx);
 }
 
-int cmd_fetch(struct client_command_context *cmd)
+bool cmd_fetch(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct imap_fetch_context *ctx;
--- a/src/imap/cmd-idle.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-idle.c	Fri Jan 13 22:25:57 2006 +0200
@@ -26,9 +26,9 @@
 	unsigned int sync_pending:1;
 };
 
-static int cmd_idle_continue(struct client_command_context *cmd);
+static bool cmd_idle_continue(struct client_command_context *cmd);
 
-static void idle_finish(struct cmd_idle_context *ctx, int done_ok)
+static void idle_finish(struct cmd_idle_context *ctx, bool done_ok)
 {
 	struct client *client = ctx->client;
 
@@ -173,7 +173,7 @@
                 idle_sync_now(box, ctx);
 }
 
-static int cmd_idle_continue(struct client_command_context *cmd)
+static bool cmd_idle_continue(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct cmd_idle_context *ctx = cmd->context;
@@ -216,7 +216,7 @@
 	return FALSE;
 }
 
-int cmd_idle(struct client_command_context *cmd)
+bool cmd_idle(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct cmd_idle_context *ctx;
--- a/src/imap/cmd-list.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-list.c	Fri Jan 13 22:25:57 2006 +0200
@@ -63,7 +63,7 @@
 	return *str == '\0' ? "" : str+1;
 }
 
-static int
+static bool
 parse_list_flags(struct client_command_context *cmd, struct imap_arg *args,
 		 enum mailbox_list_flags *list_flags)
 {
@@ -171,10 +171,10 @@
 	return ret < 0 ? -1 : 1;
 }
 
-static void skip_prefix(const char **prefix, const char **mask, int inbox)
+static void skip_prefix(const char **prefix, const char **mask, bool inbox)
 {
 	size_t mask_len, prefix_len;
-	int match;
+	bool match;
 
 	prefix_len = strlen(*prefix);
 	mask_len = strlen(*mask);
@@ -323,7 +323,7 @@
 						       list_flags);
 }
 
-static int cmd_list_continue(struct client_command_context *cmd)
+static bool cmd_list_continue(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
         struct cmd_list_context *ctx = cmd->context;
@@ -347,7 +347,7 @@
 	return TRUE;
 }
 
-int _cmd_list_full(struct client_command_context *cmd, int lsub)
+bool _cmd_list_full(struct client_command_context *cmd, bool lsub)
 {
 	struct client *client = cmd->client;
 	struct namespace *ns;
@@ -453,7 +453,7 @@
 	return TRUE;
 }
 
-int cmd_list(struct client_command_context *cmd)
+bool cmd_list(struct client_command_context *cmd)
 {
 	return _cmd_list_full(cmd, FALSE);
 }
--- a/src/imap/cmd-login.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-login.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_login(struct client_command_context *cmd)
+bool cmd_login(struct client_command_context *cmd)
 {
 	client_send_tagline(cmd, "OK Already logged in.");
 	return TRUE;
--- a/src/imap/cmd-logout.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-logout.c	Fri Jan 13 22:25:57 2006 +0200
@@ -4,7 +4,7 @@
 #include "ostream.h"
 #include "commands.h"
 
-int cmd_logout(struct client_command_context *cmd)
+bool cmd_logout(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 
--- a/src/imap/cmd-lsub.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-lsub.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_lsub(struct client_command_context *cmd)
+bool cmd_lsub(struct client_command_context *cmd)
 {
 	return _cmd_list_full(cmd, TRUE);
 }
--- a/src/imap/cmd-namespace.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-namespace.c	Fri Jan 13 22:25:57 2006 +0200
@@ -9,7 +9,7 @@
 static void list_namespaces(struct namespace *ns, enum namespace_type type,
 			    string_t *str)
 {
-	int found = FALSE;
+	bool found = FALSE;
 
 	while (ns != NULL) {
 		if (ns->type == type && !ns->hidden) {
@@ -33,7 +33,7 @@
 		str_append(str, "NIL");
 }
 
-int cmd_namespace(struct client_command_context *cmd)
+bool cmd_namespace(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	string_t *str;
--- a/src/imap/cmd-noop.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-noop.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_noop(struct client_command_context *cmd)
+bool cmd_noop(struct client_command_context *cmd)
 {
 	return cmd_sync(cmd, 0, 0, "OK NOOP completed.");
 }
--- a/src/imap/cmd-rename.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-rename.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_rename(struct client_command_context *cmd)
+bool cmd_rename(struct client_command_context *cmd)
 {
 	struct mail_storage *old_storage, *new_storage;
 	const char *oldname, *newname;
--- a/src/imap/cmd-search.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-search.c	Fri Jan 13 22:25:57 2006 +0200
@@ -8,15 +8,16 @@
 
 #define STRBUF_SIZE 1024
 
-static int imap_search(struct client_command_context *cmd, const char *charset,
-		       struct mail_search_arg *sargs)
+static bool imap_search(struct client_command_context *cmd, const char *charset,
+			struct mail_search_arg *sargs)
 {
 	struct client *client = cmd->client;
         struct mail_search_context *ctx;
         struct mailbox_transaction_context *trans;
 	struct mail *mail;
 	string_t *str;
-	int ret, uid, first = TRUE;
+	int ret;
+	bool uid, first = TRUE;
 
 	str = t_str_new(STRBUF_SIZE);
 	uid = cmd->uid;
@@ -55,7 +56,7 @@
 	return ret == 0;
 }
 
-int cmd_search(struct client_command_context *cmd)
+bool cmd_search(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct mail_search_arg *sargs;
--- a/src/imap/cmd-select.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-select.c	Fri Jan 13 22:25:57 2006 +0200
@@ -4,7 +4,7 @@
 #include "commands.h"
 #include "imap-sync.h"
 
-int _cmd_select_full(struct client_command_context *cmd, int readonly)
+bool _cmd_select_full(struct client_command_context *cmd, bool readonly)
 {
 	struct client *client = cmd->client;
 	struct mail_storage *storage;
@@ -87,7 +87,7 @@
 	return TRUE;
 }
 
-int cmd_select(struct client_command_context *cmd)
+bool cmd_select(struct client_command_context *cmd)
 {
 	return _cmd_select_full(cmd, FALSE);
 }
--- a/src/imap/cmd-sort.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-sort.c	Fri Jan 13 22:25:57 2006 +0200
@@ -71,7 +71,7 @@
 	return buffer_free_without_data(buf);
 }
 
-int cmd_sort(struct client_command_context *cmd)
+bool cmd_sort(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct mail_search_arg *sargs;
--- a/src/imap/cmd-status.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-status.c	Fri Jan 13 22:25:57 2006 +0200
@@ -44,13 +44,13 @@
 	return items;
 }
 
-static int get_mailbox_status(struct client *client,
-			      struct mail_storage *storage, const char *mailbox,
-			      enum mailbox_status_items items,
-			      struct mailbox_status *status)
+static bool
+get_mailbox_status(struct client *client, struct mail_storage *storage,
+		   const char *mailbox, enum mailbox_status_items items,
+		   struct mailbox_status *status)
 {
 	struct mailbox *box;
-	int failed;
+	bool failed;
 
 	if (client->mailbox != NULL &&
 	    mailbox_equals(client->mailbox, storage, mailbox)) {
@@ -76,7 +76,7 @@
 	return !failed;
 }
 
-int cmd_status(struct client_command_context *cmd)
+bool cmd_status(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct imap_arg *args;
--- a/src/imap/cmd-store.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-store.c	Fri Jan 13 22:25:57 2006 +0200
@@ -6,8 +6,9 @@
 #include "imap-search.h"
 #include "imap-util.h"
 
-static int get_modify_type(struct client_command_context *cmd, const char *item,
-			   enum modify_type *modify_type, int *silent)
+static bool
+get_modify_type(struct client_command_context *cmd, const char *item,
+		enum modify_type *modify_type, bool *silent)
 {
 	if (*item == '+') {
 		*modify_type = MODIFY_ADD;
@@ -35,7 +36,7 @@
 	return TRUE;
 }
 
-int cmd_store(struct client_command_context *cmd)
+bool cmd_store(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct imap_arg *args;
@@ -49,7 +50,7 @@
         struct mailbox_transaction_context *t;
 	struct mail *mail;
 	const char *messageset, *item;
-	int silent, failed;
+	bool silent, failed;
 
 	if (!client_read_args(cmd, 0, 0, &args))
 		return FALSE;
--- a/src/imap/cmd-subscribe.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-subscribe.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int _cmd_subscribe_full(struct client_command_context *cmd, int subscribe)
+bool _cmd_subscribe_full(struct client_command_context *cmd, bool subscribe)
 {
         struct mail_storage *storage;
 	const char *mailbox, *verify_name;
@@ -42,7 +42,7 @@
 	return TRUE;
 }
 
-int cmd_subscribe(struct client_command_context *cmd)
+bool cmd_subscribe(struct client_command_context *cmd)
 {
 	return _cmd_subscribe_full(cmd, TRUE);
 }
--- a/src/imap/cmd-thread.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-thread.c	Fri Jan 13 22:25:57 2006 +0200
@@ -6,7 +6,7 @@
 #include "imap-search.h"
 #include "imap-thread.h"
 
-int cmd_thread(struct client_command_context *cmd)
+bool cmd_thread(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	enum mail_thread_type threading;
--- a/src/imap/cmd-uid.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-uid.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_uid(struct client_command_context *cmd)
+bool cmd_uid(struct client_command_context *cmd)
 {
 	const char *cmd_name;
 
--- a/src/imap/cmd-unselect.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-unselect.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_unselect(struct client_command_context *cmd)
+bool cmd_unselect(struct client_command_context *cmd)
 {
 	struct client *client = cmd->client;
 	struct mailbox *mailbox = client->mailbox;
--- a/src/imap/cmd-unsubscribe.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/cmd-unsubscribe.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "common.h"
 #include "commands.h"
 
-int cmd_unsubscribe(struct client_command_context *cmd)
+bool cmd_unsubscribe(struct client_command_context *cmd)
 {
 	return _cmd_subscribe_full(cmd, FALSE);
 }
--- a/src/imap/commands-util.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/commands-util.c	Fri Jan 13 22:25:57 2006 +0200
@@ -30,9 +30,9 @@
 	return NULL;
 }
 
-int client_verify_mailbox_name(struct client_command_context *cmd,
-			       const char *mailbox,
-			       int should_exist, int should_not_exist)
+bool client_verify_mailbox_name(struct client_command_context *cmd,
+				const char *mailbox,
+				bool should_exist, bool should_not_exist)
 {
 	struct mail_storage *storage;
 	enum mailbox_name_status mailbox_status;
@@ -104,7 +104,7 @@
 	return FALSE;
 }
 
-int client_verify_open_mailbox(struct client_command_context *cmd)
+bool client_verify_open_mailbox(struct client_command_context *cmd)
 {
 	if (cmd->client->mailbox != NULL)
 		return TRUE;
@@ -118,7 +118,7 @@
 			       struct mail_storage *storage)
 {
 	const char *error;
-	int syntax, temporary_error;
+	bool syntax, temporary_error;
 
 	if (cmd->client->mailbox != NULL &&
 	    mailbox_is_inconsistent(cmd->client->mailbox)) {
@@ -137,7 +137,7 @@
 					struct mail_storage *storage)
 {
 	const char *error;
-	int syntax, temporary_error;
+	bool syntax, temporary_error;
 
 	if (client->mailbox != NULL &&
 	    mailbox_is_inconsistent(client->mailbox)) {
@@ -152,8 +152,8 @@
 			 t_strconcat(syntax ? "* BAD " : "* NO ", error, NULL));
 }
 
-static int is_valid_keyword(struct client_command_context *cmd,
-			    const char *keyword)
+static bool is_valid_keyword(struct client_command_context *cmd,
+			     const char *keyword)
 {
 	const char *const *names;
 	unsigned int i, count;
@@ -178,9 +178,9 @@
 	return TRUE;
 }
 
-int client_parse_mail_flags(struct client_command_context *cmd,
-			    struct imap_arg *args, enum mail_flags *flags_r,
-			    const char *const **keywords_r)
+bool client_parse_mail_flags(struct client_command_context *cmd,
+			     struct imap_arg *args, enum mail_flags *flags_r,
+			     const char *const **keywords_r)
 {
 	const char *const *keywords;
 	char *atom;
@@ -285,13 +285,13 @@
 	}
 }
 
-int client_save_keywords(struct mailbox_keywords *dest,
-			 const array_t *keywords)
+bool client_save_keywords(struct mailbox_keywords *dest,
+			  const array_t *keywords)
 {
 	ARRAY_SET_TYPE(keywords, const char *);
 	const char *const *names, *const *old_names;
 	unsigned int i, count, old_count;
-	int changed;
+	bool changed;
 
 	names = array_get(keywords, &count);
 
@@ -328,8 +328,8 @@
 	return TRUE;
 }
 
-int mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
-		   const char *name2)
+bool mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
+		    const char *name2)
 {
 	struct mail_storage *storage1 = mailbox_get_storage(box1);
 	const char *name1;
--- a/src/imap/commands-util.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/commands-util.h	Fri Jan 13 22:25:57 2006 +0200
@@ -20,13 +20,13 @@
 
    If should_exist is FALSE, the should_not_exist specifies if we should
    return TRUE or FALSE if mailbox doesn't exist. */
-int client_verify_mailbox_name(struct client_command_context *cmd,
-			       const char *mailbox,
-			       int should_exist, int should_not_exist);
+bool client_verify_mailbox_name(struct client_command_context *cmd,
+				const char *mailbox,
+				bool should_exist, bool should_not_exist);
 
 /* Returns TRUE if mailbox is selected. If not, sends "No mailbox selected"
    error message to client. */
-int client_verify_open_mailbox(struct client_command_context *cmd);
+bool client_verify_open_mailbox(struct client_command_context *cmd);
 
 /* Send last mail storage error message to client. */
 void client_send_storage_error(struct client_command_context *cmd,
@@ -38,9 +38,9 @@
 
 /* Parse flags. Returns TRUE if successful, if not sends an error message to
    client. */
-int client_parse_mail_flags(struct client_command_context *cmd,
-			    struct imap_arg *args, enum mail_flags *flags_r,
-			    const char *const **keywords_r);
+bool client_parse_mail_flags(struct client_command_context *cmd,
+			     struct imap_arg *args, enum mail_flags *flags_r,
+			     const char *const **keywords_r);
 
 /* Send FLAGS + PERMANENTFLAGS to client. */
 void client_send_mailbox_flags(struct client *client, struct mailbox *box,
@@ -48,11 +48,11 @@
 
 /* Copy keywords into dest. dest must have been initialized. Returns TRUE if
    keywords changed. */
-int client_save_keywords(struct mailbox_keywords *dest,
-			 const array_t *keywords);
+bool client_save_keywords(struct mailbox_keywords *dest,
+			  const array_t *keywords);
 
-int mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
-		   const char *name2);
+bool mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
+		    const char *name2);
 
 void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str);
 void msgset_generator_next(struct msgset_generator_context *ctx, uint32_t uid);
--- a/src/imap/commands.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/commands.c	Fri Jan 13 22:25:57 2006 +0200
@@ -55,7 +55,7 @@
 	(sizeof(imap_ext_commands) / sizeof(imap_ext_commands[0]))
 
 static buffer_t *cmdbuf;
-static int cmdbuf_unsorted;
+static bool cmdbuf_unsorted;
 
 void command_register(const char *name, command_func_t *func)
 {
--- a/src/imap/commands.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/commands.h	Fri Jan 13 22:25:57 2006 +0200
@@ -8,7 +8,7 @@
 #include "imap-sync.h"
 #include "commands-util.h"
 
-typedef int command_func_t(struct client_command_context *cmd);
+typedef bool command_func_t(struct client_command_context *cmd);
 
 struct command {
 	const char *name;
@@ -32,51 +32,51 @@
 /* IMAP4rev1 commands: */
 
 /* Non-Authenticated State */
-int cmd_authenticate(struct client_command_context *cmd);
-int cmd_login(struct client_command_context *cmd);
-int cmd_logout(struct client_command_context *cmd);
+bool cmd_authenticate(struct client_command_context *cmd);
+bool cmd_login(struct client_command_context *cmd);
+bool cmd_logout(struct client_command_context *cmd);
 
-int cmd_capability(struct client_command_context *cmd);
-int cmd_noop(struct client_command_context *cmd);
+bool cmd_capability(struct client_command_context *cmd);
+bool cmd_noop(struct client_command_context *cmd);
 
 /* Authenticated State */
-int cmd_select(struct client_command_context *cmd);
-int cmd_examine(struct client_command_context *cmd);
+bool cmd_select(struct client_command_context *cmd);
+bool cmd_examine(struct client_command_context *cmd);
 
-int cmd_create(struct client_command_context *cmd);
-int cmd_delete(struct client_command_context *cmd);
-int cmd_rename(struct client_command_context *cmd);
+bool cmd_create(struct client_command_context *cmd);
+bool cmd_delete(struct client_command_context *cmd);
+bool cmd_rename(struct client_command_context *cmd);
 
-int cmd_subscribe(struct client_command_context *cmd);
-int cmd_unsubscribe(struct client_command_context *cmd);
+bool cmd_subscribe(struct client_command_context *cmd);
+bool cmd_unsubscribe(struct client_command_context *cmd);
 
-int cmd_list(struct client_command_context *cmd);
-int cmd_lsub(struct client_command_context *cmd);
+bool cmd_list(struct client_command_context *cmd);
+bool cmd_lsub(struct client_command_context *cmd);
 
-int cmd_status(struct client_command_context *cmd);
-int cmd_append(struct client_command_context *cmd);
+bool cmd_status(struct client_command_context *cmd);
+bool cmd_append(struct client_command_context *cmd);
 
 /* Selected state */
-int cmd_check(struct client_command_context *cmd);
-int cmd_close(struct client_command_context *cmd);
-int cmd_expunge(struct client_command_context *cmd);
-int cmd_search(struct client_command_context *cmd);
-int cmd_fetch(struct client_command_context *cmd);
-int cmd_store(struct client_command_context *cmd);
-int cmd_copy(struct client_command_context *cmd);
-int cmd_uid(struct client_command_context *cmd);
+bool cmd_check(struct client_command_context *cmd);
+bool cmd_close(struct client_command_context *cmd);
+bool cmd_expunge(struct client_command_context *cmd);
+bool cmd_search(struct client_command_context *cmd);
+bool cmd_fetch(struct client_command_context *cmd);
+bool cmd_store(struct client_command_context *cmd);
+bool cmd_copy(struct client_command_context *cmd);
+bool cmd_uid(struct client_command_context *cmd);
 
 /* IMAP extensions: */
-int cmd_idle(struct client_command_context *cmd);
-int cmd_namespace(struct client_command_context *cmd);
-int cmd_sort(struct client_command_context *cmd);
-int cmd_thread(struct client_command_context *cmd);
-int cmd_uid_expunge(struct client_command_context *cmd);
-int cmd_unselect(struct client_command_context *cmd);
+bool cmd_idle(struct client_command_context *cmd);
+bool cmd_namespace(struct client_command_context *cmd);
+bool cmd_sort(struct client_command_context *cmd);
+bool cmd_thread(struct client_command_context *cmd);
+bool cmd_uid_expunge(struct client_command_context *cmd);
+bool cmd_unselect(struct client_command_context *cmd);
 
 /* private: */
-int _cmd_list_full(struct client_command_context *cmd, int lsub);
-int _cmd_select_full(struct client_command_context *cmd, int readonly);
-int _cmd_subscribe_full(struct client_command_context *cmd, int subscribe);
+bool _cmd_list_full(struct client_command_context *cmd, bool lsub);
+bool _cmd_select_full(struct client_command_context *cmd, bool readonly);
+bool _cmd_subscribe_full(struct client_command_context *cmd, bool subscribe);
 
 #endif
--- a/src/imap/imap-expunge.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-expunge.c	Fri Jan 13 22:25:57 2006 +0200
@@ -5,14 +5,14 @@
 #include "mail-search.h"
 #include "imap-expunge.h"
 
-int imap_expunge(struct mailbox *box, struct mail_search_arg *next_search_arg)
+bool imap_expunge(struct mailbox *box, struct mail_search_arg *next_search_arg)
 {
 	struct mail_search_context *ctx;
         struct mailbox_transaction_context *t;
 	struct mail *mail;
 	struct mail_search_arg search_arg;
         enum mailbox_sync_flags flags;
-	int failed = FALSE;
+	bool failed = FALSE;
 
 	memset(&search_arg, 0, sizeof(search_arg));
 	search_arg.type = SEARCH_DELETED;
--- a/src/imap/imap-expunge.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-expunge.h	Fri Jan 13 22:25:57 2006 +0200
@@ -1,6 +1,6 @@
 #ifndef __IMAP_EXPUNGE_H
 #define __IMAP_EXPUNGE_H
 
-int imap_expunge(struct mailbox *box, struct mail_search_arg *next_search_arg);
+bool imap_expunge(struct mailbox *box, struct mail_search_arg *next_search_arg);
 
 #endif
--- a/src/imap/imap-fetch-body.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-fetch-body.c	Fri Jan 13 22:25:57 2006 +0200
@@ -37,17 +37,17 @@
 	unsigned int uid;
 
 	uoff_t physical_start;
-	int cr_skipped;
+	bool cr_skipped;
 	struct message_size pos;
 };
 
 static struct partial_cache partial = { 0, 0, 0, 0, { 0, 0, 0 } };
 
-static int seek_partial(unsigned int select_counter, unsigned int uid,
-			struct partial_cache *partial, struct istream *stream,
-			uoff_t virtual_skip)
+static bool seek_partial(unsigned int select_counter, unsigned int uid,
+			 struct partial_cache *partial, struct istream *stream,
+			 uoff_t virtual_skip)
 {
-	int cr_skipped;
+	bool cr_skipped;
 
 	if (select_counter == partial->select_counter && uid == partial->uid &&
 	    stream->v_offset == partial->physical_start &&
@@ -107,15 +107,15 @@
 }
 
 static off_t imap_fetch_send(struct ostream *output, struct istream *input,
-			     int cr_skipped, uoff_t virtual_size,
-			     int add_missing_eoh, int *last_cr)
+			     bool cr_skipped, uoff_t virtual_size,
+			     bool add_missing_eoh, bool *last_cr)
 {
 	const unsigned char *msg;
 	size_t i, size;
 	uoff_t vsize_left, sent;
 	off_t ret;
 	unsigned char add;
-	int blocks = FALSE;
+	bool blocks = FALSE;
 
 	/* go through the message data and insert CRs where needed.  */
 	sent = 0; vsize_left = virtual_size;
@@ -335,7 +335,7 @@
 }
 
 static void header_filter_eoh(struct message_header_line *hdr,
-			      int *matched __attr_unused__, void *context)
+			      bool *matched __attr_unused__, void *context)
 {
 	struct imap_fetch_context *ctx = context;
 
@@ -555,7 +555,7 @@
 	return 1;
 }
 
-static int fetch_body_header_fields_check(const char *section)
+static bool fetch_body_header_fields_check(const char *section)
 {
 	if (*section++ != '(')
 		return FALSE;
@@ -577,9 +577,9 @@
 	return TRUE;
 }
 
-static int fetch_body_header_fields_init(struct imap_fetch_context *ctx,
-					 struct imap_fetch_body_data *body,
-					 const char *section)
+static bool fetch_body_header_fields_init(struct imap_fetch_context *ctx,
+					  struct imap_fetch_body_data *body,
+					  const char *section)
 {
 	const char *const *arr;
 
@@ -608,8 +608,8 @@
 	return TRUE;
 }
 
-static int fetch_body_section_name_init(struct imap_fetch_context *ctx,
-					struct imap_fetch_body_data *body)
+static bool fetch_body_section_name_init(struct imap_fetch_context *ctx,
+					 struct imap_fetch_body_data *body)
 {
 	const char *section = body->section;
 
@@ -672,7 +672,7 @@
 
 /* Parse next digits in string into integer. Returns FALSE if the integer
    becomes too big and wraps. */
-static int read_uoff_t(const char **p, uoff_t *value)
+static bool read_uoff_t(const char **p, uoff_t *value)
 {
 	uoff_t prev;
 
@@ -690,10 +690,10 @@
 	return TRUE;
 }
 
-static int body_section_build(struct imap_fetch_context *ctx,
-			      struct imap_fetch_body_data *body,
-			      const char *prefix,
-			      const struct imap_arg_list *list)
+static bool body_section_build(struct imap_fetch_context *ctx,
+			       struct imap_fetch_body_data *body,
+			       const char *prefix,
+			       const struct imap_arg_list *list)
 {
 	string_t *str;
 	const char **arr;
@@ -736,8 +736,8 @@
 	return TRUE;
 }
   
-int fetch_body_section_init(struct imap_fetch_context *ctx, const char *name,
-			    struct imap_arg **args)
+bool fetch_body_section_init(struct imap_fetch_context *ctx, const char *name,
+			     struct imap_arg **args)
 {
 	struct imap_fetch_body_data *body;
 	const char *partial;
@@ -916,8 +916,8 @@
 	return fetch_stream(ctx, &body_size);
 }
 
-int fetch_rfc822_init(struct imap_fetch_context *ctx, const char *name,
-		      struct imap_arg **args __attr_unused__)
+bool fetch_rfc822_init(struct imap_fetch_context *ctx, const char *name,
+		       struct imap_arg **args __attr_unused__)
 {
 	if (name[6] == '\0') {
 		ctx->fetch_data |= MAIL_FETCH_STREAM_HEADER |
--- a/src/imap/imap-fetch.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-fetch.c	Fri Jan 13 22:25:57 2006 +0200
@@ -57,8 +57,8 @@
 	return name[i] < 'A' || name[i] >= 'Z' ? 0 : -1;
 }
 
-int imap_fetch_init_handler(struct imap_fetch_context *ctx, const char *name,
-			    struct imap_arg **args)
+bool imap_fetch_init_handler(struct imap_fetch_context *ctx, const char *name,
+			     struct imap_arg **args)
 {
 	const struct imap_fetch_handler *handler;
 
@@ -100,7 +100,7 @@
 	return ctx;
 }
 
-void imap_fetch_add_handler(struct imap_fetch_context *ctx, int buffered,
+void imap_fetch_add_handler(struct imap_fetch_context *ctx, bool buffered,
 			    imap_fetch_handler_t *handler, void *context)
 {
 	/* partially because of broken clients, but also partially because
@@ -360,8 +360,8 @@
 	return 1;
 }
 
-static int fetch_body_init(struct imap_fetch_context *ctx, const char *name,
-			   struct imap_arg **args)
+static bool fetch_body_init(struct imap_fetch_context *ctx, const char *name,
+			    struct imap_arg **args)
 {
 	if (name[4] == '\0') {
 		ctx->fetch_data |= MAIL_FETCH_IMAP_BODY;
@@ -395,9 +395,9 @@
 	return 1;
 }
 
-static int fetch_bodystructure_init(struct imap_fetch_context *ctx,
-				    const char *name __attr_unused__,
-				    struct imap_arg **args __attr_unused__)
+static bool fetch_bodystructure_init(struct imap_fetch_context *ctx,
+				     const char *name __attr_unused__,
+				     struct imap_arg **args __attr_unused__)
 {
 	ctx->fetch_data |= MAIL_FETCH_IMAP_BODYSTRUCTURE;
 	imap_fetch_add_handler(ctx, FALSE, fetch_bodystructure, NULL);
@@ -427,9 +427,9 @@
 	return 1;
 }
 
-static int fetch_envelope_init(struct imap_fetch_context *ctx,
-			       const char *name __attr_unused__,
-			       struct imap_arg **args __attr_unused__)
+static bool fetch_envelope_init(struct imap_fetch_context *ctx,
+				const char *name __attr_unused__,
+				struct imap_arg **args __attr_unused__)
 {
 	ctx->fetch_data |= MAIL_FETCH_IMAP_ENVELOPE;
 	imap_fetch_add_handler(ctx, FALSE, fetch_envelope, NULL);
@@ -460,9 +460,9 @@
 	return 1;
 }
 
-static int fetch_flags_init(struct imap_fetch_context *ctx,
-			    const char *name __attr_unused__,
-			    struct imap_arg **args __attr_unused__)
+static bool fetch_flags_init(struct imap_fetch_context *ctx,
+			     const char *name __attr_unused__,
+			     struct imap_arg **args __attr_unused__)
 {
 	ctx->flags_have_handler = TRUE;
 	ctx->fetch_data |= MAIL_FETCH_FLAGS;
@@ -485,9 +485,9 @@
 }
 
 
-static int fetch_internaldate_init(struct imap_fetch_context *ctx,
-				   const char *name __attr_unused__,
-				   struct imap_arg **args __attr_unused__)
+static bool fetch_internaldate_init(struct imap_fetch_context *ctx,
+				    const char *name __attr_unused__,
+				    struct imap_arg **args __attr_unused__)
 {
 	ctx->fetch_data |= MAIL_FETCH_RECEIVED_DATE;
 	imap_fetch_add_handler(ctx, TRUE, fetch_internaldate, NULL);
@@ -501,9 +501,9 @@
 	return 1;
 }
 
-static int fetch_uid_init(struct imap_fetch_context *ctx __attr_unused__,
-			  const char *name __attr_unused__,
-			  struct imap_arg **args __attr_unused__)
+static bool fetch_uid_init(struct imap_fetch_context *ctx __attr_unused__,
+			   const char *name __attr_unused__,
+			   struct imap_arg **args __attr_unused__)
 {
 	imap_fetch_add_handler(ctx, TRUE, fetch_uid, NULL);
 	return TRUE;
--- a/src/imap/imap-fetch.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-fetch.h	Fri Jan 13 22:25:57 2006 +0200
@@ -12,14 +12,14 @@
 	const char *name;
 
 	/* Returns FALSE if arg is invalid. */
-	int (*init)(struct imap_fetch_context *ctx, const char *name,
-		    struct imap_arg **args);
+	bool (*init)(struct imap_fetch_context *ctx, const char *name,
+		     struct imap_arg **args);
 };
 
 struct imap_fetch_context_handler {
 	imap_fetch_handler_t *handler;
 	void *context;
-	int buffered;
+	bool buffered;
 };
 
 struct imap_fetch_context {
@@ -43,7 +43,7 @@
 	uoff_t cur_size, cur_offset;
 	string_t *cur_str;
 	struct istream *cur_input;
-	int skip_cr;
+	bool skip_cr;
 	int (*cont_handler)(struct imap_fetch_context *ctx);
 
 	unsigned int select_counter;
@@ -63,21 +63,21 @@
 void imap_fetch_handlers_register(const struct imap_fetch_handler *handlers,
 				  size_t count);
 
-void imap_fetch_add_handler(struct imap_fetch_context *ctx, int buffered,
+void imap_fetch_add_handler(struct imap_fetch_context *ctx, bool buffered,
 			    imap_fetch_handler_t *handler, void *context);
 
 struct imap_fetch_context *imap_fetch_init(struct client_command_context *cmd);
 int imap_fetch_deinit(struct imap_fetch_context *ctx);
-int imap_fetch_init_handler(struct imap_fetch_context *ctx, const char *name,
-			    struct imap_arg **args);
+bool imap_fetch_init_handler(struct imap_fetch_context *ctx, const char *name,
+			     struct imap_arg **args);
 
 void imap_fetch_begin(struct imap_fetch_context *ctx,
 		      struct mail_search_arg *search_arg);
 int imap_fetch(struct imap_fetch_context *ctx);
 
-int fetch_body_section_init(struct imap_fetch_context *ctx, const char *name,
-			    struct imap_arg **args);
-int fetch_rfc822_init(struct imap_fetch_context *ctx, const char *name,
-		      struct imap_arg **args);
+bool fetch_body_section_init(struct imap_fetch_context *ctx, const char *name,
+			     struct imap_arg **args);
+bool fetch_rfc822_init(struct imap_fetch_context *ctx, const char *name,
+		       struct imap_arg **args);
 
 #endif
--- a/src/imap/imap-search.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-search.c	Fri Jan 13 22:25:57 2006 +0200
@@ -18,7 +18,7 @@
 		  struct mail_search_seqset **seqset_r, const char **error_r)
 {
 	struct mail_search_seqset *seqset, **p;
-	int syntax, temporary, last;
+	bool syntax, temporary, last;
 
 	*seqset_r = imap_messageset_parse(pool, uidset);
 	if (*seqset_r == NULL) {
@@ -78,10 +78,10 @@
 #define ARG_NEW_HEADER(type, hdr_name) \
 	arg_new(data, args, next_sarg, type, TRUE, hdr_name)
 
-static int arg_new(struct search_build_data *data, struct imap_arg **args,
-		   struct mail_search_arg **next_sarg,
-		   enum mail_search_arg_type type, int have_value,
-		   const char *hdr_name)
+static bool arg_new(struct search_build_data *data, struct imap_arg **args,
+		    struct mail_search_arg **next_sarg,
+		    enum mail_search_arg_type type, bool have_value,
+		    const char *hdr_name)
 {
 	struct mail_search_arg *sarg;
 
@@ -109,9 +109,9 @@
 	return TRUE;
 }
 
-static int search_arg_build(struct search_build_data *data,
-			    struct imap_arg **args,
-			    struct mail_search_arg **next_sarg)
+static bool search_arg_build(struct search_build_data *data,
+			     struct imap_arg **args,
+			     struct mail_search_arg **next_sarg)
 {
         struct mail_search_seqset *seqset;
 	struct mail_search_arg **subargs;
@@ -450,7 +450,7 @@
 
 struct mail_search_arg *
 imap_search_get_arg(struct client_command_context *cmd,
-		    const char *set, int uid)
+		    const char *set, bool uid)
 {
 	struct mail_search_arg *search_arg;
 	const char *error;
--- a/src/imap/imap-search.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-search.h	Fri Jan 13 22:25:57 2006 +0200
@@ -12,6 +12,6 @@
 
 struct mail_search_arg *
 imap_search_get_arg(struct client_command_context *cmd,
-		    const char *set, int uid);
+		    const char *set, bool uid);
 
 #endif
--- a/src/imap/imap-sort.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-sort.c	Fri Jan 13 22:25:57 2006 +0200
@@ -49,7 +49,7 @@
 	uoff_t last_size;
 	char *last_cc, *last_from, *last_subject, *last_to;
 
-	int written, id_is_uid;
+	bool written, id_is_uid;
 };
 
 static void mail_sort_input(struct sort_context *ctx, struct mail *mail);
@@ -59,10 +59,10 @@
 mail_sort_normalize(const enum mail_sort_type *input, buffer_t *output)
 {
         enum mail_sort_type type, mask = 0;
-	int pos, reverse;
+	bool reverse;
 
 	reverse = FALSE;
-	for (pos = 0; *input != MAIL_SORT_END; input++) {
+	for (; *input != MAIL_SORT_END; input++) {
 		if (*input == MAIL_SORT_REVERSE)
 			reverse = !reverse;
 		else {
@@ -306,7 +306,7 @@
 	const char *str;
 	time_t t;
 	uoff_t size;
-	int changed = FALSE;
+	bool changed = FALSE;
 
 	if (ctx->common_mask & MAIL_SORT_ARRIVAL) {
 		t = mail_get_received_date(mail);
@@ -633,7 +633,8 @@
 static int mail_sort_qsort_func(const void *p1, const void *p2)
 {
 	enum mail_sort_type *sorting;
-	int ret, reverse = FALSE;
+	int ret;
+	bool reverse = FALSE;
 
 	sorting = qsort_context->sort_program;
 
--- a/src/imap/imap-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -26,7 +26,7 @@
 
 	unsigned int messages_count;
 
-	int failed;
+	bool failed;
 };
 
 struct imap_sync_context *
@@ -186,7 +186,7 @@
 	return mailbox_sync_deinit(ctx, &status);
 }
 
-static int cmd_sync_continue(struct client_command_context *cmd)
+static bool cmd_sync_continue(struct client_command_context *cmd)
 {
 	struct cmd_sync_context *ctx = cmd->context;
 	int ret;
@@ -206,8 +206,8 @@
 	return TRUE;
 }
 
-int cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags,
-	     enum imap_sync_flags imap_flags, const char *tagline)
+bool cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags,
+	      enum imap_sync_flags imap_flags, const char *tagline)
 {
         struct cmd_sync_context *ctx;
 
--- a/src/imap/imap-sync.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-sync.h	Fri Jan 13 22:25:57 2006 +0200
@@ -15,7 +15,7 @@
 
 int imap_sync_nonselected(struct mailbox *box, enum mailbox_sync_flags flags);
 
-int cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags,
-	     enum imap_sync_flags imap_flags, const char *tagline);
+bool cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags,
+	      enum imap_sync_flags imap_flags, const char *tagline);
 
 #endif
--- a/src/imap/imap-thread.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/imap-thread.c	Fri Jan 13 22:25:57 2006 +0200
@@ -84,7 +84,7 @@
 	struct node root_node;
 	size_t root_count; /* not exact after prune_dummy_messages() */
 
-	int id_is_uid;
+	bool id_is_uid;
 };
 
 static void mail_thread_input(struct thread_context *ctx, struct mail *mail);
@@ -220,7 +220,7 @@
 	return node;
 }
 
-static int get_untokenized_msgid(const char **msgid_p, string_t *msgid)
+static bool get_untokenized_msgid(const char **msgid_p, string_t *msgid)
 {
 	struct rfc822_parser_context parser;
 
@@ -279,7 +279,7 @@
 	const char *msgid = *msgid_p;
 	const char *p;
 	string_t *str = NULL;
-	int found_at;
+	bool found_at;
 
 	if (*msgid_p == NULL)
 		return NULL;
@@ -341,7 +341,7 @@
 }
 
 static void unlink_child(struct thread_context *ctx,
-			 struct node *child, int add_to_root)
+			 struct node *child, bool add_to_root)
 {
 	struct node **node;
 
@@ -360,7 +360,7 @@
 		add_root(ctx, child);
 }
 
-static int find_child(struct node *node, struct node *child)
+static bool find_child(struct node *node, struct node *child)
 {
 	do {
 		if (node == child)
@@ -378,7 +378,7 @@
 }
 
 static void link_node(struct thread_context *ctx, const char *parent_msgid,
-		      struct node *child, int replace)
+		      struct node *child, bool replace)
 {
 	struct node *parent, **node;
 
@@ -415,7 +415,7 @@
 
 static void link_message(struct thread_context *ctx,
 			 const char *parent_msgid, const char *child_msgid,
-			 int replace)
+			 bool replace)
 {
 	struct node *child;
 
@@ -426,8 +426,8 @@
 	link_node(ctx, parent_msgid, child, replace);
 }
 
-static int link_references(struct thread_context *ctx,
-			   struct node *node, const char *references)
+static bool link_references(struct thread_context *ctx,
+			    struct node *node, const char *references)
 {
 	const char *parent_id, *child_id;
 
@@ -638,7 +638,7 @@
 	struct node *hash_node;
 	char *hash_subject;
 	void *key, *value;
-	int is_reply_or_forward;
+	bool is_reply_or_forward;
 
 	if (subject == NULL)
 		return;
@@ -845,8 +845,8 @@
 	ctx->root_node.first_child = sort_nodes(ctx->root_node.first_child);
 }
 
-static int send_nodes(struct thread_context *ctx,
-		      string_t *str, struct node *node)
+static bool send_nodes(struct thread_context *ctx,
+		       string_t *str, struct node *node)
 {
 	if (node->next == NULL && NODE_HAS_PARENT(ctx, node)) {
 		/* no siblings - special case to avoid extra paranthesis */
--- a/src/imap/namespace.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/imap/namespace.c	Fri Jan 13 22:25:57 2006 +0200
@@ -32,7 +32,7 @@
 {
         struct namespace *ns;
         const char *sep, *type, *prefix;
-	int inbox, hidden, subscriptions;
+	bool inbox, hidden, subscriptions;
 
 	ns = p_new(pool, struct namespace, 1);
 
@@ -200,7 +200,7 @@
 	const char *box = *mailbox;
 	struct namespace *best = NULL;
 	size_t best_len = 0;
-	int inbox;
+	bool inbox;
 
 	inbox = strncasecmp(box, "INBOX", 5) == 0;
 	if (inbox && box[5] == '\0') {
--- a/src/lib-auth/auth-client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-auth/auth-client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -86,8 +86,9 @@
 	return NULL;
 }
 
-int auth_client_reserve_connection(struct auth_client *client, const char *mech,
-				   struct auth_connect_id *id_r)
+bool auth_client_reserve_connection(struct auth_client *client,
+				    const char *mech,
+				    struct auth_connect_id *id_r)
 {
 	struct auth_server_connection *conn;
 	const char *error;
@@ -102,7 +103,7 @@
 	return TRUE;
 }
 
-int auth_client_is_connected(struct auth_client *client)
+bool auth_client_is_connected(struct auth_client *client)
 {
 	return !client->reconnect &&
 		client->conn_waiting_handshake_count == 0;
--- a/src/lib-auth/auth-client.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-auth/auth-client.h	Fri Jan 13 22:25:57 2006 +0200
@@ -38,13 +38,13 @@
 				     const char *const *args, void *context);
 
 typedef void auth_connect_notify_callback_t(struct auth_client *client,
-					    int connected, void *context);
+					    bool connected, void *context);
 
 /* Create new authentication client. */
 struct auth_client *auth_client_new(unsigned int client_pid);
 void auth_client_free(struct auth_client *client);
 
-int auth_client_is_connected(struct auth_client *client);
+bool auth_client_is_connected(struct auth_client *client);
 void auth_client_set_connect_notify(struct auth_client *client,
 				    auth_connect_notify_callback_t *callback,
 				    void *context);
@@ -58,8 +58,9 @@
    auth_client_request_new() to force it to use the same connection, or fail.
    This is currently useful only for APOP authentication. Returns TRUE if
    successfull. */
-int auth_client_reserve_connection(struct auth_client *client, const char *mech,
-				   struct auth_connect_id *id_r);
+bool auth_client_reserve_connection(struct auth_client *client,
+				    const char *mech,
+				    struct auth_connect_id *id_r);
 
 /* Create a new authentication request. callback is called whenever something
    happens for the request. id can be NULL. */
--- a/src/lib-auth/auth-server-connection.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-auth/auth-server-connection.c	Fri Jan 13 22:25:57 2006 +0200
@@ -34,7 +34,7 @@
 	}
 }
 
-static int
+static bool
 auth_client_input_mech(struct auth_server_connection *conn, const char *args)
 {
 	const char *const *list;
@@ -77,7 +77,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 auth_client_input_spid(struct auth_server_connection *conn, const char *args)
 {
 	if (conn->handshake_received) {
@@ -89,7 +89,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 auth_client_input_cuid(struct auth_server_connection *conn, const char *args)
 {
 	if (conn->handshake_received) {
@@ -101,7 +101,7 @@
 	return TRUE;
 }
 
-static int auth_client_input_done(struct auth_server_connection *conn)
+static bool auth_client_input_done(struct auth_server_connection *conn)
 {
 	conn->available_auth_mechs = conn->auth_mechs_buf->data;
 	conn->available_auth_mechs_count =
@@ -256,7 +256,7 @@
 }
 
 void auth_server_connection_destroy(struct auth_server_connection *conn,
-				    int reconnect)
+				    bool reconnect)
 {
 	struct auth_client *client = conn->client;
 	struct auth_server_connection **pos;
--- a/src/lib-auth/auth-server-connection.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-auth/auth-server-connection.h	Fri Jan 13 22:25:57 2006 +0200
@@ -55,7 +55,7 @@
 struct auth_server_connection *
 auth_server_connection_new(struct auth_client *client, const char *path);
 void auth_server_connection_destroy(struct auth_server_connection *conn,
-				    int reconnect);
+				    bool reconnect);
 
 struct auth_server_connection *
 auth_server_connection_find_path(struct auth_client *client, const char *path);
--- a/src/lib-auth/auth-server-request.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-auth/auth-server-request.c	Fri Jan 13 22:25:57 2006 +0200
@@ -31,8 +31,8 @@
 	unsigned int retrying:1;
 };
 
-static int auth_server_send_new_request(struct auth_server_connection *conn,
-					struct auth_request *request);
+static bool auth_server_send_new_request(struct auth_server_connection *conn,
+					 struct auth_request *request);
 static void auth_client_request_free(struct auth_request *request);
 
 static struct auth_server_connection *
@@ -67,7 +67,7 @@
 	}
 }
 
-static int is_valid_string(const char *str)
+static bool is_valid_string(const char *str)
 {
 	const char *p;
 
@@ -80,8 +80,8 @@
 	return TRUE;
 }
 
-static int auth_server_send_new_request(struct auth_server_connection *conn,
-					struct auth_request *request)
+static bool auth_server_send_new_request(struct auth_server_connection *conn,
+					 struct auth_request *request)
 {
 	string_t *str;
 	ssize_t ret;
@@ -148,7 +148,7 @@
 	}
 }
 
-int auth_client_input_ok(struct auth_server_connection *conn, const char *args)
+bool auth_client_input_ok(struct auth_server_connection *conn, const char *args)
 {
 	const char *const *list, *const *args_list, *data_base64;
 	struct auth_request *request;
@@ -187,8 +187,8 @@
 	return TRUE;
 }
 
-int auth_client_input_cont(struct auth_server_connection *conn,
-			   const char *args)
+bool auth_client_input_cont(struct auth_server_connection *conn,
+			    const char *args)
 {
 	struct auth_request *request;
 	const char *data;
@@ -217,8 +217,8 @@
 	return TRUE;
 }
 
-int auth_client_input_fail(struct auth_server_connection *conn,
-			   const char *args)
+bool auth_client_input_fail(struct auth_server_connection *conn,
+			    const char *args)
 {
 	struct auth_request *request;
         struct auth_server_connection *next;
--- a/src/lib-auth/auth-server-request.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-auth/auth-server-request.h	Fri Jan 13 22:25:57 2006 +0200
@@ -1,11 +1,12 @@
 #ifndef __AUTH_SERVER_REQUEST_H
 #define __AUTH_SERVER_REQUEST_H
 
-int auth_client_input_ok(struct auth_server_connection *conn, const char *args);
-int auth_client_input_cont(struct auth_server_connection *conn,
+bool auth_client_input_ok(struct auth_server_connection *conn,
+			  const char *args);
+bool auth_client_input_cont(struct auth_server_connection *conn,
 			   const char *args);
-int auth_client_input_fail(struct auth_server_connection *conn,
-			   const char *args);
+bool auth_client_input_fail(struct auth_server_connection *conn,
+			    const char *args);
 
 void auth_server_requests_remove_all(struct auth_server_connection *conn);
 
--- a/src/lib-charset/charset-iconv.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-charset/charset-iconv.c	Fri Jan 13 22:25:57 2006 +0200
@@ -11,15 +11,15 @@
 
 struct charset_translation {
 	iconv_t cd;
-	int ascii;
+	bool ascii;
 };
 
 struct charset_translation *charset_to_utf8_begin(const char *charset,
-						  int *unknown_charset)
+						  bool *unknown_charset)
 {
 	struct charset_translation *t;
 	iconv_t cd;
-	int ascii;
+	bool ascii;
 
 	if (unknown_charset != NULL)
 		*unknown_charset = FALSE;
@@ -110,9 +110,9 @@
 }
 
 static const char *
-charset_to_utf8_string_int(const char *charset, int *unknown_charset,
+charset_to_utf8_string_int(const char *charset, bool *unknown_charset,
 			   const unsigned char *data, size_t size,
-			   size_t *utf8_size_r, int ucase)
+			   size_t *utf8_size_r, bool ucase)
 {
 	iconv_t cd;
 	ICONV_CONST char *inbuf;
@@ -180,7 +180,7 @@
 }
 
 const char *
-charset_to_utf8_string(const char *charset, int *unknown_charset,
+charset_to_utf8_string(const char *charset, bool *unknown_charset,
 		       const unsigned char *data, size_t size,
 		       size_t *utf8_size_r)
 {
@@ -189,7 +189,7 @@
 }
 
 const char *
-charset_to_ucase_utf8_string(const char *charset, int *unknown_charset,
+charset_to_ucase_utf8_string(const char *charset, bool *unknown_charset,
 			     const unsigned char *data, size_t size,
 			     size_t *utf8_size_r)
 {
--- a/src/lib-charset/charset-utf8.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-charset/charset-utf8.c	Fri Jan 13 22:25:57 2006 +0200
@@ -42,7 +42,7 @@
 static struct charset_translation ascii_translation, utf8_translation;
 
 struct charset_translation *charset_to_utf8_begin(const char *charset,
-						  int *unknown_charset)
+						  bool *unknown_charset)
 {
 	if (unknown_charset != NULL)
 		*unknown_charset = FALSE;
@@ -87,7 +87,7 @@
 }
 
 const char *
-charset_to_utf8_string(const char *charset, int *unknown_charset,
+charset_to_utf8_string(const char *charset, bool *unknown_charset,
 		       const unsigned char *data, size_t size,
 		       size_t *utf8_size_r)
 {
@@ -108,7 +108,7 @@
 }
 
 const char *
-charset_to_ucase_utf8_string(const char *charset, int *unknown_charset,
+charset_to_ucase_utf8_string(const char *charset, bool *unknown_charset,
 			     const unsigned char *data, size_t size,
 			     size_t *utf8_size_r)
 {
--- a/src/lib-charset/charset-utf8.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-charset/charset-utf8.h	Fri Jan 13 22:25:57 2006 +0200
@@ -10,7 +10,7 @@
 
 /* Begin translation to UTF-8. */
 struct charset_translation *charset_to_utf8_begin(const char *charset,
-						  int *unknown_charset);
+						  bool *unknown_charset);
 
 void charset_to_utf8_end(struct charset_translation *t);
 
@@ -26,11 +26,11 @@
 /* Simple wrappers for above functions. If utf8_size is non-NULL, it's set
    to same as strlen(returned data). */
 const char *
-charset_to_utf8_string(const char *charset, int *unknown_charset,
+charset_to_utf8_string(const char *charset, bool *unknown_charset,
 		       const unsigned char *data, size_t size,
 		       size_t *utf8_size_r);
 const char *
-charset_to_ucase_utf8_string(const char *charset, int *unknown_charset,
+charset_to_ucase_utf8_string(const char *charset, bool *unknown_charset,
 			     const unsigned char *data, size_t size,
 			     size_t *utf8_size_r);
 
--- a/src/lib-dict/dict-client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-dict/dict-client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -34,7 +34,7 @@
 	struct dict_iterate_context ctx;
 
 	pool_t pool;
-	int failed;
+	bool failed;
 };
 
 struct client_dict_transaction_context {
@@ -43,7 +43,7 @@
 	unsigned int id;
 	unsigned int connect_counter;
 
-	int failed;
+	bool failed;
 };
 
 static int client_dict_connect(struct client_dict *dict);
@@ -300,7 +300,7 @@
 }
 
 static struct dict_iterate_context *
-client_dict_iterate_init(struct dict *_dict, const char *path, int recurse)
+client_dict_iterate_init(struct dict *_dict, const char *path, bool recurse)
 {
 	struct client_dict *dict = (struct client_dict *)_dict;
         struct client_dict_iterate_context *ctx;
--- a/src/lib-dict/dict-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-dict/dict-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -12,7 +12,7 @@
 
 	struct dict_iterate_context *
 		(*iterate_init)(struct dict *dict, const char *path,
-				int recurse);
+				bool recurse);
 	int (*iterate)(struct dict_iterate_context *ctx,
 		       const char **key_r, const char **value_r);
 	void (*iterate_deinit)(struct dict_iterate_context *ctx);
--- a/src/lib-dict/dict-sql.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-dict/dict-sql.c	Fri Jan 13 22:25:57 2006 +0200
@@ -149,7 +149,7 @@
 }
 
 static struct dict_iterate_context *
-sql_dict_iterate_init(struct dict *_dict, const char *path, int recurse)
+sql_dict_iterate_init(struct dict *_dict, const char *path, bool recurse)
 {
 	struct sql_dict *dict = (struct sql_dict *)_dict;
         struct sql_dict_iterate_context *ctx;
--- a/src/lib-dict/dict.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-dict/dict.c	Fri Jan 13 22:25:57 2006 +0200
@@ -83,7 +83,7 @@
 }
 
 struct dict_iterate_context *
-dict_iterate_init(struct dict *dict, const char *path, int recurse)
+dict_iterate_init(struct dict *dict, const char *path, bool recurse)
 {
 	return dict->v.iterate_init(dict, path, recurse);
 }
--- a/src/lib-dict/dict.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-dict/dict.h	Fri Jan 13 22:25:57 2006 +0200
@@ -17,12 +17,13 @@
 
 /* Lookup value for key. Set it to NULL if it's not found.
    Returns 1 if found, 0 if not found and -1 if lookup failed. */
-int dict_lookup(struct dict *dict, pool_t pool, const char *key, const char **value_r);
+int dict_lookup(struct dict *dict, pool_t pool,
+		const char *key, const char **value_r);
 
 /* Iterate through all values in a path. If recurse is FALSE, keys in
    the given path are returned, but not their children. */
 struct dict_iterate_context *
-dict_iterate_init(struct dict *dict, const char *path, int recurse);
+dict_iterate_init(struct dict *dict, const char *path, bool recurse);
 /* Returns -1 = error, 0 = finished, 1 = key/value set */
 int dict_iterate(struct dict_iterate_context *ctx,
 		 const char **key_r, const char **value_r);
--- a/src/lib-imap/imap-base-subject.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-base-subject.c	Fri Jan 13 22:25:57 2006 +0200
@@ -9,8 +9,8 @@
 #include "message-header-decode.h"
 #include "imap-base-subject.h"
 
-static int header_decode(const unsigned char *data, size_t size,
-			 const char *charset, void *context)
+static bool header_decode(const unsigned char *data, size_t size,
+			  const char *charset, void *context)
 {
 	buffer_t *buf = context;
         struct charset_translation *t;
@@ -45,7 +45,7 @@
 static void pack_whitespace(buffer_t *buf)
 {
 	char *data, *dest;
-	int last_lwsp;
+	bool last_lwsp;
 
 	data = buffer_get_modifyable_data(buf, NULL);
 
@@ -82,7 +82,7 @@
 }
 
 static void remove_subj_trailers(buffer_t *buf, size_t start_pos,
-				 int *is_reply_or_forward_r)
+				 bool *is_reply_or_forward_r)
 {
 	const char *data;
 	size_t orig_size, size;
@@ -112,7 +112,7 @@
 	}
 }
 
-static int remove_blob(const char **datap)
+static bool remove_blob(const char **datap)
 {
 	const char *data = *datap;
 
@@ -134,11 +134,11 @@
 	return TRUE;
 }
 
-static int remove_subj_leader(buffer_t *buf, size_t *start_pos,
-			      int *is_reply_or_forward_r)
+static bool remove_subj_leader(buffer_t *buf, size_t *start_pos,
+			       bool *is_reply_or_forward_r)
 {
 	const char *data, *orig_data;
-	int ret = FALSE;
+	bool ret = FALSE;
 
 	/* subj-leader     = (*subj-blob subj-refwd) / WSP
 
@@ -188,7 +188,7 @@
 	return TRUE;
 }
 
-static int remove_blob_when_nonempty(buffer_t *buf, size_t *start_pos)
+static bool remove_blob_when_nonempty(buffer_t *buf, size_t *start_pos)
 {
 	const char *data, *orig_data;
 
@@ -203,8 +203,8 @@
 	return FALSE;
 }
 
-static int remove_subj_fwd_hdr(buffer_t *buf, size_t *start_pos,
-			       int *is_reply_or_forward_r)
+static bool remove_subj_fwd_hdr(buffer_t *buf, size_t *start_pos,
+				bool *is_reply_or_forward_r)
 {
 	const char *data;
 	size_t size;
@@ -231,11 +231,11 @@
 }
 
 const char *imap_get_base_subject_cased(pool_t pool, const char *subject,
-					int *is_reply_or_forward_r)
+					bool *is_reply_or_forward_r)
 {
 	buffer_t *buf;
 	size_t start_pos, subject_len;
-	int found;
+	bool found;
 
 	if (is_reply_or_forward_r != NULL)
 		*is_reply_or_forward_r = FALSE;
--- a/src/lib-imap/imap-base-subject.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-base-subject.h	Fri Jan 13 22:25:57 2006 +0200
@@ -8,6 +8,6 @@
    is_reply_or_forward is set to TRUE if message looks like reply or forward,
    according to draft-ietf-imapext-thread-12 rules. */
 const char *imap_get_base_subject_cased(pool_t pool, const char *subject,
-					int *is_reply_or_forward_r);
+					bool *is_reply_or_forward_r);
 
 #endif
--- a/src/lib-imap/imap-bodystructure.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-bodystructure.c	Fri Jan 13 22:25:57 2006 +0200
@@ -60,7 +60,7 @@
 
 static void parse_save_params_list(const unsigned char *name, size_t name_len,
 				   const unsigned char *value, size_t value_len,
-				   int value_quoted __attr_unused__,
+				   bool value_quoted __attr_unused__,
 				   void *context)
 {
         struct message_part_body_data *data = context;
@@ -220,7 +220,7 @@
 {
 	struct message_part_body_data *part_data;
 	struct message_part_envelope_data *envelope;
-	int parent_rfc822;
+	bool parent_rfc822;
 
 	if (hdr == NULL) {
 		/* If there was no Mime-Version, forget all the Content-stuff */
@@ -264,7 +264,7 @@
 }
 
 static void part_write_body_multipart(struct message_part *part,
-				      string_t *str, int extended)
+				      string_t *str, bool extended)
 {
 	struct message_part_body_data *data = part->context;
 
@@ -330,10 +330,10 @@
 }
 
 static void part_write_body(struct message_part *part,
-			    string_t *str, int extended)
+			    string_t *str, bool extended)
 {
 	struct message_part_body_data *data = part->context;
-	int text;
+	bool text;
 
 	if (data == NULL) {
 		/* there was no content headers, use an empty structure */
@@ -441,7 +441,7 @@
 	}
 }
 
-int imap_bodystructure_is_plain_7bit(struct message_part *part)
+bool imap_bodystructure_is_plain_7bit(struct message_part *part)
 {
 	struct message_part_body_data *data = part->context;
 
@@ -487,7 +487,7 @@
 }
 
 void imap_bodystructure_write(struct message_part *part,
-			      string_t *dest, int extended)
+			      string_t *dest, bool extended)
 {
 	i_assert(part->parent != NULL || part->next == NULL);
 
@@ -507,7 +507,7 @@
 	}
 }
 
-static int str_append_imap_arg(string_t *str, const struct imap_arg *arg)
+static bool str_append_imap_arg(string_t *str, const struct imap_arg *arg)
 {
 	switch (arg->type) {
 	case IMAP_ARG_NIL:
@@ -535,7 +535,7 @@
 	return TRUE;
 }
 
-static int imap_write_list(const struct imap_arg *args, string_t *str)
+static bool imap_write_list(const struct imap_arg *args, string_t *str)
 {
 	/* don't do any typechecking, just write it out */
 	str_append_c(str, '(');
@@ -556,12 +556,13 @@
 	return TRUE;
 }
 
-static int imap_parse_bodystructure_args(const struct imap_arg *args,
-					 string_t *str)
+static bool imap_parse_bodystructure_args(const struct imap_arg *args,
+					  string_t *str)
 {
 	struct imap_arg *subargs;
 	struct imap_arg_list *list;
-	int i, multipart, text, message_rfc822;
+	bool multipart, text, message_rfc822;
+	int i;
 
 	multipart = FALSE;
 	while (args->type == IMAP_ARG_LIST) {
@@ -663,8 +664,8 @@
 	return TRUE;
 }
 
-int imap_body_parse_from_bodystructure(const char *bodystructure,
-				       string_t *dest)
+bool imap_body_parse_from_bodystructure(const char *bodystructure,
+					string_t *dest)
 {
 	struct istream *input;
 	struct imap_parser *parser;
--- a/src/lib-imap/imap-bodystructure.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-bodystructure.h	Fri Jan 13 22:25:57 2006 +0200
@@ -10,13 +10,13 @@
 
 /* Returns TRUE if BODYSTRUCTURE is
    ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" n n NIL NIL NIL) */
-int imap_bodystructure_is_plain_7bit(struct message_part *part);
+bool imap_bodystructure_is_plain_7bit(struct message_part *part);
 
 void imap_bodystructure_write(struct message_part *part,
-			      string_t *dest, int extended);
+			      string_t *dest, bool extended);
 
 /* Return BODY part from BODYSTRUCTURE */
-int imap_body_parse_from_bodystructure(const char *bodystructure,
-				       string_t *dest);
+bool imap_body_parse_from_bodystructure(const char *bodystructure,
+					string_t *dest);
 
 #endif
--- a/src/lib-imap/imap-date.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-date.c	Fri Jan 13 22:25:57 2006 +0200
@@ -79,7 +79,7 @@
 	return str;
 }
 
-int imap_parse_date(const char *str, time_t *time)
+bool imap_parse_date(const char *str, time_t *time)
 {
 	struct tm tm;
 
@@ -92,7 +92,7 @@
 	return *time != (time_t)-1;
 }
 
-int imap_parse_datetime(const char *str, time_t *time, int *timezone_offset)
+bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset)
 {
 	struct tm tm;
 
--- a/src/lib-imap/imap-date.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-date.h	Fri Jan 13 22:25:57 2006 +0200
@@ -4,8 +4,8 @@
 /* Parses IMAP date/time string. time_t is filled with UTC date.
    timezone_offset is filled with parsed timezone. If no timezone is given,
    local timezone is assumed. */
-int imap_parse_date(const char *str, time_t *time);
-int imap_parse_datetime(const char *str, time_t *time, int *timezone_offset);
+bool imap_parse_date(const char *str, time_t *time);
+bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset);
 
 /* Returns given UTC time in local timezone. */
 const char *imap_to_datetime(time_t time);
--- a/src/lib-imap/imap-envelope.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-envelope.c	Fri Jan 13 22:25:57 2006 +0200
@@ -25,7 +25,7 @@
 	NULL
 };
 
-int imap_envelope_get_field(const char *name, enum imap_envelope_field *ret)
+bool imap_envelope_get_field(const char *name, enum imap_envelope_field *ret)
 {
 	*ret = (enum imap_envelope_field)-1;
 
@@ -211,8 +211,8 @@
 	str_append(str, NVL(data->message_id, "NIL"));
 }
 
-static int imap_address_arg_append(struct imap_arg *arg, string_t *str,
-				   int *in_group)
+static bool imap_address_arg_append(struct imap_arg *arg, string_t *str,
+				    bool *in_group)
 {
 	struct imap_arg_list *list;
 	const char *args[4];
@@ -293,7 +293,7 @@
 	struct imap_arg_list *list;
 	string_t *str;
 	size_t i;
-	int in_group;
+	bool in_group;
 
 	if (arg->type != IMAP_ARG_LIST)
 		return NULL;
@@ -333,11 +333,11 @@
 	return t_strdup(imap_arg_string(&list->args[2]));
 }
 
-static int imap_envelope_parse_arg(struct imap_arg *arg,
-				   enum imap_envelope_field field,
-				   const char *envelope,
-				   enum imap_envelope_result_type result_type,
-				   const char **result)
+static bool
+imap_envelope_parse_arg(struct imap_arg *arg, enum imap_envelope_field field,
+			const char *envelope,
+			enum imap_envelope_result_type result_type,
+			const char **result)
 {
 	const char *value = NULL;
 
@@ -370,9 +370,9 @@
 	}
 }
 
-int imap_envelope_parse(const char *envelope, enum imap_envelope_field field,
-			enum imap_envelope_result_type result_type,
-			const char **result)
+bool imap_envelope_parse(const char *envelope, enum imap_envelope_field field,
+			 enum imap_envelope_result_type result_type,
+			 const char **result)
 {
 	struct istream *input;
 	struct imap_parser *parser;
--- a/src/lib-imap/imap-envelope.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-envelope.h	Fri Jan 13 22:25:57 2006 +0200
@@ -28,7 +28,7 @@
 
 extern const char *imap_envelope_headers[];
 
-int imap_envelope_get_field(const char *name, enum imap_envelope_field *ret);
+bool imap_envelope_get_field(const char *name, enum imap_envelope_field *ret);
 
 /* Update envelope data based from given header field */
 void imap_envelope_parse_header(pool_t pool,
@@ -41,8 +41,8 @@
 
 /* Parse envelope and store specified field to result. NIL is stored as NULL.
    Returns TRUE if successful. */
-int imap_envelope_parse(const char *envelope, enum imap_envelope_field field,
-			enum imap_envelope_result_type result_type,
-			const char **result);
+bool imap_envelope_parse(const char *envelope, enum imap_envelope_field field,
+			 enum imap_envelope_result_type result_type,
+			 const char **result);
 
 #endif
--- a/src/lib-imap/imap-match.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-match.c	Fri Jan 13 22:25:57 2006 +0200
@@ -12,7 +12,7 @@
 struct imap_match_glob {
 	pool_t pool;
 
-	int inboxcase;
+	bool inboxcase;
 	const char *inboxcase_end;
 
 	char sep_char;
@@ -24,7 +24,7 @@
 #define INBOXLEN (sizeof(inbox) - 1)
 
 struct imap_match_glob *
-imap_match_init(pool_t pool, const char *mask, int inboxcase, char separator)
+imap_match_init(pool_t pool, const char *mask, bool inboxcase, char separator)
 {
 	struct imap_match_glob *glob;
 	const char *p, *inboxp;
@@ -91,8 +91,8 @@
 	p_free(glob->pool, glob);
 }
 
-static inline int cmp_chr(const struct imap_match_glob *glob,
-			  const char *data, char maskchr)
+static inline bool cmp_chr(const struct imap_match_glob *glob,
+			   const char *data, char maskchr)
 {
 	return *data == maskchr ||
 		(glob->inboxcase_end != NULL && data < glob->inboxcase_end &&
--- a/src/lib-imap/imap-match.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-match.h	Fri Jan 13 22:25:57 2006 +0200
@@ -14,7 +14,7 @@
 /* If inboxcase is TRUE, the "INBOX" string at the beginning of line is
    compared case-insensitively */
 struct imap_match_glob *
-imap_match_init(pool_t pool, const char *mask, int inboxcase, char separator);
+imap_match_init(pool_t pool, const char *mask, bool inboxcase, char separator);
 
 void imap_match_deinit(struct imap_match_glob *glob);
 
--- a/src/lib-imap/imap-parser.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-parser.c	Fri Jan 13 22:25:57 2006 +0200
@@ -112,7 +112,7 @@
 	imap_args_realloc(parser, LIST_ALLOC_SIZE);
 }
 
-const char *imap_parser_get_error(struct imap_parser *parser, int *fatal)
+const char *imap_parser_get_error(struct imap_parser *parser, bool *fatal)
 {
         *fatal = parser->fatal_error;
 	return parser->error;
--- a/src/lib-imap/imap-parser.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-parser.h	Fri Jan 13 22:25:57 2006 +0200
@@ -94,7 +94,7 @@
 /* Return the last error in parser. fatal is set to TRUE if there's no way to
    continue parsing, currently only if too large non-sync literal size was
    given. */
-const char *imap_parser_get_error(struct imap_parser *parser, int *fatal);
+const char *imap_parser_get_error(struct imap_parser *parser, bool *fatal);
 
 /* Read a number of arguments. This function doesn't call i_stream_read(), you
    need to do that. Returns number of arguments read (may be less than count
--- a/src/lib-imap/imap-quote.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-quote.c	Fri Jan 13 22:25:57 2006 +0200
@@ -5,10 +5,10 @@
 #include "imap-quote.h"
 
 void imap_quote_append(string_t *str, const unsigned char *value,
-		       size_t value_len, int compress_lwsp)
+		       size_t value_len, bool compress_lwsp)
 {
 	size_t i, extra = 0;
-	int last_lwsp = TRUE, literal = FALSE, modify = FALSE;
+	bool last_lwsp = TRUE, literal = FALSE, modify = FALSE;
 
 	if (value == NULL) {
 		str_append(str, "NIL");
--- a/src/lib-imap/imap-quote.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-imap/imap-quote.h	Fri Jan 13 22:25:57 2006 +0200
@@ -8,7 +8,7 @@
 
 /* Append to existing string. */
 void imap_quote_append(string_t *str, const unsigned char *value,
-		       size_t value_len, int compress_lwsp);
+		       size_t value_len, bool compress_lwsp);
 
 #define imap_quote_append_string(str, value, compress_lwsp) \
 	imap_quote_append(str, (const unsigned char *) value, \
--- a/src/lib-index/mail-cache-compress.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-cache-compress.c	Fri Jan 13 22:25:57 2006 +0200
@@ -11,7 +11,7 @@
 #include <sys/stat.h>
 
 struct mail_cache_copy_context {
-	int new_msg;
+	bool new_msg;
 	buffer_t *buffer, *field_seen;
 	uint8_t field_seen_value;
 };
@@ -327,7 +327,7 @@
 	}
 }
 
-int mail_cache_need_compress(struct mail_cache *cache)
+bool mail_cache_need_compress(struct mail_cache *cache)
 {
 	return cache->need_compress;
 }
--- a/src/lib-index/mail-cache-lookup.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-cache-lookup.c	Fri Jan 13 22:25:57 2006 +0200
@@ -166,7 +166,7 @@
 	return 1;
 }
 
-static int find_offset(struct mail_cache_view *view, uint32_t offset)
+static bool find_offset(struct mail_cache_view *view, uint32_t offset)
 {
 	const uint32_t *offsets;
 	unsigned int i, count;
@@ -294,7 +294,7 @@
 struct mail_cache_lookup_context {
 	buffer_t *dest_buf;
 	uint32_t field;
-	int found;
+	bool found;
 };
 
 static int
--- a/src/lib-index/mail-cache-transaction.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-cache-transaction.c	Fri Jan 13 22:25:57 2006 +0200
@@ -136,8 +136,8 @@
 	return 0;
 }
 
-static int mail_cache_unlink_hole(struct mail_cache *cache, size_t size,
-				  struct mail_cache_hole_header *hole_r)
+static bool mail_cache_unlink_hole(struct mail_cache *cache, size_t size,
+				   struct mail_cache_hole_header *hole_r)
 {
 	struct mail_cache_header *hdr = &cache->hdr_copy;
 	struct mail_cache_hole_header hole;
@@ -195,7 +195,7 @@
 
 static int
 mail_cache_transaction_reserve_more(struct mail_cache_transaction_ctx *ctx,
-				    size_t block_size, int commit)
+				    size_t block_size, bool commit)
 {
 	struct mail_cache *cache = ctx->cache;
 	struct mail_cache_header *hdr = &cache->hdr_copy;
@@ -297,7 +297,7 @@
 static int
 mail_cache_transaction_free_space(struct mail_cache_transaction_ctx *ctx)
 {
-	int locked = ctx->cache->locked;
+	bool locked = ctx->cache->locked;
 
 	if (ctx->reserved_space == 0)
 		return 0;
@@ -327,9 +327,9 @@
 mail_cache_transaction_get_space(struct mail_cache_transaction_ctx *ctx,
 				 size_t min_size, size_t max_size,
 				 uint32_t *offset_r, size_t *available_space_r,
-				 int commit)
+				 bool commit)
 {
-	int locked = ctx->cache->locked;
+	bool locked = ctx->cache->locked;
 	uint32_t cache_file_seq;
 	size_t size;
 	int ret;
@@ -442,7 +442,8 @@
 	uint32_t write_offset, write_size, rec_pos, seq_idx, seq_limit;
 	size_t size, max_size;
 	unsigned int seq_count;
-	int ret, commit;
+	int ret;
+	bool commit;
 
 	if (MAIL_CACHE_IS_UNUSABLE(cache))
 		return -1;
@@ -772,7 +773,7 @@
 	return 0;
 }
 
-static int find_offset(array_t *array, uint32_t offset)
+static bool find_offset(array_t *array, uint32_t offset)
 {
 	ARRAY_SET_TYPE(array, uint32_t);
 	const uint32_t *offsets;
--- a/src/lib-index/mail-cache.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-cache.c	Fri Jan 13 22:25:57 2006 +0200
@@ -112,7 +112,7 @@
 	return 1;
 }
 
-static int mail_cache_verify_header(struct mail_cache *cache)
+static bool mail_cache_verify_header(struct mail_cache *cache)
 {
 	const struct mail_cache_header *hdr = cache->data;
 
--- a/src/lib-index/mail-cache.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-cache.h	Fri Jan 13 22:25:57 2006 +0200
@@ -55,7 +55,7 @@
 			     unsigned int *count_r);
 
 /* Returns TRUE if cache should be compressed. */
-int mail_cache_need_compress(struct mail_cache *cache);
+bool mail_cache_need_compress(struct mail_cache *cache);
 /* Compress cache file. */
 int mail_cache_compress(struct mail_cache *cache, struct mail_index_view *view);
 
--- a/src/lib-index/mail-index-fsck.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-fsck.c	Fri Jan 13 22:25:57 2006 +0200
@@ -135,7 +135,8 @@
 	unsigned int lock_id;
 	uint32_t file_seq;
 	uoff_t file_offset;
-	int ret, lock_log;
+	int ret;
+	bool lock_log;
 
 	if (index->sync_update) {
 		/* we're modifying index, don't do anything */
--- a/src/lib-index/mail-index-lock.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-lock.c	Fri Jan 13 22:25:57 2006 +0200
@@ -223,7 +223,7 @@
 	return 1;
 }
 
-int mail_index_lock_shared(struct mail_index *index, int update_index,
+int mail_index_lock_shared(struct mail_index *index, bool update_index,
 			   unsigned int *lock_id_r)
 {
 	int ret;
@@ -488,7 +488,7 @@
 	}
 }
 
-int mail_index_is_locked(struct mail_index *index, unsigned int lock_id)
+bool mail_index_is_locked(struct mail_index *index, unsigned int lock_id)
 {
 	if ((index->lock_id ^ lock_id) <= 1) {
 		i_assert(index->lock_type != F_UNLCK);
--- a/src/lib-index/mail-index-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -203,14 +203,14 @@
 /* Returns 0 = ok, -1 = error. If update_index is TRUE, reopens the index
    file if needed to get later version of it (not necessarily latest due to
    races, unless transaction log is exclusively locked). */
-int mail_index_lock_shared(struct mail_index *index, int update_index,
+int mail_index_lock_shared(struct mail_index *index, bool update_index,
 			   unsigned int *lock_id_r);
 /* Returns 0 = ok, -1 = error. */
 int mail_index_lock_exclusive(struct mail_index *index,
 			      unsigned int *lock_id_r);
 void mail_index_unlock(struct mail_index *index, unsigned int lock_id);
-/* Returns 1 if given lock_id is valid, 0 if not. */
-int mail_index_is_locked(struct mail_index *index, unsigned int lock_id);
+/* Returns TRUE if given lock_id is valid. */
+bool mail_index_is_locked(struct mail_index *index, unsigned int lock_id);
 
 int mail_index_lock_fd(struct mail_index *index, const char *path, int fd,
 		       int lock_type, unsigned int timeout_secs);
@@ -221,7 +221,7 @@
 /* Map index file to memory, replacing the previous mapping for index.
    Returns 1 = ok, 0 = corrupted, -1 = error. If index needs fscking, it
    returns 1 but sets index->fsck = TRUE. */
-int mail_index_map(struct mail_index *index, int force);
+int mail_index_map(struct mail_index *index, bool force);
 /* Read the latest available header. Normally this is pretty much the same as
    calling mail_index_map(), but with mmap_disable the header can be generated
    by reading just log files, so eg. log_file_*_offset values can be wrong.
--- a/src/lib-index/mail-index-sync-ext.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-sync-ext.c	Fri Jan 13 22:25:57 2006 +0200
@@ -278,7 +278,7 @@
 	struct mail_index_ext *ext;
 	struct mail_index_ext_header *ext_hdr;
 	uint32_t old_size, new_size, old_record_size;
-	int modified = FALSE;
+	bool modified = FALSE;
 
 	ext = array_idx_modifyable(&map->extensions, ext_id);
 
--- a/src/lib-index/mail-index-sync-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-sync-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -61,7 +61,7 @@
 			      enum mail_index_sync_handler_type type);
 void mail_index_sync_map_deinit(struct mail_index_sync_map_ctx *sync_map_ctx);
 int mail_index_sync_update_index(struct mail_index_sync_ctx *sync_ctx,
-				 int sync_only_external);
+				 bool sync_only_external);
 
 int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
 			   const struct mail_transaction_header *hdr,
--- a/src/lib-index/mail-index-sync-update.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Fri Jan 13 22:25:57 2006 +0200
@@ -587,7 +587,7 @@
 }
 
 int mail_index_sync_update_index(struct mail_index_sync_ctx *sync_ctx,
-				 int sync_only_external)
+				 bool sync_only_external)
 {
 	struct mail_index *index = sync_ctx->index;
 	struct mail_index_view *view = sync_ctx->view;
@@ -598,7 +598,8 @@
 	unsigned int count, old_lock_id;
 	uint32_t seq, i, first_append_uid;
 	uoff_t offset;
-	int ret, had_dirty, skipped, check_ext_offsets;
+	int ret;
+	bool had_dirty, skipped, check_ext_offsets;
 
 	mail_index_sync_map_init(&sync_map_ctx, view,
 				 MAIL_INDEX_SYNC_HANDLER_INDEX);
--- a/src/lib-index/mail-index-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -159,7 +159,7 @@
 {
 	const struct mail_index_record *rec;
 	uint32_t seq, messages_count;
-	int seen_recent = FALSE;
+	bool seen_recent = FALSE;
 
 	messages_count = mail_index_view_get_messages_count(ctx->view);
 	for (seq = 1; seq <= messages_count; seq++) {
@@ -184,7 +184,7 @@
 
 static int
 mail_index_sync_read_and_sort(struct mail_index_sync_ctx *ctx,
-			      int *seen_external_r)
+			      bool *seen_external_r)
 {
 	struct mail_index_sync_list *synclist;
         const struct mail_index_transaction_keyword_update *keyword_updates;
@@ -257,7 +257,7 @@
 	return ret;
 }
 
-static int mail_index_need_lock(struct mail_index *index, int sync_recent,
+static int mail_index_need_lock(struct mail_index *index, bool sync_recent,
 				uint32_t log_file_seq, uoff_t log_file_offset)
 {
 	if (sync_recent && index->hdr->recent_messages_count > 0)
@@ -339,14 +339,14 @@
                           struct mail_index_sync_ctx **ctx_r,
 			  struct mail_index_view **view_r,
 			  uint32_t log_file_seq, uoff_t log_file_offset,
-			  int sync_recent, int sync_dirty)
+			  bool sync_recent, bool sync_dirty)
 {
 	struct mail_index_sync_ctx *ctx;
 	struct mail_index_view *dummy_view;
 	uint32_t seq;
 	uoff_t offset;
 	unsigned int lock_id = 0;
-	int seen_external;
+	bool seen_external;
 
 	if (mail_transaction_log_sync_lock(index->log, &seq, &offset) < 0)
 		return -1;
@@ -500,8 +500,8 @@
 	rec->uid2 = range->uid2;
 }
 
-static int mail_index_sync_rec_check(struct mail_index_view *view,
-				     struct mail_index_sync_rec *rec)
+static bool mail_index_sync_rec_check(struct mail_index_view *view,
+				      struct mail_index_sync_rec *rec)
 {
 	switch (rec->type) {
 	case MAIL_INDEX_SYNC_TYPE_EXPUNGE:
@@ -589,7 +589,7 @@
 	return 1;
 }
 
-int mail_index_sync_have_more(struct mail_index_sync_ctx *ctx)
+bool mail_index_sync_have_more(struct mail_index_sync_ctx *ctx)
 {
 	const struct mail_index_sync_list *sync_list;
 	unsigned int i, count;
@@ -692,8 +692,8 @@
 	*flags = (*flags & ~sync_rec->remove_flags) | sync_rec->add_flags;
 }
 
-int mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
-				   array_t *keywords)
+bool mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
+				    array_t *keywords)
 {
 	ARRAY_SET_TYPE(keywords, unsigned int);
 	const unsigned int *keyword_indexes;
--- a/src/lib-index/mail-index-transaction-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-transaction-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -49,7 +49,7 @@
 void mail_index_transaction_ref(struct mail_index_transaction *t);
 void mail_index_transaction_unref(struct mail_index_transaction *t);
 
-int mail_index_seq_array_lookup(const array_t *buffer, uint32_t seq,
-				unsigned int *idx_r);
+bool mail_index_seq_array_lookup(const array_t *buffer, uint32_t seq,
+				 unsigned int *idx_r);
 
 #endif
--- a/src/lib-index/mail-index-transaction.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-transaction.c	Fri Jan 13 22:25:57 2006 +0200
@@ -17,7 +17,7 @@
 
 struct mail_index_transaction *
 mail_index_transaction_begin(struct mail_index_view *view,
-			     int hide, int external)
+			     bool hide, bool external)
 {
 	struct mail_index_transaction *t;
 
@@ -101,23 +101,23 @@
 
 static void
 mail_index_buffer_convert_to_uids(struct mail_index_transaction *t,
-				  array_t *array, int range)
+				  array_t *array, bool range)
 {
         ARRAY_SET_TYPE(array, uint32_t);
         struct mail_index_view *view = t->view;
 	const struct mail_index_record *rec;
 	uint32_t *seq;
-	unsigned int i, count;
-	int j;
+	unsigned int i, j, count, range_count;
 
 	if (!array_is_created(array))
 		return;
 
 	count = array_count(array);
+	range_count = range ? 1 : 0;
 	for (i = 0; i < count; i++) {
 		seq = array_idx_modifyable(array, i);
 
-		for (j = 0; j <= range; j++, seq++) {
+		for (j = 0; j <= range_count; j++, seq++) {
 			if (*seq >= t->first_new_seq) {
 				rec = mail_index_transaction_lookup(t, *seq);
 				*seq = rec->uid;
@@ -132,7 +132,7 @@
 }
 
 static void arrays_convert_to_uids(struct mail_index_transaction *t,
-				   array_t *array, int range)
+				   array_t *array, bool range)
 {
 	ARRAY_SET_TYPE(array, array_t);
 	array_t *updates;
@@ -529,8 +529,8 @@
 	mail_index_update_flags_range(t, seq, seq, modify_type, flags);
 }
 
-int mail_index_seq_array_lookup(const array_t *array, uint32_t seq,
-				unsigned int *idx_r)
+bool mail_index_seq_array_lookup(const array_t *array, uint32_t seq,
+				 unsigned int *idx_r)
 {
         ARRAY_SET_TYPE(array, uint32_t);
 	unsigned int idx, left_idx, right_idx, count;
@@ -567,9 +567,9 @@
 	return FALSE;
 }
 
-static int mail_index_seq_array_add(array_t *array, uint32_t seq,
-				    const void *record, size_t record_size,
-				    void *old_record)
+static bool mail_index_seq_array_add(array_t *array, uint32_t seq,
+				     const void *record, size_t record_size,
+				     void *old_record)
 {
         ARRAY_SET_TYPE(array, void *);
 	void *p;
@@ -602,7 +602,7 @@
 
 void mail_index_update_header(struct mail_index_transaction *t,
 			      size_t offset, const void *data, size_t size,
-			      int prepend)
+			      bool prepend)
 {
 	i_assert(offset < sizeof(t->pre_hdr_change));
 	i_assert(size <= sizeof(t->pre_hdr_change) - offset);
--- a/src/lib-index/mail-index-view-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-view-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -60,7 +60,7 @@
 			   const struct mail_index_view *src);
 void mail_index_view_ref(struct mail_index_view *view);
 int mail_index_view_lock(struct mail_index_view *view);
-int mail_index_view_lock_head(struct mail_index_view *view, int update_index);
+int mail_index_view_lock_head(struct mail_index_view *view, bool update_index);
 void mail_index_view_unref_maps(struct mail_index_view *view);
 void mail_index_view_add_synced_transaction(struct mail_index_view *view,
 					    uint32_t log_file_seq,
--- a/src/lib-index/mail-index-view-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-view-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -285,8 +285,8 @@
 	return 0;
 }
 
-static int view_is_transaction_synced(struct mail_index_view *view,
-				      uint32_t seq, uoff_t offset)
+static bool view_is_transaction_synced(struct mail_index_view *view,
+				       uint32_t seq, uoff_t offset)
 {
 	const struct mail_index_view_log_sync_pos *pos;
 	unsigned int i, count;
@@ -311,7 +311,8 @@
 	struct mail_index_view *view = ctx->view;
 	uint32_t seq;
 	uoff_t offset;
-	int ret, skipped;
+	int ret;
+	bool skipped;
 
 	for (;;) {
 		/* Get the next transaction from log. */
--- a/src/lib-index/mail-index-view.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index-view.c	Fri Jan 13 22:25:57 2006 +0200
@@ -46,7 +46,7 @@
 	i_free(view);
 }
 
-int mail_index_view_lock_head(struct mail_index_view *view, int update_index)
+int mail_index_view_lock_head(struct mail_index_view *view, bool update_index)
 {
 	unsigned int lock_id;
 
@@ -102,7 +102,7 @@
 	}
 }
 
-int mail_index_view_is_inconsistent(struct mail_index_view *view)
+bool mail_index_view_is_inconsistent(struct mail_index_view *view)
 {
 	if (view->index->indexid != view->indexid)
 		view->inconsistent = TRUE;
--- a/src/lib-index/mail-index.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index.c	Fri Jan 13 22:25:57 2006 +0200
@@ -249,7 +249,7 @@
 	return idx;
 }
 
-static int size_check(size_t *size_left, size_t size)
+static bool size_check(size_t *size_left, size_t size)
 {
 	if (size > *size_left)
 		return FALSE;
@@ -346,9 +346,9 @@
 	return 1;
 }
 
-int mail_index_keyword_lookup(struct mail_index *index,
-			      const char *keyword, int autocreate,
-			      unsigned int *idx_r)
+bool mail_index_keyword_lookup(struct mail_index *index,
+			       const char *keyword, bool autocreate,
+			       unsigned int *idx_r)
 {
 	char *keyword_dup;
 	void *value;
@@ -675,7 +675,7 @@
 }
 
 static int mail_index_read_map(struct mail_index *index,
-			       struct mail_index_map *map, int *retry_r)
+			       struct mail_index_map *map, bool *retry_r)
 {
 	struct mail_index_header hdr;
 	void *data = NULL;
@@ -760,7 +760,7 @@
 
 static int mail_index_sync_from_transactions(struct mail_index *index,
 					     struct mail_index_map **map,
-					     int sync_to_index)
+					     bool sync_to_index)
 {
 	const struct mail_index_header *map_hdr = &(*map)->hdr;
 	struct mail_index_view *view;
@@ -772,7 +772,8 @@
 	uint32_t prev_seq, max_seq;
 	uoff_t prev_offset, max_offset;
 	size_t pos;
-	int ret, skipped;
+	int ret;
+	bool skipped;
 
 	if (sync_to_index) {
 		/* read the real log position where we are supposed to be
@@ -866,11 +867,12 @@
 
 static int mail_index_read_map_with_retry(struct mail_index *index,
 					  struct mail_index_map **map,
-					  int sync_to_index)
+					  bool sync_to_index)
 {
 	mail_index_sync_lost_handler_t *const *handlers;
 	unsigned int i, count;
-	int ret, retry;
+	int ret;
+	bool retry;
 
 	if (index->log_locked) {
 		/* we're most likely syncing the index and we really don't
@@ -945,7 +947,7 @@
 	return 0;
 }
 
-int mail_index_map(struct mail_index *index, int force)
+int mail_index_map(struct mail_index *index, bool force)
 {
 	struct mail_index_map *map;
 	int ret;
@@ -1377,7 +1379,8 @@
 {
 	struct mail_index_header hdr;
 	unsigned int lock_id = 0;
-	int ret, created = FALSE;
+	int ret;
+	bool created = FALSE;
 
 	ret = mail_index_try_open(index, &lock_id);
 	if (ret > 0)
--- a/src/lib-index/mail-index.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-index.h	Fri Jan 13 22:25:57 2006 +0200
@@ -179,7 +179,7 @@
 /* Returns number of mails in view. */
 uint32_t mail_index_view_get_messages_count(struct mail_index_view *view);
 /* Returns TRUE if we lost track of changes for some reason. */
-int mail_index_view_is_inconsistent(struct mail_index_view *view);
+bool mail_index_view_is_inconsistent(struct mail_index_view *view);
 
 /* Transaction has to be opened to be able to modify index. You can have
    multiple transactions open simultaneously. Note that committed transactions
@@ -192,7 +192,7 @@
    happened. */
 struct mail_index_transaction *
 mail_index_transaction_begin(struct mail_index_view *view,
-			     int hide, int external);
+			     bool hide, bool external);
 int mail_index_transaction_commit(struct mail_index_transaction *t,
 				  uint32_t *log_file_seq_r,
 				  uoff_t *log_file_offset_r);
@@ -231,12 +231,12 @@
 			  struct mail_index_sync_ctx **ctx_r,
 			  struct mail_index_view **view_r,
 			  uint32_t log_file_seq, uoff_t log_file_offset,
-			  int sync_recent, int sync_dirty);
+			  bool sync_recent, bool sync_dirty);
 /* Returns -1 if error, 0 if sync is finished, 1 if record was filled. */
 int mail_index_sync_next(struct mail_index_sync_ctx *ctx,
 			 struct mail_index_sync_rec *sync_rec);
-/* Returns 1 if there's more to sync, 0 if not. */
-int mail_index_sync_have_more(struct mail_index_sync_ctx *ctx);
+/* Returns TRUE if there's more to sync. */
+bool mail_index_sync_have_more(struct mail_index_sync_ctx *ctx);
 /* Reset syncing to initial state after mail_index_sync_begin(), so you can
    go through all the sync records again with mail_index_sync_next(). */
 void mail_index_sync_reset(struct mail_index_sync_ctx *ctx);
@@ -316,9 +316,9 @@
 
 /* Lookup a keyword, returns TRUE if found, FALSE if not. If autocreate is
    TRUE, the keyword is automatically created and TRUE is always returned. */
-int mail_index_keyword_lookup(struct mail_index *index,
-			      const char *keyword, int autocreate,
-			      unsigned int *idx_r);
+bool mail_index_keyword_lookup(struct mail_index *index,
+			       const char *keyword, bool autocreate,
+			       unsigned int *idx_r);
 /* Return a pointer to array of NULL-terminated list of keywords. Note that
    the array contents (and thus pointers inside it) may change after calling
    mail_index_keywords_create() or mail_index_sync_begin(). */
@@ -343,7 +343,7 @@
    before message syncing begins. */
 void mail_index_update_header(struct mail_index_transaction *t,
 			      size_t offset, const void *data, size_t size,
-			      int prepend);
+			      bool prepend);
 
 /* Returns the last error code. */
 enum mail_index_error mail_index_get_last_error(struct mail_index *index);
@@ -359,8 +359,8 @@
 				 uint8_t *flags);
 /* Apply changes in MAIL_INDEX_SYNC_TYPE_KEYWORD_* typed sync records to given
    keywords array. Returns TRUE If something was changed. */
-int mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
-				   array_t *keywords);
+bool mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
+				    array_t *keywords);
 
 /* register index extension. name is a unique identifier for the extension.
    returns unique identifier for the name. */
--- a/src/lib-index/mail-transaction-log-append.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-transaction-log-append.c	Fri Jan 13 22:25:57 2006 +0200
@@ -100,7 +100,7 @@
 }
 
 static const buffer_t *
-log_get_hdr_update_buffer(struct mail_index_transaction *t, int prepend)
+log_get_hdr_update_buffer(struct mail_index_transaction *t, bool prepend)
 {
 	buffer_t *buf;
 	const unsigned char *data, *mask;
--- a/src/lib-index/mail-transaction-log-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-transaction-log-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -59,7 +59,7 @@
 
 void mail_transaction_logs_clean(struct mail_transaction_log *log);
 
-int mail_transaction_log_rotate(struct mail_transaction_log *log, int lock);
+int mail_transaction_log_rotate(struct mail_transaction_log *log, bool lock);
 int mail_transaction_log_lock_head(struct mail_transaction_log *log);
 void mail_transaction_log_file_unlock(struct mail_transaction_log_file *file);
 
--- a/src/lib-index/mail-transaction-log-view.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-transaction-log-view.c	Fri Jan 13 22:25:57 2006 +0200
@@ -240,7 +240,7 @@
 	va_end(va);
 }
 
-int
+bool
 mail_transaction_log_view_is_corrupted(struct mail_transaction_log_view *view)
 {
 	return view->broken;
@@ -388,7 +388,7 @@
 
 int mail_transaction_log_view_next(struct mail_transaction_log_view *view,
 				   const struct mail_transaction_header **hdr_r,
-				   const void **data_r, int *skipped_r)
+				   const void **data_r, bool *skipped_r)
 {
 	const struct mail_transaction_header *hdr;
 	const void *data;
--- a/src/lib-index/mail-transaction-log.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-transaction-log.c	Fri Jan 13 22:25:57 2006 +0200
@@ -486,7 +486,8 @@
 	struct mail_transaction_log_header hdr;
 	struct stat st;
 	const char *path2;
-	int fd2, ret, found;
+	int fd2, ret;
+	bool found;
 
 	/* log creation is locked now - see if someone already created it */
 	fd2 = open(path, O_RDWR);
@@ -628,7 +629,7 @@
 static int
 mail_transaction_log_file_fd_open(struct mail_transaction_log *log,
                                   struct mail_transaction_log_file **file_r,
-				  const char *path, int fd, int head)
+				  const char *path, int fd, bool head)
 {
         struct mail_transaction_log_file *file;
 	struct stat st;
@@ -802,7 +803,7 @@
 	}
 }
 
-int mail_transaction_log_rotate(struct mail_transaction_log *log, int lock)
+int mail_transaction_log_rotate(struct mail_transaction_log *log, bool lock)
 {
 	struct mail_transaction_log_file *file;
 	const char *path = log->head->filepath;
@@ -852,7 +853,7 @@
 }
 
 static int mail_transaction_log_refresh(struct mail_transaction_log *log,
-					int create_if_needed)
+					bool create_if_needed)
 {
         struct mail_transaction_log_file *file;
 	struct stat st;
@@ -1295,8 +1296,8 @@
 	*file_offset_r = log->head->sync_offset;
 }
 
-int mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
-				      uint32_t file_seq, uoff_t file_offset)
+bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
+				       uint32_t file_seq, uoff_t file_offset)
 {
 	return log->head->hdr.prev_file_seq == file_seq &&
 		log->head->hdr.prev_file_offset == file_offset;
--- a/src/lib-index/mail-transaction-log.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-index/mail-transaction-log.h	Fri Jan 13 22:25:57 2006 +0200
@@ -126,7 +126,7 @@
    Returns -1 if error, 0 if we're at end of the view, 1 if ok. */
 int mail_transaction_log_view_next(struct mail_transaction_log_view *view,
 				   const struct mail_transaction_header **hdr_r,
-				   const void **data_r, int *skipped_r);
+				   const void **data_r, bool *skipped_r);
 
 /* Returns the position of the record returned previously with
    mail_transaction_log_view_next() */
@@ -140,7 +140,7 @@
 mail_transaction_log_view_set_corrupted(struct mail_transaction_log_view *view,
 					const char *fmt, ...)
 	__attr_format__(2, 3);
-int
+bool
 mail_transaction_log_view_is_corrupted(struct mail_transaction_log_view *view);
 
 void mail_transaction_log_views_close(struct mail_transaction_log *log);
@@ -162,7 +162,7 @@
 void mail_transaction_log_get_head(struct mail_transaction_log *log,
 				   uint32_t *file_seq_r, uoff_t *file_offset_r);
 /* Returns TRUE if given seq/offset is current head log's rotate point. */
-int mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
-				      uint32_t file_seq, uoff_t file_offset);
+bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
+				       uint32_t file_seq, uoff_t file_offset);
 
 #endif
--- a/src/lib-mail/istream-header-filter.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/istream-header-filter.c	Fri Jan 13 22:25:57 2006 +0200
@@ -63,7 +63,8 @@
 	struct message_header_line *hdr;
 	size_t pos;
 	ssize_t ret;
-	int matched, hdr_ret;
+	bool matched;
+	int hdr_ret;
 
 	if (mstream->header_read &&
 	    mstream->istream.istream.v_offset +
@@ -235,7 +236,7 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	struct header_filter_istream *mstream =
 		(struct header_filter_istream *)stream;
@@ -279,7 +280,7 @@
 }
 
 static const struct stat *
-_stat(struct _istream *stream, int exact __attr_unused__)
+_stat(struct _istream *stream, bool exact __attr_unused__)
 {
 	/* return size and others as unknown */
 	return &stream->statbuf;
--- a/src/lib-mail/istream-header-filter.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/istream-header-filter.h	Fri Jan 13 22:25:57 2006 +0200
@@ -16,7 +16,7 @@
 struct message_header_line;
 
 typedef void header_filter_callback(struct message_header_line *hdr,
-				    int *matched, void *context);
+				    bool *matched, void *context);
 
 /* NOTE: headers list must be sorted. */
 struct istream *
--- a/src/lib-mail/message-address.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-address.c	Fri Jan 13 22:25:57 2006 +0200
@@ -295,7 +295,7 @@
 
 void message_address_write(string_t *str, const struct message_address *addr)
 {
-	int first = TRUE, in_group = FALSE;
+	bool first = TRUE, in_group = FALSE;
 
 	/* a) mailbox@domain
 	   b) name <@route:mailbox@domain>
--- a/src/lib-mail/message-body-search.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-body-search.c	Fri Jan 13 22:25:57 2006 +0200
@@ -59,7 +59,7 @@
 static void
 parse_content_type_param(const unsigned char *name, size_t name_len,
 			 const unsigned char *value, size_t value_len,
-			 int value_quoted, void *context)
+			 bool value_quoted, void *context)
 {
 	struct part_search_context *ctx = context;
 
@@ -99,13 +99,14 @@
 	}
 }
 
-static int message_search_header(struct part_search_context *ctx,
-				 struct istream *input)
+static bool message_search_header(struct part_search_context *ctx,
+				  struct istream *input)
 {
 	struct header_search_context *hdr_search_ctx;
 	struct message_header_parser_ctx *hdr_ctx;
 	struct message_header_line *hdr;
-	int ret, found = FALSE;
+	int ret;
+	bool found = FALSE;
 
 	hdr_search_ctx = message_header_search_init(pool_datastack_create(),
 						    ctx->body_ctx->key,
@@ -159,8 +160,8 @@
 	return found;
 }
 
-static int message_search_decoded_block(struct part_search_context *ctx,
-					buffer_t *block)
+static bool message_search_decoded_block(struct part_search_context *ctx,
+					 buffer_t *block)
 {
 	const unsigned char *p, *end, *key;
 	size_t key_len, block_size, *matches, match_count, value;
@@ -267,16 +268,16 @@
 	return 0;
 }
 
-static int message_search_body(struct part_search_context *ctx,
-			       struct istream *input,
-			       const struct message_part *part)
+static bool message_search_body(struct part_search_context *ctx,
+				struct istream *input,
+				const struct message_part *part)
 {
 	const unsigned char *data;
 	buffer_t *decodebuf;
 	pool_t pool;
 	size_t data_size, pos;
 	ssize_t ret;
-	int found;
+	bool found;
 
 	if (ctx->content_unknown) {
 		/* unknown content-encoding-type, ignore */
@@ -353,9 +354,10 @@
 	return found;
 }
 
-static int message_body_search_init(struct body_search_context *ctx,
-				    const char *key, const char *charset,
-				    int *unknown_charset_r, int search_header)
+static bool
+message_body_search_init(struct body_search_context *ctx,
+			 const char *key, const char *charset,
+			 bool *unknown_charset_r, bool search_header)
 {
 	size_t key_len;
 
@@ -428,11 +430,12 @@
 
 int message_body_search(const char *key, const char *charset,
 			struct istream *input,
-			const struct message_part *part, int search_header,
+			const struct message_part *part, bool search_header,
                         enum message_body_search_error *error_r)
 {
         struct body_search_context ctx;
-	int ret, unknown_charset;
+	int ret;
+	bool unknown_charset;
 
 	if (!message_body_search_init(&ctx, key, charset, &unknown_charset,
 				      search_header)) {
--- a/src/lib-mail/message-body-search.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-body-search.h	Fri Jan 13 22:25:57 2006 +0200
@@ -17,7 +17,7 @@
    is compared to message data without any translation. */
 int message_body_search(const char *key, const char *charset,
 			struct istream *input,
-			const struct message_part *part, int search_header,
+			const struct message_part *part, bool search_header,
                         enum message_body_search_error *error_r);
 
 #endif
--- a/src/lib-mail/message-content-parser.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-content-parser.c	Fri Jan 13 22:25:57 2006 +0200
@@ -13,7 +13,7 @@
 	struct rfc822_parser_context parser;
 	string_t *str;
 	size_t key_len;
-	int quoted_string;
+	bool quoted_string;
 
 	rfc822_parser_init(&parser, data, size, NULL);
 
--- a/src/lib-mail/message-content-parser.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-content-parser.h	Fri Jan 13 22:25:57 2006 +0200
@@ -8,7 +8,7 @@
 					    size_t name_len,
 					    const unsigned char *value,
 					    size_t value_len,
-					    int value_quoted, void *context);
+					    bool value_quoted, void *context);
 
 void message_content_parse_header(const unsigned char *data, size_t size,
 				  parse_content_callback_t *callback,
--- a/src/lib-mail/message-date.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-date.c	Fri Jan 13 22:25:57 2006 +0200
@@ -105,8 +105,8 @@
 	return ret < 0 ? -1 : *value_len > 0;
 }
 
-static int message_date_parser_tokens(struct message_date_parser_context *ctx,
-				      time_t *time, int *timezone_offset)
+static bool message_date_parser_tokens(struct message_date_parser_context *ctx,
+				       time_t *time, int *timezone_offset)
 {
 	struct tm tm;
 	const unsigned char *value;
@@ -228,32 +228,33 @@
 	return TRUE;
 }
 
-int message_date_parse(const unsigned char *data, size_t size,
+bool message_date_parse(const unsigned char *data, size_t size,
 		       time_t *time, int *timezone_offset)
 {
 	struct message_date_parser_context ctx;
-	int ret;
+	bool success;
 
 	t_push();
 	rfc822_parser_init(&ctx.parser, data, size, NULL);
 	ctx.str = t_str_new(128);
-	ret = message_date_parser_tokens(&ctx, time, timezone_offset);
+	success = message_date_parser_tokens(&ctx, time, timezone_offset);
 	t_pop();
 
-	return ret;
+	return success;
 }
 
 const char *message_date_create(time_t time)
 {
 	struct tm *tm;
-	int offset, negative;
+	int offset;
+	bool negative;
 
 	tm = localtime(&time);
 	offset = utc_offset(tm, time);
 	if (offset >= 0)
-		negative = 0;
+		negative = FALSE;
 	else {
-		negative = 1;
+		negative = TRUE;
 		offset = -offset;
 	}
 
--- a/src/lib-mail/message-date.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-date.h	Fri Jan 13 22:25:57 2006 +0200
@@ -3,8 +3,8 @@
 
 /* Parses RFC2822 date/time string. timezone_offset is filled with the
    timezone's difference to UTC in minutes. */
-int message_date_parse(const unsigned char *data, size_t size,
-		       time_t *time, int *timezone_offset);
+bool message_date_parse(const unsigned char *data, size_t size,
+			time_t *time, int *timezone_offset);
 
 /* Create RFC2822 date/time string from given time in local timezone. */
 const char *message_date_create(time_t time);
--- a/src/lib-mail/message-header-decode.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-header-decode.c	Fri Jan 13 22:25:57 2006 +0200
@@ -6,9 +6,9 @@
 #include "quoted-printable.h"
 #include "message-header-decode.h"
 
-static int split_encoded(const unsigned char *data, size_t *size_p,
-			 const char **charset, const char **encoding,
-			 const unsigned char **text, size_t *text_size_r)
+static bool split_encoded(const unsigned char *data, size_t *size_p,
+			  const char **charset, const char **encoding,
+			  const unsigned char **text, size_t *text_size_r)
 {
 	size_t size, pos, textpos;
 
@@ -44,7 +44,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 message_header_decode_encoded(const unsigned char *data, size_t *size,
 			      message_header_decode_callback_t *callback,
 			      void *context)
--- a/src/lib-mail/message-header-decode.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-header-decode.h	Fri Jan 13 22:25:57 2006 +0200
@@ -3,9 +3,9 @@
 
 /* Return FALSE if you wish to stop decoding. charset is NULL when it's not
    RFC2047-encoded. */
-typedef int message_header_decode_callback_t(const unsigned char *data,
-					     size_t size, const char *charset,
-					     void *context);
+typedef bool message_header_decode_callback_t(const unsigned char *data,
+					      size_t size, const char *charset,
+					      void *context);
 
 /* Decode RFC2047 encoded words. Call specified function for each
    decoded block. */
--- a/src/lib-mail/message-header-search.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-header-search.c	Fri Jan 13 22:25:57 2006 +0200
@@ -32,7 +32,7 @@
 
 struct header_search_context *
 message_header_search_init(pool_t pool, const char *key, const char *charset,
-			   int *unknown_charset)
+			   bool *unknown_charset)
 {
 	struct header_search_context *ctx;
 	size_t key_len;
@@ -121,7 +121,7 @@
 	size_t pos, *matches, match_count, value;
 	ssize_t i;
 	unsigned char chr;
-	int last_newline;
+	bool last_newline;
 
 	matches = buffer_get_modifyable_data(ctx->match_buf, &match_count);
 	match_count /= sizeof(size_t);
@@ -188,8 +188,8 @@
 	ctx->last_newline = last_newline;
 }
 
-static int search_block(const unsigned char *data, size_t size,
-			const char *charset, void *context)
+static bool search_block(const unsigned char *data, size_t size,
+			 const char *charset, void *context)
 {
 	struct header_search_context *ctx = context;
 
@@ -205,8 +205,8 @@
 	return !ctx->found;
 }
 
-int message_header_search(const unsigned char *header_block, size_t size,
-			  struct header_search_context *ctx)
+bool message_header_search(const unsigned char *header_block, size_t size,
+			   struct header_search_context *ctx)
 {
 	if (!ctx->found)
 		message_header_decode(header_block, size, search_block, ctx);
--- a/src/lib-mail/message-header-search.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-header-search.h	Fri Jan 13 22:25:57 2006 +0200
@@ -7,7 +7,7 @@
    valid in specified charset. */
 struct header_search_context *
 message_header_search_init(pool_t pool, const char *key, const char *charset,
-			   int *unknown_charset);
+			   bool *unknown_charset);
 
 /* Free search context. Not needed if you just destroy the pool. */
 void message_header_search_free(struct header_search_context *ctx);
@@ -15,8 +15,8 @@
 /* Returns TRUE if key is found from header. This function may be called
    multiple times with partial header blocks, but the blocks must contain only
    full lines so RFC2047 parsing can be done. */
-int message_header_search(const unsigned char *header_block, size_t size,
-			  struct header_search_context *ctx);
+bool message_header_search(const unsigned char *header_block, size_t size,
+			   struct header_search_context *ctx);
 
 /* Next call to message_header_search() will begin a new header. */
 void message_header_search_reset(struct header_search_context *ctx);
--- a/src/lib-mail/message-parser.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-parser.c	Fri Jan 13 22:25:57 2006 +0200
@@ -41,8 +41,8 @@
 	buffer_t *value_buf;
 	size_t skip;
 
-	int skip_initial_lwsp;
-	int has_nuls;
+	bool skip_initial_lwsp;
+	bool has_nuls;
 };
 
 static void
@@ -54,12 +54,12 @@
 static struct message_part *
 message_parse_body(struct message_parser_ctx *parser_ctx,
 		   struct message_boundary *boundaries,
-		   struct message_size *msg_size, int *has_nuls);
+		   struct message_size *msg_size, bool *has_nuls);
 
 static struct message_part *
 message_skip_boundary(struct message_parser_ctx *parser_ctx,
 		      struct message_boundary *boundaries,
-		      struct message_size *boundary_size, int *has_nuls);
+		      struct message_size *boundary_size, bool *has_nuls);
 
 static void message_size_add_part(struct message_size *dest,
 				  struct message_part *part)
@@ -125,7 +125,7 @@
 static void
 parse_content_type_param(const unsigned char *name, size_t name_len,
 			 const unsigned char *value, size_t value_len,
-			 int value_quoted, void *context)
+			 bool value_quoted, void *context)
 {
 	struct message_parser_ctx *parser_ctx = context;
 
@@ -146,7 +146,7 @@
 {
 	struct message_part *parent_part, *next_part, *part;
 	struct message_boundary *b;
-	int has_nuls;
+	bool has_nuls;
 
 	/* multipart message. add new boundary */
 	b = p_new(parser_ctx->parser_pool, struct message_boundary, 1);
@@ -263,7 +263,7 @@
 {
 	struct message_part *part = parser_ctx->part;
         struct message_part *next_part;
-	int has_nuls;
+	bool has_nuls;
 
 	if (parser_ctx->last_boundary != NULL)
 		return message_parse_multipart(parser_ctx);
@@ -317,8 +317,8 @@
 }
 
 static void message_skip_line(struct istream *input,
-			      struct message_size *msg_size, int skip_lf,
-			      int *has_nuls)
+			      struct message_size *msg_size, bool skip_lf,
+			      bool *has_nuls)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos;
@@ -386,7 +386,7 @@
 static struct message_boundary *
 message_find_boundary(struct istream *input,
 		      struct message_boundary *boundaries,
-		      struct message_size *msg_size, int *has_nuls)
+		      struct message_size *msg_size, bool *has_nuls)
 {
 	struct message_boundary *boundary;
 	const unsigned char *msg;
@@ -499,7 +499,7 @@
 static struct message_part *
 message_parse_body(struct message_parser_ctx *parser_ctx,
 		   struct message_boundary *boundaries,
-		   struct message_size *msg_size, int *has_nuls)
+		   struct message_size *msg_size, bool *has_nuls)
 {
 	struct message_boundary *boundary;
 	struct message_size body_size;
@@ -521,7 +521,7 @@
 static struct message_part *
 message_skip_boundary(struct message_parser_ctx *parser_ctx,
 		      struct message_boundary *boundaries,
-		      struct message_size *boundary_size, int *has_nuls)
+		      struct message_size *boundary_size, bool *has_nuls)
 {
 	struct message_boundary *boundary;
 	const unsigned char *msg;
@@ -666,7 +666,7 @@
 
 struct message_header_parser_ctx *
 message_parse_header_init(struct istream *input, struct message_size *hdr_size,
-			  int skip_initial_lwsp)
+			  bool skip_initial_lwsp)
 {
 	struct message_header_parser_ctx *ctx;
 
@@ -696,7 +696,8 @@
         struct message_header_line *line = &ctx->line;
 	const unsigned char *msg;
 	size_t i, size, startpos, colon_pos, parse_size;
-	int ret, last_no_newline;
+	int ret;
+	bool last_no_newline;
 
 	*hdr_r = NULL;
 	if (line->eoh)
--- a/src/lib-mail/message-parser.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-parser.h	Fri Jan 13 22:25:57 2006 +0200
@@ -105,7 +105,7 @@
    struct message_header_line. */
 struct message_header_parser_ctx *
 message_parse_header_init(struct istream *input, struct message_size *hdr_size,
-			 int skip_initial_lwsp);
+			 bool skip_initial_lwsp);
 void message_parse_header_deinit(struct message_header_parser_ctx *ctx);
 
 /* Read and return next header line. Returns 1 if header is returned, 0 if
--- a/src/lib-mail/message-part-serialize.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-part-serialize.c	Fri Jan 13 22:25:57 2006 +0200
@@ -44,7 +44,7 @@
 {
 	unsigned int count, children_count;
 	size_t children_offset;
-	int root = part->parent == NULL;
+	bool root = part->parent == NULL;
 
 	count = 0;
 	while (part != NULL) {
@@ -103,8 +103,8 @@
 	_message_part_serialize(part, dest);
 }
 
-static int read_next(struct deserialize_context *ctx,
-		     void *buffer, size_t buffer_size)
+static bool read_next(struct deserialize_context *ctx,
+		      void *buffer, size_t buffer_size)
 {
 	if (ctx->data + buffer_size > ctx->end) {
 		ctx->error = "Not enough data";
@@ -116,15 +116,16 @@
 	return TRUE;
 }
 
-static int message_part_deserialize_part(struct deserialize_context *ctx,
-					 struct message_part *parent,
-					 unsigned int siblings,
-                                         struct message_part **part_r)
+static bool
+message_part_deserialize_part(struct deserialize_context *ctx,
+			      struct message_part *parent,
+			      unsigned int siblings,
+			      struct message_part **part_r)
 {
 	struct message_part *part, *first_part, **next_part;
 	unsigned int children_count;
 	uoff_t pos;
-	int root = parent == NULL;
+	bool root = parent == NULL;
 
 	first_part = NULL;
 	next_part = NULL;
--- a/src/lib-mail/message-send.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-send.c	Fri Jan 13 22:25:57 2006 +0200
@@ -9,7 +9,7 @@
 
 void message_skip_virtual(struct istream *input, uoff_t virtual_skip,
 			  struct message_size *msg_size,
-			  int cr_skipped, int *last_cr)
+			  bool cr_skipped, bool *last_cr)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos;
--- a/src/lib-mail/message-send.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-send.h	Fri Jan 13 22:25:57 2006 +0200
@@ -9,6 +9,6 @@
    that next character should be \n and you shouldn't treat it as \r\n. */
 void message_skip_virtual(struct istream *input, uoff_t virtual_skip,
 			  struct message_size *msg_size,
-			  int cr_skipped, int *last_cr);
+			  bool cr_skipped, bool *last_cr);
 
 #endif
--- a/src/lib-mail/message-size.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-size.c	Fri Jan 13 22:25:57 2006 +0200
@@ -6,7 +6,7 @@
 #include "message-size.h"
 
 void message_get_header_size(struct istream *input, struct message_size *hdr,
-			     int *has_nuls)
+			     bool *has_nuls)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos, missing_cr_count;
@@ -62,11 +62,11 @@
 }
 
 void message_get_body_size(struct istream *input, struct message_size *body,
-			   int *has_nuls)
+			   bool *has_nuls)
 {
 	const unsigned char *msg;
 	size_t i, size, missing_cr_count;
-	int last_cr;
+	bool last_cr;
 
 	memset(body, 0, sizeof(struct message_size));
 	if (has_nuls != NULL)
--- a/src/lib-mail/message-size.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-mail/message-size.h	Fri Jan 13 22:25:57 2006 +0200
@@ -10,10 +10,10 @@
 /* Calculate size of message header. Leave the input point to first
    character in body. */
 void message_get_header_size(struct istream *input, struct message_size *hdr,
-			     int *has_nuls);
+			     bool *has_nuls);
 /* Calculate size of message body. */
 void message_get_body_size(struct istream *input, struct message_size *body,
-			   int *has_nuls);
+			   bool *has_nuls);
 
 /* Sum contents of src into dest. */
 void message_size_add(struct message_size *dest,
--- a/src/lib-ntlm/ntlm-encrypt.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-ntlm/ntlm-encrypt.c	Fri Jan 13 22:25:57 2006 +0200
@@ -21,7 +21,7 @@
 #include <ctype.h>
 
 static unsigned char *
-t_unicode_str(const char *src, int ucase, size_t *size)
+t_unicode_str(const char *src, bool ucase, size_t *size)
 {
 	buffer_t *wstr;
 
--- a/src/lib-ntlm/ntlm-message.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-ntlm/ntlm-message.c	Fri Jan 13 22:25:57 2006 +0200
@@ -22,7 +22,7 @@
 #include <ctype.h>
 
 const char * __ntlmssp_t_str(const void *message, struct ntlmssp_buffer *buffer,
-			     int unicode)
+			     bool unicode)
 {
 	unsigned int len = read_le16(&buffer->length);
 	const char *p = ((char *) message) + read_le32(&buffer->offset);
@@ -42,7 +42,7 @@
 }
 
 static unsigned int append_string(buffer_t *buf, const char *str, 
-				  int ucase, int unicode)
+				  bool ucase, bool unicode)
 {
 	unsigned int length = 0;
 
@@ -200,52 +200,52 @@
 	return 1;
 }
 
-int ntlmssp_check_request(const struct ntlmssp_request *request,
-			  size_t data_size, const char **error)
+bool ntlmssp_check_request(const struct ntlmssp_request *request,
+			   size_t data_size, const char **error)
 {
 	uint32_t flags;
 
 	if (data_size < sizeof(struct ntlmssp_request)) {
 		*error = "request too short";
-		return 0;
+		return FALSE;
 	}
 
 	if (read_le64(&request->magic) != NTLMSSP_MAGIC) {
 		*error = "signature mismatch";
-		return 0;
+		return FALSE;
 	}
 
 	if (read_le32(&request->type) != NTLMSSP_MSG_TYPE1) {
 		*error = "message type mismatch";
-		return 0;
+		return FALSE;
 	}
 
 	flags = read_le32(&request->flags);
 
 	if ((flags & NTLMSSP_NEGOTIATE_NTLM) == 0) {
 		*error = "client doesn't advertise NTLM support";
-		return 0;
+		return FALSE;
 	}
 
-	return 1;
+	return TRUE;
 }
 
-int ntlmssp_check_response(const struct ntlmssp_response *response,
-			   size_t data_size, const char **error)
+bool ntlmssp_check_response(const struct ntlmssp_response *response,
+			    size_t data_size, const char **error)
 {
 	if (data_size < sizeof(struct ntlmssp_response)) {
 		*error = "response too short";
-		return 0;
+		return FALSE;
 	}
 
 	if (read_le64(&response->magic) != NTLMSSP_MAGIC) {
 		*error = "signature mismatch";
-		return 0;
+		return FALSE;
 	}
 
 	if (read_le32(&response->type) != NTLMSSP_MSG_TYPE3) {
 		*error = "message type mismatch";
-		return 0;
+		return FALSE;
 	}
 
 	if (!ntlmssp_check_buffer(&response->lm_response, data_size, error) ||
@@ -253,7 +253,7 @@
 	    !ntlmssp_check_buffer(&response->domain, data_size, error) ||
 	    !ntlmssp_check_buffer(&response->user, data_size, error) ||
 	    !ntlmssp_check_buffer(&response->workstation, data_size, error))
-		return 0;
+		return FALSE;
 
-	return 1;
+	return TRUE;
 }
--- a/src/lib-ntlm/ntlm-message.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-ntlm/ntlm-message.h	Fri Jan 13 22:25:57 2006 +0200
@@ -5,9 +5,9 @@
 ntlmssp_create_challenge(pool_t pool, const struct ntlmssp_request *request,
 			 size_t *size);
 
-int ntlmssp_check_request(const struct ntlmssp_request *request,
-			  size_t data_size, const char **error);
-int ntlmssp_check_response(const struct ntlmssp_response *response,
+bool ntlmssp_check_request(const struct ntlmssp_request *request,
 			   size_t data_size, const char **error);
+bool ntlmssp_check_response(const struct ntlmssp_response *response,
+			    size_t data_size, const char **error);
 
 #endif	/* __NTLM_MESSAGE_H__ */
--- a/src/lib-ntlm/ntlm.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-ntlm/ntlm.h	Fri Jan 13 22:25:57 2006 +0200
@@ -31,6 +31,6 @@
 
 const char * __ntlmssp_t_str(const void *message,
 			     struct ntlmssp_buffer *buffer,
-			     int unicode);
+			     bool unicode);
 
 #endif
--- a/src/lib-settings/settings.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-settings/settings.c	Fri Jan 13 22:25:57 2006 +0200
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-static const char *get_bool(const char *value, int *result)
+static const char *get_bool(const char *value, bool *result)
 {
 	if (strcasecmp(value, "yes") == 0)
 		*result = TRUE;
@@ -50,7 +50,7 @@
 				   as octal value with umasks */
 				return get_uint(value, (unsigned int *) ptr);
 			case SET_BOOL:
-				return get_bool(value, (int *) ptr);
+				return get_bool(value, (bool *) ptr);
 			}
 		}
 	}
@@ -60,9 +60,9 @@
 
 #define IS_WHITE(c) ((c) == ' ' || (c) == '\t')
 
-int settings_read(const char *path, const char *section,
-		  settings_callback_t *callback,
-		  settings_section_callback_t *sect_callback, void *context)
+bool settings_read(const char *path, const char *section,
+		   settings_callback_t *callback,
+		   settings_section_callback_t *sect_callback, void *context)
 {
 	struct istream *input;
 	const char *errormsg, *next_section;
--- a/src/lib-settings/settings.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-settings/settings.h	Fri Jan 13 22:25:57 2006 +0200
@@ -18,15 +18,15 @@
 					void *context);
 
 /* Return TRUE if we want to go inside the section */
-typedef int settings_section_callback_t(const char *type, const char *name,
-					void *context, const char **errormsg);
+typedef bool settings_section_callback_t(const char *type, const char *name,
+					 void *context, const char **errormsg);
 
 const char *
 parse_setting_from_defs(pool_t pool, struct setting_def *defs, void *base,
 			const char *key, const char *value);
 
-int settings_read(const char *path, const char *section,
-		  settings_callback_t *callback,
-		  settings_section_callback_t *sect_callback, void *context);
+bool settings_read(const char *path, const char *section,
+		   settings_callback_t *callback,
+		   settings_section_callback_t *sect_callback, void *context);
 
 #endif
--- a/src/lib-sql/driver-mysql.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-sql/driver-mysql.c	Fri Jan 13 22:25:57 2006 +0200
@@ -71,12 +71,12 @@
 extern struct sql_result driver_mysql_result;
 extern struct sql_result driver_mysql_error_result;
 
-static int driver_mysql_connect(struct mysql_connection *conn)
+static bool driver_mysql_connect(struct mysql_connection *conn)
 {
 	struct mysql_db *db = conn->db;
 	const char *unix_socket, *host;
 	time_t now;
-	int failed;
+	bool failed;
 
 	if (conn->connected)
 		return TRUE;
@@ -302,8 +302,9 @@
 {
 	struct mysql_connection *conn;
 	size_t size;
-	int reset, ret;
 	unsigned int i, start;
+	bool reset;
+	int ret;
 
 	conn = buffer_get_modifyable_data(db->connections, &size);
 	size /= sizeof(*conn);
@@ -313,7 +314,7 @@
 	start = db->next_query_connection % size;
 	db->next_query_connection++;
 
-	for (reset = 0;; reset++) {
+	for (reset = FALSE;; reset = TRUE) {
 		i = start;
 		do {
 			ret = driver_mysql_connection_do_query(&conn[i], query);
--- a/src/lib-sql/driver-pgsql.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-sql/driver-pgsql.c	Fri Jan 13 22:25:57 2006 +0200
@@ -251,7 +251,7 @@
 static void result_finish(struct pgsql_result *result)
 {
 	struct pgsql_db *db = (struct pgsql_db *)result->api.db;
-	int free_result = TRUE;
+	bool free_result = TRUE;
 
 	if (result->callback != NULL) {
 		result->api.callback = TRUE;
--- a/src/lib-storage/index/dbox/dbox-list.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-list.c	Fri Jan 13 22:25:57 2006 +0200
@@ -26,7 +26,7 @@
 	struct imap_match_glob *glob;
 	struct subsfile_list_context *subsfile_ctx;
 
-	int failed, inbox_found;
+	bool failed, inbox_found;
 
 	struct mailbox_list *(*next)(struct dbox_list_context *ctx);
 
@@ -63,7 +63,7 @@
 }
 
 static int list_opendir(struct mail_storage *storage,
-			const char *path, int root, DIR **dirp)
+			const char *path, bool root, DIR **dirp)
 {
 	*dirp = opendir(*path == '\0' ? "/" : path);
 	if (*dirp != NULL)
--- a/src/lib-storage/index/dbox/dbox-mail.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-mail.c	Fri Jan 13 22:25:57 2006 +0200
@@ -51,7 +51,8 @@
 {
 	struct dbox_mailbox *mbox =
 		(struct dbox_mailbox *)trans->ibox;
-	int synced = FALSE, ret;
+	bool synced = FALSE;
+	int ret;
 
 	for (;;) {
 		ret = dbox_file_lookup_offset(mbox, trans->trans_view, seq,
--- a/src/lib-storage/index/dbox/dbox-save.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-save.c	Fri Jan 13 22:25:57 2006 +0200
@@ -29,7 +29,7 @@
 	uint64_t hdr_offset;
 	uint64_t mail_offset;
 
-	int failed;
+	bool failed;
 };
 
 struct mail_save_context *
@@ -37,7 +37,7 @@
 	       enum mail_flags flags, struct mail_keywords *keywords,
 	       time_t received_date, int timezone_offset __attr_unused__,
 	       const char *from_envelope __attr_unused__,
-	       struct istream *input, int want_mail __attr_unused__)
+	       struct istream *input, bool want_mail __attr_unused__)
 {
 	struct dbox_transaction_context *t =
 		(struct dbox_transaction_context *)_t;
--- a/src/lib-storage/index/dbox/dbox-storage.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-storage.c	Fri Jan 13 22:25:57 2006 +0200
@@ -19,7 +19,7 @@
 #define CREATE_MODE 0770 /* umask() should limit it more */
 
 struct rename_context {
-	int found;
+	bool found;
 	size_t oldnamelen;
 	const char *newname;
 };
@@ -27,7 +27,7 @@
 extern struct mail_storage dbox_storage;
 extern struct mailbox dbox_mailbox;
 
-static int dbox_handle_errors(struct index_storage *istorage)
+static bool dbox_handle_errors(struct index_storage *istorage)
 {
 	struct mail_storage *storage = &istorage->storage;
 
@@ -47,7 +47,7 @@
 	    enum mail_storage_flags flags,
 	    enum mail_storage_lock_method lock_method)
 {
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 	struct dbox_storage *storage;
 	struct index_storage *istorage;
 	const char *root_dir, *index_dir, *p;
@@ -125,9 +125,9 @@
 	pool_unref(storage->storage.pool);
 }
 
-static int dbox_autodetect(const char *data, enum mail_storage_flags flags)
+static bool dbox_autodetect(const char *data, enum mail_storage_flags flags)
 {
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 	struct stat st;
 	const char *path;
 
@@ -148,10 +148,10 @@
 	return TRUE;
 }
 
-int dbox_is_valid_mask(struct mail_storage *storage, const char *mask)
+bool dbox_is_valid_mask(struct mail_storage *storage, const char *mask)
 {
 	const char *p;
-	int newdir;
+	bool newdir;
 
 	if ((storage->flags & MAIL_STORAGE_FLAG_FULL_FS_ACCESS) != 0)
 		return TRUE;
@@ -171,8 +171,8 @@
 	return TRUE;
 }
 
-static int dbox_is_valid_create_name(struct mail_storage *storage,
-				     const char *name)
+static bool dbox_is_valid_create_name(struct mail_storage *storage,
+				      const char *name)
 {
 	size_t len;
 
@@ -184,8 +184,8 @@
 	return dbox_is_valid_mask(storage, name);
 }
 
-static int dbox_is_valid_existing_name(struct mail_storage *storage,
-				       const char *name)
+static bool dbox_is_valid_existing_name(struct mail_storage *storage,
+					const char *name)
 {
 	size_t len;
 
@@ -242,8 +242,8 @@
 	return 0;
 }
 
-static int dbox_is_recent(struct index_mailbox *ibox __attr_unused__,
-			  uint32_t uid __attr_unused__)
+static bool dbox_is_recent(struct index_mailbox *ibox __attr_unused__,
+			   uint32_t uid __attr_unused__)
 {
 	return FALSE;
 }
@@ -371,7 +371,7 @@
 
 static int dbox_mailbox_create(struct mail_storage *_storage,
 			       const char *name,
-			       int directory __attr_unused__)
+			       bool directory __attr_unused__)
 {
 	struct dbox_storage *storage = (struct dbox_storage *)_storage;
 	struct index_storage *istorage = INDEX_STORAGE(storage);
@@ -530,7 +530,7 @@
 }
 
 static int dbox_set_subscribed(struct mail_storage *_storage,
-			       const char *name, int set)
+			       const char *name, bool set)
 {
 	struct dbox_storage *storage = (struct dbox_storage *)_storage;
 	const char *path;
--- a/src/lib-storage/index/dbox/dbox-storage.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-storage.h	Fri Jan 13 22:25:57 2006 +0200
@@ -112,7 +112,7 @@
 	       enum mail_flags flags, struct mail_keywords *keywords,
 	       time_t received_date, int timezone_offset,
 	       const char *from_envelope, struct istream *input,
-	       int want_mail);
+	       bool want_mail);
 int dbox_save_continue(struct mail_save_context *ctx);
 int dbox_save_finish(struct mail_save_context *ctx, struct mail *dest_mail);
 void dbox_save_cancel(struct mail_save_context *ctx);
@@ -121,7 +121,7 @@
 void dbox_transaction_save_commit_post(struct dbox_save_context *ctx);
 void dbox_transaction_save_rollback(struct dbox_save_context *ctx);
 
-int dbox_is_valid_mask(struct mail_storage *storage, const char *mask);
+bool dbox_is_valid_mask(struct mail_storage *storage, const char *mask);
 
 int dbox_mail_lookup_offset(struct index_transaction_context *trans,
 			    uint32_t seq, uint32_t *file_seq_r,
--- a/src/lib-storage/index/dbox/dbox-sync-expunge.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-sync-expunge.c	Fri Jan 13 22:25:57 2006 +0200
@@ -212,7 +212,8 @@
 	unsigned int i, count, sync_count;
 	uint32_t file_seq, uid, uid1, uid2, first_expunged_uid;
 	uoff_t offset;
-	int ret, seen_expunges, skipped_expunges;
+	int ret;
+	bool seen_expunges, skipped_expunges;
 
 	sync_recs = array_get(&sync_entry->sync_recs, &sync_count);
 	if (dbox_sync_get_file_offset(ctx, sync_recs[sync_idx].seq1,
--- a/src/lib-storage/index/dbox/dbox-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -283,7 +283,7 @@
 	return ret;
 }
 
-int dbox_sync(struct dbox_mailbox *mbox, int force)
+int dbox_sync(struct dbox_mailbox *mbox, bool force)
 {
 	struct dbox_sync_context ctx;
 	const struct mail_index_header *hdr;
--- a/src/lib-storage/index/dbox/dbox-sync.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-sync.h	Fri Jan 13 22:25:57 2006 +0200
@@ -47,7 +47,7 @@
 	array_t ARRAY_DEFINE(exists, struct seq_range);
 };
 
-int dbox_sync(struct dbox_mailbox *mbox, int force);
+int dbox_sync(struct dbox_mailbox *mbox, bool force);
 int dbox_sync_if_changed(struct dbox_mailbox *mbox);
 
 struct mailbox_sync_context *
--- a/src/lib-storage/index/dbox/dbox-uidlist.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/dbox/dbox-uidlist.c	Fri Jan 13 22:25:57 2006 +0200
@@ -156,8 +156,8 @@
 	return (int)*file_seq - (int)(*entry)->file_seq;
 }
 
-static int dbox_uidlist_add_entry(struct dbox_uidlist *uidlist,
-				  const struct dbox_uidlist_entry *src_entry)
+static bool dbox_uidlist_add_entry(struct dbox_uidlist *uidlist,
+				   const struct dbox_uidlist_entry *src_entry)
 {
 	struct dbox_uidlist_entry *dest_entry, **entries, **pos;
 	const struct seq_range *range;
@@ -210,7 +210,7 @@
 	return TRUE;
 }
 
-static int dbox_uidlist_next(struct dbox_uidlist *uidlist, const char *line)
+static bool dbox_uidlist_next(struct dbox_uidlist *uidlist, const char *line)
 {
 	struct dbox_uidlist_entry *entry;
 	struct seq_range range;
--- a/src/lib-storage/index/index-mail-headers.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-mail-headers.c	Fri Jan 13 22:25:57 2006 +0200
@@ -42,7 +42,7 @@
 	buffer_t *buf;
 	size_t data_size;
 	unsigned int i, j, count, match_idx, match_count;
-	int noncontiguous;
+	bool noncontiguous;
 
 	t_push();
 
@@ -444,7 +444,7 @@
 	return -1;
 }
 
-static int skip_header(const unsigned char **data, size_t len)
+static bool skip_header(const unsigned char **data, size_t len)
 {
 	const unsigned char *p = *data;
 	size_t i;
@@ -585,7 +585,7 @@
 }
 
 static void header_cache_callback(struct message_header_line *hdr,
-				  int *matched, void *context)
+				  bool *matched, void *context)
 {
 	struct index_mail *mail = context;
 
--- a/src/lib-storage/index/index-mail.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-mail.c	Fri Jan 13 22:25:57 2006 +0200
@@ -31,9 +31,9 @@
 	{ "mime.parts", 0, MAIL_CACHE_FIELD_VARIABLE_SIZE, 0, 0 }
 };
 
-static void index_mail_parse_body(struct index_mail *mail, int need_parts);
+static void index_mail_parse_body(struct index_mail *mail, bool need_parts);
 
-static int get_cached_parts(struct index_mail *mail)
+static bool get_cached_parts(struct index_mail *mail)
 {
 	struct mail_cache_field *cache_fields = mail->ibox->cache_fields;
 	struct message_part *part;
@@ -88,9 +88,9 @@
 	return str_c(str);
 }
 
-static int index_mail_get_fixed_field(struct index_mail *mail,
-				      enum index_cache_field field,
-				      void *data, size_t data_size)
+static bool index_mail_get_fixed_field(struct index_mail *mail,
+				       enum index_cache_field field,
+				       void *data, size_t data_size)
 {
 	buffer_t *buf;
 	int ret;
@@ -270,7 +270,7 @@
 	return data->sent_date.time;
 }
 
-static int get_cached_msgpart_sizes(struct index_mail *mail)
+static bool get_cached_msgpart_sizes(struct index_mail *mail)
 {
 	struct index_mail_data *data = &mail->data;
 
@@ -344,7 +344,7 @@
 	imap_bodystructure_parse_header(pool, part, hdr);
 }
 
-static void index_mail_parse_body(struct index_mail *mail, int need_parts)
+static void index_mail_parse_body(struct index_mail *mail, bool need_parts)
 {
 	struct index_mail_data *data = &mail->data;
 	struct mail_cache_field *cache_fields = mail->ibox->cache_fields;
@@ -499,8 +499,8 @@
 	struct mail_cache_field *cache_fields = mail->ibox->cache_fields;
 	enum mail_cache_decision_type dec;
 	string_t *str;
-	int bodystructure_cached = FALSE;
-	int plain_bodystructure = FALSE;
+	bool bodystructure_cached = FALSE;
+	bool plain_bodystructure = FALSE;
 
 	if (!data->parsed_bodystructure) {
 		if (data->save_bodystructure_header ||
@@ -577,7 +577,7 @@
 
 static void
 index_mail_get_plain_bodystructure(struct index_mail *mail, string_t *str,
-				   int extended)
+				   bool extended)
 {
 	str_printfa(str, IMAP_BODY_PLAIN_7BIT_ASCII" %"PRIuUOFF_T" %u",
 		    mail->data.parts->body_size.virtual_size,
--- a/src/lib-storage/index/index-mailbox-check.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-mailbox-check.c	Fri Jan 13 22:25:57 2006 +0200
@@ -27,7 +27,7 @@
 	struct index_notify_file *file;
 	struct stat st;
 	time_t last_check;
-	int notify;
+	bool notify;
 
 	/* check changes only when we can also notify of new mail */
 	last_check = I_MAX(ibox->sync_last_check, ibox->notify_last_check);
--- a/src/lib-storage/index/index-search.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-search.c	Fri Jan 13 22:25:57 2006 +0200
@@ -124,7 +124,7 @@
 static void search_index_arg(struct mail_search_arg *arg, void *context)
 {
 	struct index_search_context *ctx = context;
-	int found;
+	bool found;
 
 	if (arg->type == SEARCH_SEQSET) {
 		found = seqset_contains(arg->value.seqset, ctx->mail->seq);
@@ -285,7 +285,7 @@
 search_header_context(struct index_search_context *ctx,
 		      struct mail_search_arg *arg)
 {
-	int unknown_charset;
+	bool unknown_charset;
 
 	if (arg->context != NULL) {
                 message_header_search_reset(arg->context);
@@ -439,7 +439,8 @@
 {
 	struct search_body_context *ctx = context;
         enum message_body_search_error error;
-	int ret, retry = FALSE;
+	int ret;
+	bool retry = FALSE;
 
 	if (ctx->index_ctx->error != NULL)
 		return;
@@ -481,13 +482,13 @@
 	ARG_SET_RESULT(arg, ret > 0);
 }
 
-static int search_arg_match_text(struct mail_search_arg *args,
-				 struct index_search_context *ctx)
+static bool search_arg_match_text(struct mail_search_arg *args,
+				  struct index_search_context *ctx)
 {
 	struct istream *input;
 	struct mailbox_header_lookup_ctx *headers_ctx;
 	const char *const *headers;
-	int have_headers, have_body;
+	bool have_headers, have_body;
 
 	/* first check what we need to use */
 	headers = mail_search_args_analyze(args, &have_headers, &have_body);
@@ -791,7 +792,7 @@
 	return ret;
 }
 
-static int search_match_next(struct index_search_context *ctx)
+static bool search_match_next(struct index_search_context *ctx)
 {
         struct mail_search_arg *arg;
 	int ret;
--- a/src/lib-storage/index/index-storage.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-storage.c	Fri Jan 13 22:25:57 2006 +0200
@@ -149,7 +149,7 @@
 	return index;
 }
 
-static void destroy_unrefed(int all)
+static void destroy_unrefed(bool all)
 {
 	struct index_list **list, *rec;
 
@@ -225,7 +225,7 @@
 
 static void index_cache_register_defaults(struct index_mailbox *ibox)
 {
-	static int initialized = FALSE;
+	static bool initialized = FALSE;
 	struct mail_cache *cache = ibox->cache;
 	const char *cache_env, *never_env;
 
@@ -383,14 +383,14 @@
 	pool_unref(box->pool);
 }
 
-int index_storage_is_readonly(struct mailbox *box)
+bool index_storage_is_readonly(struct mailbox *box)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *) box;
 
 	return ibox->readonly;
 }
 
-int index_storage_allow_new_keywords(struct mailbox *box)
+bool index_storage_allow_new_keywords(struct mailbox *box)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *) box;
 
@@ -398,7 +398,7 @@
 	return !ibox->readonly;
 }
 
-int index_storage_is_inconsistent(struct mailbox *box)
+bool index_storage_is_inconsistent(struct mailbox *box)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *) box;
 
@@ -416,15 +416,15 @@
 }
 
 const char *index_storage_get_last_error(struct mail_storage *storage,
-					 int *syntax_error_r,
-					 int *temporary_error_r)
+					 bool *syntax_error_r,
+					 bool *temporary_error_r)
 {
 	*syntax_error_r = storage->syntax_error;
 	*temporary_error_r = storage->temporary_error;
 	return storage->error;
 }
 
-int mail_storage_set_index_error(struct index_mailbox *ibox)
+void mail_storage_set_index_error(struct index_mailbox *ibox)
 {
 	switch (mail_index_get_last_error(ibox->index)) {
 	case MAIL_INDEX_ERROR_NONE:
@@ -439,7 +439,6 @@
 	if (ibox->view != NULL)
 		mail_index_view_unlock(ibox->view);
 	mail_index_reset_error(ibox->index);
-	return FALSE;
 }
 
 struct mail_keywords *
--- a/src/lib-storage/index/index-storage.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-storage.h	Fri Jan 13 22:25:57 2006 +0200
@@ -44,7 +44,7 @@
 	struct mail_cache *cache;
 	struct mail_vfuncs *mail_vfuncs;
 
-	int (*is_recent)(struct index_mailbox *ibox, uint32_t uid);
+	bool (*is_recent)(struct index_mailbox *ibox, uint32_t uid);
 
 	uint32_t md5hdr_ext_idx;
 
@@ -91,7 +91,7 @@
 	unsigned int cache_trans_failed:1;
 };
 
-int mail_storage_set_index_error(struct index_mailbox *ibox);
+void mail_storage_set_index_error(struct index_mailbox *ibox);
 
 void index_storage_lock_notify(struct index_mailbox *ibox,
 			       enum mailbox_lock_notify_type notify_type,
@@ -114,9 +114,9 @@
 			       enum mailbox_open_flags flags);
 void index_storage_mailbox_free(struct mailbox *box);
 
-int index_storage_is_readonly(struct mailbox *box);
-int index_storage_allow_new_keywords(struct mailbox *box);
-int index_storage_is_inconsistent(struct mailbox *box);
+bool index_storage_is_readonly(struct mailbox *box);
+bool index_storage_allow_new_keywords(struct mailbox *box);
+bool index_storage_is_inconsistent(struct mailbox *box);
 
 struct mail_keywords *
 index_keywords_create(struct mailbox_transaction_context *t,
@@ -125,7 +125,7 @@
 			 struct mail_keywords *keywords);
 
 void index_mailbox_set_recent(struct index_mailbox *ibox, uint32_t seq);
-int index_mailbox_is_recent(struct index_mailbox *ibox, uint32_t seq);
+bool index_mailbox_is_recent(struct index_mailbox *ibox, uint32_t seq);
 
 unsigned int index_storage_get_recent_count(struct mail_index_view *view);
 
@@ -135,7 +135,7 @@
 
 struct mailbox_sync_context *
 index_mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags,
-			int failed);
+			bool failed);
 int index_mailbox_sync_next(struct mailbox_sync_context *ctx,
 			    struct mailbox_sync_rec *sync_rec_r);
 int index_mailbox_sync_deinit(struct mailbox_sync_context *ctx,
@@ -147,8 +147,8 @@
 				 struct mail_storage_callbacks *callbacks,
 				 void *context);
 const char *index_storage_get_last_error(struct mail_storage *storage,
-					 int *syntax_error_r,
-					 int *temporary_error_r);
+					 bool *syntax_error_r,
+					 bool *temporary_error_r);
 int index_storage_get_status(struct mailbox *box,
 			     enum mailbox_status_items items,
 			     struct mailbox_status *status);
@@ -179,6 +179,6 @@
 int index_transaction_commit(struct mailbox_transaction_context *t);
 void index_transaction_rollback(struct mailbox_transaction_context *t);
 
-int index_keyword_array_cmp(const array_t *k1, const array_t *k2);
+bool index_keyword_array_cmp(const array_t *k1, const array_t *k2);
 
 #endif
--- a/src/lib-storage/index/index-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/index-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -41,7 +41,7 @@
 	}
 }
 
-int index_mailbox_is_recent(struct index_mailbox *ibox, uint32_t seq)
+bool index_mailbox_is_recent(struct index_mailbox *ibox, uint32_t seq)
 {
 	const unsigned char *data;
 	size_t size;
@@ -125,7 +125,7 @@
 
 struct mailbox_sync_context *
 index_mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags,
-			int failed)
+			bool failed)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *)box;
         struct index_mailbox_sync_context *ctx;
@@ -269,7 +269,7 @@
 	return ret;
 }
 
-int index_keyword_array_cmp(const array_t *k1, const array_t *k2)
+bool index_keyword_array_cmp(const array_t *k1, const array_t *k2)
 {
 	ARRAY_SET_TYPE(k1, unsigned int);
 	ARRAY_SET_TYPE(k2, unsigned int);
--- a/src/lib-storage/index/maildir/maildir-copy.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-copy.c	Fri Jan 13 22:25:57 2006 +0200
@@ -14,7 +14,7 @@
 
 struct maildir_copy_context {
 	struct maildir_mailbox *mbox;
-	int hardlink;
+	bool hardlink;
 
         struct maildir_uidlist_sync_ctx *uidlist_sync_ctx;
 	struct maildir_keywords_sync_ctx *keywords_sync_ctx;
@@ -25,7 +25,7 @@
 
 struct hardlink_ctx {
 	const char *dest_path;
-	int found;
+	bool found;
 };
 
 struct rollback {
--- a/src/lib-storage/index/maildir/maildir-list.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-list.c	Fri Jan 13 22:25:57 2006 +0200
@@ -29,10 +29,10 @@
 	size_t parent_pos;
 	struct mailbox_node *root, *next_node;
 	struct mailbox_list list;
-	int failed;
+	bool failed;
 };
 
-static void maildir_nodes_fix(struct mailbox_node *node, int is_subs)
+static void maildir_nodes_fix(struct mailbox_node *node, bool is_subs)
 {
 	while (node != NULL) {
 		if (node->children != NULL) {
@@ -49,8 +49,9 @@
 	}
 }
 
-static int maildir_fill_readdir(struct maildir_list_context *ctx,
-				struct imap_match_glob *glob, int update_only)
+static bool
+maildir_fill_readdir(struct maildir_list_context *ctx,
+		     struct imap_match_glob *glob, bool update_only)
 {
 	DIR *dirp;
 	struct dirent *d;
@@ -59,7 +60,7 @@
 	string_t *mailbox;
 	enum imap_match_result match;
 	struct mailbox_node *node;
-	int stat_dirs, created, hide;
+	bool stat_dirs, created, hide;
 
 	dirp = opendir(ctx->dir);
 	if (dirp == NULL) {
@@ -196,15 +197,15 @@
 	return TRUE;
 }
 
-static int maildir_fill_subscribed(struct maildir_list_context *ctx,
-				   struct imap_match_glob *glob)
+static bool maildir_fill_subscribed(struct maildir_list_context *ctx,
+				    struct imap_match_glob *glob)
 {
 	struct maildir_storage *storage =
 		(struct maildir_storage *)ctx->mailbox_ctx.storage;
 	struct subsfile_list_context *subsfile_ctx;
 	const char *path, *name, *p;
 	struct mailbox_node *node;
-	int created;
+	bool created;
 
 	path = t_strconcat(storage->control_dir != NULL ?
 			   storage->control_dir : INDEX_STORAGE(storage)->dir,
@@ -303,7 +304,7 @@
 
 	if ((flags & MAILBOX_LIST_SUBSCRIBED) == 0 ||
 	    (ctx->flags & MAILBOX_LIST_FAST_FLAGS) == 0) {
-		int update_only = (flags & MAILBOX_LIST_SUBSCRIBED) != 0;
+		bool update_only = (flags & MAILBOX_LIST_SUBSCRIBED) != 0;
 		if (!maildir_fill_readdir(ctx, glob, update_only)) {
 			ctx->failed = TRUE;
 			return &ctx->mailbox_ctx;
--- a/src/lib-storage/index/maildir/maildir-mail.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Fri Jan 13 22:25:57 2006 +0200
@@ -42,7 +42,7 @@
 }
 
 static struct istream *
-maildir_open_mail(struct maildir_mailbox *mbox, uint32_t uid, int *deleted)
+maildir_open_mail(struct maildir_mailbox *mbox, uint32_t uid, bool *deleted)
 {
 	int fd;
 
@@ -223,7 +223,7 @@
 	struct index_mail *mail = (struct index_mail *)_mail;
 	struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->ibox;
 	struct index_mail_data *data = &mail->data;
-	int deleted;
+	bool deleted;
 
 	if (data->stream == NULL) {
 		data->stream = maildir_open_mail(mbox,
--- a/src/lib-storage/index/maildir/maildir-save.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-save.c	Fri Jan 13 22:25:57 2006 +0200
@@ -120,7 +120,7 @@
 		  enum mail_flags flags, struct mail_keywords *keywords,
 		  time_t received_date, int timezone_offset __attr_unused__,
 		  const char *from_envelope __attr_unused__,
-		  struct istream *input, int want_mail)
+		  struct istream *input, bool want_mail)
 {
 	struct maildir_transaction_context *t =
 		(struct maildir_transaction_context *)_t;
--- a/src/lib-storage/index/maildir/maildir-storage.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Fri Jan 13 22:25:57 2006 +0200
@@ -19,7 +19,7 @@
 #define CREATE_MODE 0770 /* umask() should limit it more */
 
 struct rename_context {
-	int found;
+	bool found;
 	size_t oldnamelen;
 	const char *newname;
 };
@@ -36,7 +36,7 @@
 	       enum mail_storage_flags flags,
 	       enum mail_storage_lock_method lock_method)
 {
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 	struct maildir_storage *storage;
 	struct index_storage *istorage;
 	const char *root_dir, *inbox_dir, *index_dir, *control_dir;
@@ -150,9 +150,9 @@
 	pool_unref(storage->storage.pool);
 }
 
-static int maildir_autodetect(const char *data, enum mail_storage_flags flags)
+static bool maildir_autodetect(const char *data, enum mail_storage_flags flags)
 {
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 	struct stat st;
 	const char *path;
 
@@ -173,8 +173,8 @@
 	return TRUE;
 }
 
-static int maildir_is_valid_create_name(struct mail_storage *storage,
-					const char *name)
+static bool maildir_is_valid_create_name(struct mail_storage *storage,
+					 const char *name)
 {
 	size_t len;
 
@@ -193,8 +193,8 @@
 	return TRUE;
 }
 
-static int maildir_is_valid_existing_name(struct mail_storage *storage,
-					  const char *name)
+static bool maildir_is_valid_existing_name(struct mail_storage *storage,
+					   const char *name)
 {
 	if (name[0] == '\0' || name[strlen(name)-1] == '/')
 		return FALSE;
@@ -208,7 +208,7 @@
 	return TRUE;
 }
 
-static const char *maildir_get_absolute_path(const char *name, int unlink)
+static const char *maildir_get_absolute_path(const char *name, bool unlink)
 {
 	const char *p;
 
@@ -279,7 +279,7 @@
 }
 
 static int mkdir_verify(struct index_storage *storage,
-			const char *dir, int verify)
+			const char *dir, bool verify)
 {
 	struct stat st;
 
@@ -308,7 +308,7 @@
 
 /* create or fix maildir, ignore if it already exists */
 static int create_maildir(struct index_storage *storage,
-			  const char *dir, int verify)
+			  const char *dir, bool verify)
 {
 	const char **tmp, *path;
 
@@ -394,7 +394,7 @@
 	return 0;
 }
 
-static int maildir_is_recent(struct index_mailbox *ibox, uint32_t uid)
+static bool maildir_is_recent(struct index_mailbox *ibox, uint32_t uid)
 {
 	struct maildir_mailbox *mbox = (struct maildir_mailbox *)ibox;
 
@@ -537,7 +537,7 @@
 
 static int maildir_mailbox_create(struct mail_storage *_storage,
 				  const char *name,
-				  int directory __attr_unused__)
+				  bool directory __attr_unused__)
 {
 	struct index_storage *storage = (struct index_storage *)_storage;
 	struct stat st;
@@ -729,7 +729,8 @@
 {
 	struct index_storage *storage = (struct index_storage *)_storage;
 	const char *oldpath, *newpath;
-	int ret, found;
+	int ret;
+        bool found;
 
 	mail_storage_clear_error(_storage);
 
@@ -779,7 +780,7 @@
 }
 
 static int maildir_set_subscribed(struct mail_storage *_storage,
-				  const char *name, int set)
+				  const char *name, bool set)
 {
 	struct maildir_storage *storage = (struct maildir_storage *)_storage;
 	const char *path;
--- a/src/lib-storage/index/maildir/maildir-storage.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-storage.h	Fri Jan 13 22:25:57 2006 +0200
@@ -103,7 +103,7 @@
 maildir_sync_index_begin(struct maildir_mailbox *mbox);
 void maildir_sync_index_abort(struct maildir_index_sync_context *sync_ctx);
 int maildir_sync_index_finish(struct maildir_index_sync_context *sync_ctx,
-			      int partial);
+			      bool partial);
 
 struct mailbox_transaction_context *
 maildir_transaction_begin(struct mailbox *box,
@@ -117,7 +117,7 @@
 		  enum mail_flags flags, struct mail_keywords *keywords,
 		  time_t received_date, int timezone_offset,
 		  const char *from_envelope, struct istream *input,
-		  int want_mail);
+		  bool want_mail);
 int maildir_save_continue(struct mail_save_context *ctx);
 int maildir_save_finish(struct mail_save_context *ctx, struct mail *dest_mail);
 void maildir_save_cancel(struct mail_save_context *ctx);
--- a/src/lib-storage/index/maildir/maildir-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -201,7 +201,7 @@
 struct maildir_sync_context {
         struct maildir_mailbox *mbox;
 	const char *new_dir, *cur_dir;
-	int partial;
+	bool partial;
 
 	struct maildir_uidlist_sync_ctx *uidlist_sync_ctx;
         struct maildir_index_sync_context *index_sync_ctx;
@@ -464,7 +464,7 @@
 	struct mail_index_sync_rec *recs;
 	unsigned int i, count;
 	uint32_t seq, uid;
-	int expunged, flag_changed;
+	bool expunged, flag_changed;
 
 	recs = array_get_modifyable(&ctx->sync_recs, &count);
 	for (seq = recs[0].uid1; seq <= last_seq; seq++) {
@@ -636,7 +636,7 @@
 	return ret;
 }
 
-static int maildir_scan_dir(struct maildir_sync_context *ctx, int new_dir)
+static int maildir_scan_dir(struct maildir_sync_context *ctx, bool new_dir)
 {
 	struct mail_storage *storage = STORAGE(ctx->mbox->storage);
 	const char *dir;
@@ -645,7 +645,8 @@
 	struct dirent *dp;
 	enum maildir_uidlist_rec_flag flags;
 	unsigned int moves = 0;
-	int move_new, ret = 1;
+	int ret = 1;
+	bool move_new;
 
 	dir = new_dir ? ctx->new_dir : ctx->cur_dir;
 	dirp = opendir(dir);
@@ -756,7 +757,7 @@
 static int
 maildir_sync_quick_check(struct maildir_mailbox *mbox,
 			 const char *new_dir, const char *cur_dir,
-			 int *new_changed_r, int *cur_changed_r)
+			 bool *new_changed_r, bool *cur_changed_r)
 {
 	struct stat st;
 	time_t new_mtime, cur_mtime;
@@ -845,7 +846,7 @@
 }
 
 int maildir_sync_index_finish(struct maildir_index_sync_context *sync_ctx,
-			      int partial)
+			      bool partial)
 {
 	struct maildir_mailbox *mbox = sync_ctx->mbox;
 	struct mail_index_view *view = sync_ctx->view;
@@ -862,7 +863,8 @@
 	uint32_t uid_validity, next_uid;
 	uint64_t value;
 	time_t old_new_sync_time;
-	int ret = 0, full_rescan = FALSE;
+	int ret = 0;
+	bool full_rescan = FALSE;
 
 	i_assert(maildir_uidlist_is_locked(sync_ctx->mbox->uidlist));
 
@@ -1164,11 +1166,11 @@
 	return ret < 0 ? -1 : (full_rescan ? 0 : 1);
 }
 
-static int maildir_sync_context(struct maildir_sync_context *ctx, int forced,
-				int sync_last_commit)
+static int maildir_sync_context(struct maildir_sync_context *ctx, bool forced,
+				bool sync_last_commit)
 {
-	int ret, new_changed, cur_changed;
-	int full_rescan = FALSE;
+	bool new_changed, cur_changed, full_rescan = FALSE;
+	int ret;
 
 	if (sync_last_commit) {
 		new_changed = cur_changed = FALSE;
@@ -1344,7 +1346,8 @@
 int maildir_sync_is_synced(struct maildir_mailbox *mbox)
 {
 	const char *new_dir, *cur_dir;
-	int ret, new_changed, cur_changed;
+	bool new_changed, cur_changed;
+	int ret;
 
 	t_push();
 	new_dir = t_strconcat(mbox->path, "/new", NULL);
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Fri Jan 13 22:25:57 2006 +0200
@@ -73,7 +73,7 @@
 };
 
 static int maildir_uidlist_lock_timeout(struct maildir_uidlist *uidlist,
-					int nonblock)
+					bool nonblock)
 {
 	const char *path;
 	mode_t old_mask;
@@ -118,7 +118,7 @@
 	return maildir_uidlist_lock_timeout(uidlist, TRUE);
 }
 
-int maildir_uidlist_is_locked(struct maildir_uidlist *uidlist)
+bool maildir_uidlist_is_locked(struct maildir_uidlist *uidlist)
 {
 	return UIDLIST_IS_LOCKED(uidlist);
 }
@@ -391,7 +391,7 @@
 	return rec->filename;
 }
 
-int maildir_uidlist_is_recent(struct maildir_uidlist *uidlist, uint32_t uid)
+bool maildir_uidlist_is_recent(struct maildir_uidlist *uidlist, uint32_t uid)
 {
 	enum maildir_uidlist_rec_flag flags;
 
@@ -562,7 +562,7 @@
 }
 
 static void maildir_uidlist_mark_all(struct maildir_uidlist *uidlist,
-				     int nonsynced)
+				     bool nonsynced)
 {
 	struct maildir_uidlist_rec **rec_p;
 	size_t i, size;
@@ -579,7 +579,7 @@
 	}
 }
 
-int maildir_uidlist_sync_init(struct maildir_uidlist *uidlist, int partial,
+int maildir_uidlist_sync_init(struct maildir_uidlist *uidlist, bool partial,
 			      struct maildir_uidlist_sync_ctx **sync_ctx_r)
 {
 	struct maildir_uidlist_sync_ctx *ctx;
@@ -826,7 +826,7 @@
 
 int maildir_uidlist_sync_deinit(struct maildir_uidlist_sync_ctx *ctx)
 {
-	int unlocked = FALSE;
+	bool unlocked = FALSE;
 	int ret = ctx->failed ? -1 : 0;
 
 	if (!ctx->finished)
--- a/src/lib-storage/index/maildir/maildir-uidlist.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/maildir/maildir-uidlist.h	Fri Jan 13 22:25:57 2006 +0200
@@ -16,7 +16,7 @@
 int maildir_uidlist_lock(struct maildir_uidlist *uidlist);
 int maildir_uidlist_try_lock(struct maildir_uidlist *uidlist);
 void maildir_uidlist_unlock(struct maildir_uidlist *uidlist);
-int maildir_uidlist_is_locked(struct maildir_uidlist *uidlist);
+bool maildir_uidlist_is_locked(struct maildir_uidlist *uidlist);
 
 struct maildir_uidlist *maildir_uidlist_init(struct maildir_mailbox *mbox);
 void maildir_uidlist_deinit(struct maildir_uidlist *uidlist);
@@ -29,7 +29,7 @@
 maildir_uidlist_lookup(struct maildir_uidlist *uidlist, uint32_t uid,
 		       enum maildir_uidlist_rec_flag *flags_r);
 /* Returns TRUE if mail with given UID is recent. */
-int maildir_uidlist_is_recent(struct maildir_uidlist *uidlist, uint32_t uid);
+bool maildir_uidlist_is_recent(struct maildir_uidlist *uidlist, uint32_t uid);
 /* Returns number of recent messages. */
 uint32_t maildir_uidlist_get_recent_count(struct maildir_uidlist *uidlist);
 
@@ -41,7 +41,7 @@
 
 /* Sync uidlist with what's actually on maildir. Returns same as
    maildir_uidlist_lock(). */
-int maildir_uidlist_sync_init(struct maildir_uidlist *uidlist, int partial,
+int maildir_uidlist_sync_init(struct maildir_uidlist *uidlist, bool partial,
 			      struct maildir_uidlist_sync_ctx **sync_ctx_r);
 /* Returns 1 = ok, -1 = error, 0 = new file and dovecot-uidlist is locked */
 int maildir_uidlist_sync_next_pre(struct maildir_uidlist_sync_ctx *ctx,
--- a/src/lib-storage/index/mbox/istream-raw-mbox.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/istream-raw-mbox.c	Fri Jan 13 22:25:57 2006 +0200
@@ -284,7 +284,7 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	struct raw_mbox_istream *rstream = (struct raw_mbox_istream *)stream;
 
@@ -306,7 +306,7 @@
 	rstream->istream.pos = 0;
 }
 
-static const struct stat *_stat(struct _istream *stream, int exact)
+static const struct stat *_stat(struct _istream *stream, bool exact)
 {
 	struct raw_mbox_istream *rstream = (struct raw_mbox_istream *)stream;
 
@@ -340,7 +340,7 @@
 				input->real_stream->abs_start_offset);
 }
 
-static int istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream)
+static bool istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream)
 {
 	const unsigned char *data;
 	size_t size;
@@ -521,7 +521,7 @@
 {
 	struct raw_mbox_istream *rstream =
 		(struct raw_mbox_istream *)stream->real_stream;
-	int check;
+	bool check;
 
 	rstream->corrupted = FALSE;
 	rstream->eof = FALSE;
@@ -561,7 +561,7 @@
 	return rstream->corrupted ? -1 : 0;
 }
 
-int istream_raw_mbox_is_eof(struct istream *stream)
+bool istream_raw_mbox_is_eof(struct istream *stream)
 {
 	struct raw_mbox_istream *rstream =
 		(struct raw_mbox_istream *)stream->real_stream;
--- a/src/lib-storage/index/mbox/istream-raw-mbox.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/istream-raw-mbox.h	Fri Jan 13 22:25:57 2006 +0200
@@ -34,6 +34,6 @@
 int istream_raw_mbox_seek(struct istream *stream, uoff_t offset);
 
 /* Returns TRUE if we've read the whole mbox. */
-int istream_raw_mbox_is_eof(struct istream *stream);
+bool istream_raw_mbox_is_eof(struct istream *stream);
 
 #endif
--- a/src/lib-storage/index/mbox/mbox-file.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-file.c	Fri Jan 13 22:25:57 2006 +0200
@@ -144,7 +144,7 @@
 }
 
 int mbox_file_seek(struct mbox_mailbox *mbox, struct mail_index_view *view,
-		   uint32_t seq, int *deleted_r)
+		   uint32_t seq, bool *deleted_r)
 {
 	const void *data;
 	uint64_t offset;
--- a/src/lib-storage/index/mbox/mbox-file.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-file.h	Fri Jan 13 22:25:57 2006 +0200
@@ -8,6 +8,6 @@
 void mbox_file_close_stream(struct mbox_mailbox *mbox);
 
 int mbox_file_seek(struct mbox_mailbox *mbox, struct mail_index_view *view,
-		   uint32_t seq, int *deleted_r);
+		   uint32_t seq, bool *deleted_r);
 
 #endif
--- a/src/lib-storage/index/mbox/mbox-list.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-list.c	Fri Jan 13 22:25:57 2006 +0200
@@ -32,7 +32,7 @@
 	struct imap_match_glob *glob;
 	struct subsfile_list_context *subsfile_ctx;
 
-	int failed, inbox_found;
+	bool failed, inbox_found;
 
 	struct mailbox_list *(*next)(struct mbox_list_context *ctx);
 
@@ -69,7 +69,7 @@
 }
 
 static int list_opendir(struct mail_storage *storage,
-			const char *path, int root, DIR **dirp)
+			const char *path, bool root, DIR **dirp)
 {
 	*dirp = opendir(*path == '\0' ? "/" : path);
 	if (*dirp != NULL)
@@ -222,7 +222,8 @@
 	DIR *dirp;
 	size_t len;
 	enum imap_match_result match, match2;
-	int ret, noselect;
+	int ret;
+	bool noselect;
 
 	/* skip all hidden files */
 	if (fname[0] == '.')
--- a/src/lib-storage/index/mbox/mbox-lock.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-lock.c	Fri Jan 13 22:25:57 2006 +0200
@@ -39,10 +39,10 @@
 struct mbox_lock_context {
 	struct mbox_mailbox *mbox;
 	int lock_status[MBOX_LOCK_COUNT];
-	int checked_file;
+	bool checked_file;
 
 	int lock_type;
-	int dotlock_last_stale;
+	bool dotlock_last_stale;
 };
 
 struct mbox_lock_data {
@@ -77,7 +77,7 @@
 	{ 0, NULL, NULL }
 };
 
-static int lock_settings_initialized = FALSE;
+static bool lock_settings_initialized = FALSE;
 static enum mbox_lock_type read_locks[MBOX_LOCK_COUNT+1];
 static enum mbox_lock_type write_locks[MBOX_LOCK_COUNT+1];
 static int lock_timeout, dotlock_change_timeout;
@@ -184,7 +184,7 @@
 	return 0;
 }
 
-static int dotlock_callback(unsigned int secs_left, int stale, void *context)
+static bool dotlock_callback(unsigned int secs_left, bool stale, void *context)
 {
         struct mbox_lock_context *ctx = context;
 	enum mbox_lock_type *lock_types;
@@ -448,7 +448,8 @@
 {
 	struct mbox_lock_context ctx;
 	time_t max_wait_time;
-	int ret, i, drop_locks;
+	int ret, i;
+	bool drop_locks;
 
         index_storage_lock_notify_reset(&mbox->ibox);
 
--- a/src/lib-storage/index/mbox/mbox-mail.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-mail.c	Fri Jan 13 22:25:57 2006 +0200
@@ -35,7 +35,8 @@
 		(struct mbox_transaction_context *)mail->trans;
 	struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
 	enum mbox_sync_flags sync_flags = 0;
-	int ret, deleted;
+	int ret;
+	bool deleted;
 
 	if (mail->mail.mail.expunged)
 		return 0;
--- a/src/lib-storage/index/mbox/mbox-md5.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-md5.c	Fri Jan 13 22:25:57 2006 +0200
@@ -9,17 +9,17 @@
 
 struct mbox_md5_context {
 	struct md5_context hdr_md5_ctx;
-	int seen_received_hdr;
+	bool seen_received_hdr;
 };
 
 struct mbox_md5_header_func {
 	const char *header;
-	int (*func)(struct mbox_md5_context *ctx,
-		    struct message_header_line *hdr);
+	bool (*func)(struct mbox_md5_context *ctx,
+		     struct message_header_line *hdr);
 };
 
-static int parse_date(struct mbox_md5_context *ctx,
-		      struct message_header_line *hdr)
+static bool parse_date(struct mbox_md5_context *ctx,
+		       struct message_header_line *hdr)
 {
 	if (!ctx->seen_received_hdr) {
 		/* Received-header contains date too, and more trusted one */
@@ -28,15 +28,15 @@
 	return TRUE;
 }
 
-static int parse_delivered_to(struct mbox_md5_context *ctx,
-			      struct message_header_line *hdr)
+static bool parse_delivered_to(struct mbox_md5_context *ctx,
+			       struct message_header_line *hdr)
 {
 	md5_update(&ctx->hdr_md5_ctx, hdr->value, hdr->value_len);
 	return TRUE;
 }
 
-static int parse_message_id(struct mbox_md5_context *ctx,
-			    struct message_header_line *hdr)
+static bool parse_message_id(struct mbox_md5_context *ctx,
+			     struct message_header_line *hdr)
 {
 	if (!ctx->seen_received_hdr) {
 		/* Received-header contains unique ID too,
@@ -46,8 +46,8 @@
 	return TRUE;
 }
 
-static int parse_received(struct mbox_md5_context *ctx,
-			  struct message_header_line *hdr)
+static bool parse_received(struct mbox_md5_context *ctx,
+			   struct message_header_line *hdr)
 {
 	if (!ctx->seen_received_hdr) {
 		/* get only the first received-header */
@@ -58,8 +58,8 @@
 	return TRUE;
 }
 
-static int parse_x_delivery_id(struct mbox_md5_context *ctx,
-			       struct message_header_line *hdr)
+static bool parse_x_delivery_id(struct mbox_md5_context *ctx,
+				struct message_header_line *hdr)
 {
 	/* Let the local delivery agent help generate unique ID's but don't
 	   blindly trust this header alone as it could just as easily come from
--- a/src/lib-storage/index/mbox/mbox-save.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-save.c	Fri Jan 13 22:25:57 2006 +0200
@@ -263,7 +263,7 @@
 
 static int
 mbox_save_init_file(struct mbox_save_context *ctx,
-		    struct mbox_transaction_context *t, int want_mail)
+		    struct mbox_transaction_context *t, bool want_mail)
 {
 	struct mbox_mailbox *mbox = ctx->mbox;
 	int ret;
@@ -322,7 +322,7 @@
 }
 
 static void save_header_callback(struct message_header_line *hdr,
-				 int *matched, void *context)
+				 bool *matched, void *context)
 {
 	struct mbox_save_context *ctx = context;
 
@@ -343,7 +343,7 @@
 mbox_save_init(struct mailbox_transaction_context *_t,
 	       enum mail_flags flags, struct mail_keywords *keywords,
 	       time_t received_date, int timezone_offset __attr_unused__,
-	       const char *from_envelope, struct istream *input, int want_mail)
+	       const char *from_envelope, struct istream *input, bool want_mail)
 {
 	struct mbox_transaction_context *t =
 		(struct mbox_transaction_context *)_t;
--- a/src/lib-storage/index/mbox/mbox-storage.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Fri Jan 13 22:25:57 2006 +0200
@@ -50,7 +50,7 @@
 	return -1;
 }
 
-static int mbox_handle_errors(struct index_storage *istorage)
+static bool mbox_handle_errors(struct index_storage *istorage)
 {
 	struct mail_storage *storage = &istorage->storage;
 
@@ -65,7 +65,7 @@
 	return TRUE;
 }
 
-static int mbox_is_file(const char *path, const char *name, int debug)
+static bool mbox_is_file(const char *path, const char *name, bool debug)
 {
 	struct stat st;
 
@@ -96,7 +96,7 @@
 	return TRUE;
 }
 
-static int mbox_is_dir(const char *path, const char *name, int debug)
+static bool mbox_is_dir(const char *path, const char *name, bool debug)
 {
 	struct stat st;
 
@@ -127,9 +127,9 @@
 	return TRUE;
 }
 
-static int mbox_autodetect(const char *data, enum mail_storage_flags flags)
+static bool mbox_autodetect(const char *data, enum mail_storage_flags flags)
 {
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 	const char *path;
 
 	path = t_strcut(data, ':');
@@ -159,7 +159,7 @@
 static const char *get_root_dir(enum mail_storage_flags flags)
 {
 	const char *home, *path;
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 
 	home = getenv("HOME");
 	if (home != NULL) {
@@ -194,7 +194,7 @@
 }
 
 static const char *
-get_inbox_file(const char *root_dir, int only_root, int debug)
+get_inbox_file(const char *root_dir, bool only_root, bool debug)
 {
 	const char *user, *path;
 
@@ -224,7 +224,7 @@
 	return path;
 }
 
-static const char *create_root_dir(int debug)
+static const char *create_root_dir(bool debug)
 {
 	const char *home, *path;
 
@@ -250,12 +250,12 @@
 mbox_create(const char *data, const char *user, enum mail_storage_flags flags,
 	    enum mail_storage_lock_method lock_method)
 {
-	int debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
+	bool debug = (flags & MAIL_STORAGE_FLAG_DEBUG) != 0;
 	struct mbox_storage *storage;
 	struct index_storage *istorage;
 	const char *root_dir, *inbox_file, *index_dir, *p;
 	struct stat st;
-	int autodetect;
+	bool autodetect;
 	pool_t pool;
 
 	root_dir = inbox_file = index_dir = NULL;
@@ -354,10 +354,10 @@
 	pool_unref(storage->storage.pool);
 }
 
-int mbox_is_valid_mask(struct mail_storage *storage, const char *mask)
+bool mbox_is_valid_mask(struct mail_storage *storage, const char *mask)
 {
 	const char *p;
-	int newdir;
+	bool newdir;
 
 	if ((storage->flags & MAIL_STORAGE_FLAG_FULL_FS_ACCESS) != 0)
 		return TRUE;
@@ -377,8 +377,8 @@
 	return TRUE;
 }
 
-static int mbox_is_valid_create_name(struct mail_storage *storage,
-				     const char *name)
+static bool mbox_is_valid_create_name(struct mail_storage *storage,
+				      const char *name)
 {
 	size_t len;
 
@@ -390,8 +390,8 @@
 	return mbox_is_valid_mask(storage, name);
 }
 
-static int mbox_is_valid_existing_name(struct mail_storage *storage,
-				       const char *name)
+static bool mbox_is_valid_existing_name(struct mail_storage *storage,
+					const char *name)
 {
 	size_t len;
 
@@ -473,8 +473,8 @@
 	return t_strconcat(storage->dir, "/", name, NULL);
 }
 
-static int mbox_mail_is_recent(struct index_mailbox *ibox __attr_unused__,
-			       uint32_t uid __attr_unused__)
+static bool mbox_mail_is_recent(struct index_mailbox *ibox __attr_unused__,
+				uint32_t uid __attr_unused__)
 {
 	return FALSE;
 }
@@ -651,7 +651,7 @@
 }
 
 static int mbox_mailbox_create(struct mail_storage *_storage, const char *name,
-			       int directory)
+			       bool directory)
 {
 	struct index_storage *storage = (struct index_storage *)_storage;
 	const char *path, *p;
@@ -907,7 +907,7 @@
 }
 
 static int mbox_set_subscribed(struct mail_storage *_storage,
-			       const char *name, int set)
+			       const char *name, bool set)
 {
 	struct index_storage *storage = (struct index_storage *)_storage;
 	const char *path;
--- a/src/lib-storage/index/mbox/mbox-storage.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-storage.h	Fri Jan 13 22:25:57 2006 +0200
@@ -34,7 +34,7 @@
 	unsigned int mbox_excl_locks, mbox_shared_locks;
 	struct dotlock *mbox_dotlock;
 	unsigned int mbox_lock_id;
-	int mbox_readonly, mbox_writeonly;
+	bool mbox_readonly, mbox_writeonly;
 	time_t mbox_dirty_stamp;
 	off_t mbox_dirty_size;
 
@@ -83,7 +83,8 @@
 mbox_save_init(struct mailbox_transaction_context *_t,
 	       enum mail_flags flags, struct mail_keywords *keywords,
 	       time_t received_date, int timezone_offset,
-	       const char *from_envelope, struct istream *input, int want_mail);
+	       const char *from_envelope, struct istream *input,
+	       bool want_mail);
 int mbox_save_continue(struct mail_save_context *ctx);
 int mbox_save_finish(struct mail_save_context *ctx, struct mail *dest_mail);
 void mbox_save_cancel(struct mail_save_context *ctx);
@@ -91,6 +92,6 @@
 int mbox_transaction_save_commit(struct mbox_save_context *ctx);
 void mbox_transaction_save_rollback(struct mbox_save_context *ctx);
 
-int mbox_is_valid_mask(struct mail_storage *storage, const char *mask);
+bool mbox_is_valid_mask(struct mail_storage *storage, const char *mask);
 
 #endif
--- a/src/lib-storage/index/mbox/mbox-sync-parse.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync-parse.c	Fri Jan 13 22:25:57 2006 +0200
@@ -22,8 +22,8 @@
 
 struct mbox_sync_header_func {
 	const char *header;
-	int (*func)(struct mbox_sync_mail_context *ctx,
-		    struct message_header_line *hdr);
+	bool (*func)(struct mbox_sync_mail_context *ctx,
+		     struct message_header_line *hdr);
 };
 
 struct mbox_flag_type mbox_status_flags[] = {
@@ -93,23 +93,23 @@
 	ctx->mail.flags ^= MBOX_NONRECENT_KLUDGE;
 }
 
-static int parse_status(struct mbox_sync_mail_context *ctx,
-			struct message_header_line *hdr)
+static bool parse_status(struct mbox_sync_mail_context *ctx,
+			 struct message_header_line *hdr)
 {
 	parse_status_flags(ctx, hdr, mbox_status_flags);
 	ctx->hdr_pos[MBOX_HDR_STATUS] = str_len(ctx->header);
 	return TRUE;
 }
 
-static int parse_x_status(struct mbox_sync_mail_context *ctx,
-			  struct message_header_line *hdr)
+static bool parse_x_status(struct mbox_sync_mail_context *ctx,
+			   struct message_header_line *hdr)
 {
 	parse_status_flags(ctx, hdr, mbox_xstatus_flags);
 	ctx->hdr_pos[MBOX_HDR_X_STATUS] = str_len(ctx->header);
 	return TRUE;
 }
 
-static int keyword_is_valid(const char *keyword)
+static bool keyword_is_valid(const char *keyword)
 {
 	/* try to only prevent the most malicious looking keywords. */
 	for (; *keyword != '\0'; keyword++) {
@@ -165,8 +165,8 @@
 	}
 }
 
-static int parse_x_imap_base(struct mbox_sync_mail_context *ctx,
-			     struct message_header_line *hdr)
+static bool parse_x_imap_base(struct mbox_sync_mail_context *ctx,
+			      struct message_header_line *hdr)
 {
 	size_t i, j, uid_last_pos;
 	uint32_t uid_validity, uid_last;
@@ -239,8 +239,8 @@
 	return TRUE;
 }
 
-static int parse_x_imap(struct mbox_sync_mail_context *ctx,
-			struct message_header_line *hdr)
+static bool parse_x_imap(struct mbox_sync_mail_context *ctx,
+			 struct message_header_line *hdr)
 {
 	if (!parse_x_imap_base(ctx, hdr))
 		return FALSE;
@@ -251,8 +251,8 @@
 	return TRUE;
 }
 
-static int parse_x_keywords(struct mbox_sync_mail_context *ctx,
-			    struct message_header_line *hdr)
+static bool parse_x_keywords(struct mbox_sync_mail_context *ctx,
+			     struct message_header_line *hdr)
 {
 	array_t ARRAY_DEFINE(keyword_list, unsigned int);
 	const unsigned int *list;
@@ -321,8 +321,8 @@
 	return TRUE;
 }
 
-static int parse_x_uid(struct mbox_sync_mail_context *ctx,
-		       struct message_header_line *hdr)
+static bool parse_x_uid(struct mbox_sync_mail_context *ctx,
+			struct message_header_line *hdr)
 {
 	uint32_t value = 0;
 	size_t i;
@@ -395,8 +395,8 @@
 	return TRUE;
 }
 
-static int parse_content_length(struct mbox_sync_mail_context *ctx,
-				struct message_header_line *hdr)
+static bool parse_content_length(struct mbox_sync_mail_context *ctx,
+				 struct message_header_line *hdr)
 {
 	uoff_t value = 0;
 	size_t i;
--- a/src/lib-storage/index/mbox/mbox-sync-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -128,7 +128,7 @@
 };
 
 int mbox_sync(struct mbox_mailbox *mbox, enum mbox_sync_flags flags);
-int mbox_sync_has_changed(struct mbox_mailbox *mbox, int leave_dirty);
+int mbox_sync_has_changed(struct mbox_mailbox *mbox, bool leave_dirty);
 
 void mbox_sync_parse_next_mail(struct istream *input,
 			       struct mbox_sync_mail_context *ctx);
@@ -146,7 +146,7 @@
 
 void mbox_sync_apply_index_syncs(struct mbox_sync_context *sync_ctx,
 				 struct mbox_sync_mail *mail,
-				 int *keywords_changed_r);
+				 bool *keywords_changed_r);
 int mbox_sync_seek(struct mbox_sync_context *sync_ctx, uoff_t from_offset);
 int mbox_move(struct mbox_sync_context *sync_ctx,
 	      uoff_t dest, uoff_t source, uoff_t size);
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Jan 13 22:25:57 2006 +0200
@@ -366,7 +366,7 @@
 				   struct mbox_sync_mail *mails,
 				   uint32_t seq, uint32_t idx, uint32_t padding,
 				   off_t move_diff, uoff_t expunged_space,
-				   uoff_t end_offset, int first_nonexpunged)
+				   uoff_t end_offset, bool first_nonexpunged)
 {
 	struct mbox_sync_mail_context new_mail_ctx;
 	uoff_t offset, dest_offset;
@@ -495,7 +495,7 @@
 			/* give space to this mail. end_offset is left to
 			   contain this message's From-line (ie. below we
 			   move only headers + body). */
-			int first_nonexpunged = idx == first_nonexpunged_idx;
+			bool first_nonexpunged = idx == first_nonexpunged_idx;
 
 			next_move_diff = -mails[idx].space;
 			if (mbox_sync_read_and_move(sync_ctx, mail_ctx, mails,
--- a/src/lib-storage/index/mbox/mbox-sync-update.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync-update.c	Fri Jan 13 22:25:57 2006 +0200
@@ -377,7 +377,7 @@
 void mbox_sync_update_header(struct mbox_sync_mail_context *ctx)
 {
 	uint8_t old_flags;
-	int keywords_changed;
+	bool keywords_changed;
 
 	i_assert(ctx->mail.uid != 0 || ctx->pseudo);
 
--- a/src/lib-storage/index/mbox/mbox-sync.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Fri Jan 13 22:25:57 2006 +0200
@@ -134,7 +134,7 @@
 	return 1;
 }
 
-static int mbox_sync_buf_have_expunges(array_t *syncs_arr)
+static bool mbox_sync_buf_have_expunges(array_t *syncs_arr)
 {
 	ARRAY_SET_TYPE(syncs_arr, struct mail_index_sync_rec);
 	const struct mail_index_sync_rec *syncs;
@@ -149,7 +149,7 @@
 }
 
 static int mbox_sync_read_index_syncs(struct mbox_sync_context *sync_ctx,
-				      uint32_t uid, int *sync_expunge_r)
+				      uint32_t uid, bool *sync_expunge_r)
 {
 	struct mail_index_sync_rec *sync_rec = &sync_ctx->sync_rec;
 	int ret;
@@ -231,7 +231,7 @@
 
 void mbox_sync_apply_index_syncs(struct mbox_sync_context *sync_ctx,
 				 struct mbox_sync_mail *mail,
-				 int *keywords_changed_r)
+				 bool *keywords_changed_r)
 {
 	const struct mail_index_sync_rec *syncs;
 	unsigned int i, count;
@@ -363,7 +363,7 @@
 static int
 mbox_sync_update_from_offset(struct mbox_sync_context *sync_ctx,
                              struct mbox_sync_mail *mail,
-			     int nocheck)
+			     bool nocheck)
 {
 	const void *data;
 	uint64_t offset;
@@ -457,7 +457,7 @@
 		   sync records are automatically applied to rec->flags at the
 		   end of index syncing, so calculate those new flags first */
 		struct mbox_sync_mail idx_mail;
-		int keywords_changed;
+		bool keywords_changed;
 
 		memset(&idx_mail, 0, sizeof(idx_mail));
 		idx_mail.flags = rec->flags;
@@ -507,8 +507,8 @@
 			if (((idx_mail.flags ^ mbox_flags) &
 			     MAIL_INDEX_MAIL_FLAG_DIRTY) != 0) {
 				/* dirty flag state changed */
-				int dirty = (mbox_flags &
-					     MAIL_INDEX_MAIL_FLAG_DIRTY) != 0;
+				bool dirty = (mbox_flags &
+					      MAIL_INDEX_MAIL_FLAG_DIRTY) != 0;
 				mail_index_update_flags(sync_ctx->t,
 					sync_ctx->idx_seq,
 					dirty ? MODIFY_ADD : MODIFY_REMOVE,
@@ -539,7 +539,7 @@
 	/* update from_offsets, but not if we're going to rewrite this message.
 	   rewriting would just move it anyway. */
 	if (sync_ctx->need_space_seq == 0) {
-		int nocheck = rec == NULL || sync_ctx->expunged_space > 0;
+		bool nocheck = rec == NULL || sync_ctx->expunged_space > 0;
 		if (mbox_sync_update_from_offset(sync_ctx, mail, nocheck) < 0)
 			return -1;
 	}
@@ -849,7 +849,8 @@
 	struct mbox_mailbox *mbox = sync_ctx->mbox;
 	uoff_t old_offset;
 	uint32_t uid;
-	int ret, deleted;
+	int ret;
+        bool deleted;
 
 	if (seq == 0) {
 		if (istream_raw_mbox_seek(mbox->mbox_stream, 0) < 0) {
@@ -941,8 +942,8 @@
 }
 
 static int mbox_sync_partial_seek_next(struct mbox_sync_context *sync_ctx,
-				       uint32_t next_uid, int *partial,
-				       int *skipped_mails)
+				       uint32_t next_uid, bool *partial,
+				       bool *skipped_mails)
 {
 	uint32_t messages_count;
 	int ret;
@@ -988,12 +989,13 @@
 
 static int mbox_sync_loop(struct mbox_sync_context *sync_ctx,
                           struct mbox_sync_mail_context *mail_ctx,
-			  int partial)
+			  bool partial)
 {
 	const struct mail_index_record *rec;
 	uint32_t uid, messages_count;
 	uoff_t offset;
-	int ret, expunged, skipped_mails;
+	int ret;
+	bool expunged, skipped_mails;
 
 	messages_count =
 		mail_index_view_get_messages_count(sync_ctx->sync_view);
@@ -1483,7 +1485,7 @@
 	return 0;
 }
 
-int mbox_sync_has_changed(struct mbox_mailbox *mbox, int leave_dirty)
+int mbox_sync_has_changed(struct mbox_mailbox *mbox, bool leave_dirty)
 {
 	const struct mail_index_header *hdr;
 	const struct stat *st;
@@ -1541,7 +1543,8 @@
 	uint32_t seq;
 	uoff_t offset;
 	unsigned int lock_id = 0;
-	int ret, changed, delay_writes;
+	int ret;
+	bool changed, delay_writes;
 
 	delay_writes = mbox->ibox.readonly ||
 		((flags & MBOX_SYNC_REWRITE) == 0 &&
@@ -1561,7 +1564,7 @@
 	    (flags & MBOX_SYNC_FORCE_SYNC) != 0)
 		changed = 1;
 	else {
-		int leave_dirty = (flags & MBOX_SYNC_UNDIRTY) == 0;
+		bool leave_dirty = (flags & MBOX_SYNC_UNDIRTY) == 0;
 		if ((changed = mbox_sync_has_changed(mbox, leave_dirty)) < 0) {
 			if ((flags & MBOX_SYNC_LOCK_READING) != 0)
 				(void)mbox_unlock(mbox, lock_id);
@@ -1655,7 +1658,7 @@
 	if (!changed && delay_writes) {
 		/* if we have only flag changes, we don't need to open the
 		   mbox file */
-		int expunged;
+		bool expunged;
 
 		if (mbox_sync_read_index_syncs(&sync_ctx, 1, &expunged) < 0)
 			return -1;
--- a/src/lib-storage/index/mbox/mbox-transaction.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/index/mbox/mbox-transaction.c	Fri Jan 13 22:25:57 2006 +0200
@@ -24,7 +24,8 @@
 		(struct mbox_transaction_context *)_t;
 	struct mbox_mailbox *mbox = (struct mbox_mailbox *)t->ictx.ibox;
 	unsigned int lock_id = t->mbox_lock_id;
-	int mbox_modified, ret = 0;
+	bool mbox_modified;
+	int ret = 0;
 
 	if (t->save_ctx != NULL)
 		ret = mbox_transaction_save_commit(t->save_ctx);
--- a/src/lib-storage/mail-search.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mail-search.c	Fri Jan 13 22:25:57 2006 +0200
@@ -4,7 +4,7 @@
 #include "buffer.h"
 #include "mail-search.h"
 
-void mail_search_args_reset(struct mail_search_arg *args, int full_reset)
+void mail_search_args_reset(struct mail_search_arg *args, bool full_reset)
 {
 	while (args != NULL) {
 		if (args->type == SEARCH_OR || args->type == SEARCH_SUB)
@@ -106,7 +106,7 @@
 
 static void
 search_arg_analyze(struct mail_search_arg *arg, buffer_t *headers,
-		   int *have_body, int *have_text)
+		   bool *have_body, bool *have_text)
 {
 	static const char *date_hdr = "Date";
 	struct mail_search_arg *subarg;
@@ -151,11 +151,11 @@
 
 const char *const *
 mail_search_args_analyze(struct mail_search_arg *args,
-			 int *have_headers, int *have_body)
+			 bool *have_headers, bool *have_body)
 {
 	const char *null = NULL;
 	buffer_t *headers;
-	int have_text;
+	bool have_text;
 
 	*have_headers = *have_body = have_text = FALSE;
 
--- a/src/lib-storage/mail-search.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mail-search.h	Fri Jan 13 22:25:57 2006 +0200
@@ -73,7 +73,7 @@
 
 /* Reset the results in search arguments. match_always is reset only if
    full_reset is TRUE. */
-void mail_search_args_reset(struct mail_search_arg *args, int full_reset);
+void mail_search_args_reset(struct mail_search_arg *args, bool full_reset);
 
 /* goes through arguments in list that don't have a result yet.
    Returns 1 = search matched, 0 = search unmatched, -1 = don't know yet */
@@ -86,6 +86,6 @@
    NULL if we're searching for TEXT. */
 const char *const *
 mail_search_args_analyze(struct mail_search_arg *args,
-			 int *have_headers, int *have_body);
+			 bool *have_headers, bool *have_body);
 
 #endif
--- a/src/lib-storage/mail-storage-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mail-storage-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -14,7 +14,7 @@
 			  enum mail_storage_lock_method lock_method);
 	void (*destroy)(struct mail_storage *storage);
 
-	int (*autodetect)(const char *data, enum mail_storage_flags flags);
+	bool (*autodetect)(const char *data, enum mail_storage_flags flags);
 
 	void (*set_callbacks)(struct mail_storage *storage,
 			      struct mail_storage_callbacks *callbacks,
@@ -26,7 +26,7 @@
 					enum mailbox_open_flags flags);
 
 	int (*mailbox_create)(struct mail_storage *storage, const char *name,
-			      int directory);
+			      bool directory);
 	int (*mailbox_delete)(struct mail_storage *storage, const char *name);
 	int (*mailbox_rename)(struct mail_storage *storage, const char *oldname,
 			      const char *newname);
@@ -40,15 +40,15 @@
 	int (*mailbox_list_deinit)(struct mailbox_list_context *ctx);
 
 	int (*set_subscribed)(struct mail_storage *storage,
-			      const char *name, int set);
+			      const char *name, bool set);
 
 	int (*get_mailbox_name_status)(struct mail_storage *storage,
 				       const char *name,
 				       enum mailbox_name_status *status);
 
 	const char *(*get_last_error)(struct mail_storage *storage,
-				      int *syntax_error_r,
-				      int *temporary_error_r);
+				      bool *syntax_error_r,
+				      bool *temporary_error_r);
 };
 
 struct mail_storage {
@@ -75,8 +75,8 @@
 };
 
 struct mailbox_vfuncs {
-	int (*is_readonly)(struct mailbox *box);
-	int (*allow_new_keywords)(struct mailbox *box);
+	bool (*is_readonly)(struct mailbox *box);
+	bool (*allow_new_keywords)(struct mailbox *box);
 
 	int (*close)(struct mailbox *box);
 
@@ -136,7 +136,7 @@
 			     struct mail_keywords *keywords,
 			     time_t received_date, int timezone_offset,
 			     const char *from_envelope, struct istream *input,
-			     int want_mail);
+			     bool want_mail);
 	int (*save_continue)(struct mail_save_context *ctx);
 	int (*save_finish)(struct mail_save_context *ctx,
 			   struct mail *dest_mail);
@@ -146,7 +146,7 @@
 		    enum mail_flags flags, struct mail_keywords *keywords,
 		    struct mail *dest_mail);
 
-	int (*is_inconsistent)(struct mailbox *box);
+	bool (*is_inconsistent)(struct mailbox *box);
 };
 
 struct mailbox {
@@ -239,6 +239,6 @@
 void mail_storage_set_internal_error(struct mail_storage *storage);
 
 const char *mail_storage_class_get_last_error(struct mail_storage *storage,
-					      int *syntax_error_r);
+					      bool *syntax_error_r);
 
 #endif
--- a/src/lib-storage/mail-storage.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mail-storage.c	Fri Jan 13 22:25:57 2006 +0200
@@ -235,7 +235,7 @@
 }
 
 int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
-				int directory)
+				bool directory)
 {
 	return storage->v.mailbox_create(storage, name, directory);
 }
@@ -271,7 +271,7 @@
 }
 
 int mail_storage_set_subscribed(struct mail_storage *storage,
-				const char *name, int set)
+				const char *name, bool set)
 {
 	return storage->v.set_subscribed(storage, name, set);
 }
@@ -284,8 +284,8 @@
 }
 
 const char *mail_storage_get_last_error(struct mail_storage *storage,
-					int *syntax_error_r,
-					int *temporary_error_r)
+					bool *syntax_error_r,
+					bool *temporary_error_r)
 {
 	return storage->v.get_last_error(storage, syntax_error_r,
 					 temporary_error_r);
@@ -313,12 +313,12 @@
 	return box->name;
 }
 
-int mailbox_is_readonly(struct mailbox *box)
+bool mailbox_is_readonly(struct mailbox *box)
 {
 	return box->v.is_readonly(box);
 }
 
-int mailbox_allow_new_keywords(struct mailbox *box)
+bool mailbox_allow_new_keywords(struct mailbox *box)
 {
 	return box->v.allow_new_keywords(box);
 }
@@ -431,7 +431,7 @@
 		  enum mail_flags flags, struct mail_keywords *keywords,
 		  time_t received_date, int timezone_offset,
 		  const char *from_envelope, struct istream *input,
-		  int want_mail)
+		  bool want_mail)
 {
 	return t->box->v.save_init(t, flags, keywords,
 				   received_date, timezone_offset,
@@ -460,7 +460,7 @@
 	return t->box->v.copy(t, mail, flags, keywords, dest_mail);
 }
 
-int mailbox_is_inconsistent(struct mailbox *box)
+bool mailbox_is_inconsistent(struct mailbox *box)
 {
 	return box->v.is_inconsistent(box);
 }
--- a/src/lib-storage/mail-storage.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mail-storage.h	Fri Jan 13 22:25:57 2006 +0200
@@ -245,7 +245,7 @@
    can contain children. The mailbox itself doesn't have to be
    created as long as it shows in LIST. */
 int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
-				int directory);
+				bool directory);
 /* Only the specified mailbox is deleted, ie. folders under the
    specified mailbox must not be deleted. */
 int mail_storage_mailbox_delete(struct mail_storage *storage, const char *name);
@@ -277,7 +277,7 @@
    subscribing to already subscribed mailbox. Subscribing to
    unexisting mailboxes is optional. */
 int mail_storage_set_subscribed(struct mail_storage *storage,
-				const char *name, int set);
+				const char *name, bool set);
 
 /* Returns mailbox name status */
 int mail_storage_get_mailbox_name_status(struct mail_storage *storage,
@@ -286,8 +286,8 @@
 
 /* Returns the error message of last occurred error. */
 const char *mail_storage_get_last_error(struct mail_storage *storage,
-					int *syntax_error_r,
-					int *temporary_error_r);
+					bool *syntax_error_r,
+					bool *temporary_error_r);
 
 /* Open a mailbox. If input stream is given, mailbox is opened read-only
    using it as a backend. If storage doesn't support stream backends and its
@@ -298,7 +298,7 @@
 struct mailbox *mailbox_open(struct mail_storage *storage, const char *name,
 			     struct istream *input,
 			     enum mailbox_open_flags flags);
-/* Close the box. Returns FALSE if some cleanup errors occurred, but
+/* Close the box. Returns -1 if some cleanup errors occurred, but
    the mailbox was closed anyway. */
 int mailbox_close(struct mailbox *box);
 
@@ -309,10 +309,10 @@
 const char *mailbox_get_name(struct mailbox *box);
 
 /* Returns TRUE if mailbox is read-only. */
-int mailbox_is_readonly(struct mailbox *box);
+bool mailbox_is_readonly(struct mailbox *box);
 
 /* Returns TRUE if mailbox currently supports adding keywords. */
-int mailbox_allow_new_keywords(struct mailbox *box);
+bool mailbox_allow_new_keywords(struct mailbox *box);
 
 /* Gets the mailbox status information. */
 int mailbox_get_status(struct mailbox *box, enum mailbox_status_items items,
@@ -386,7 +386,7 @@
 		  enum mail_flags flags, struct mail_keywords *keywords,
 		  time_t received_date, int timezone_offset,
 		  const char *from_envelope, struct istream *input,
-		  int want_mail);
+		  bool want_mail);
 int mailbox_save_continue(struct mail_save_context *ctx);
 int mailbox_save_finish(struct mail_save_context *ctx, struct mail *dest_mail);
 void mailbox_save_cancel(struct mail_save_context *ctx);
@@ -403,7 +403,7 @@
    would be to fully close the mailbox and reopen it. With IMAP
    connection this would mean a forced disconnection since we can't
    do forced CLOSE. */
-int mailbox_is_inconsistent(struct mailbox *box);
+bool mailbox_is_inconsistent(struct mailbox *box);
 
 /* Returns message's flags */
 enum mail_flags mail_get_flags(struct mail *mail);
--- a/src/lib-storage/mailbox-tree.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mailbox-tree.c	Fri Jan 13 22:25:57 2006 +0200
@@ -30,7 +30,7 @@
 
 static struct mailbox_node *
 mailbox_tree_traverse(struct mailbox_tree_context *ctx, const char *path,
-		      int create, int *created)
+		      bool create, bool *created)
 {
 	struct mailbox_node **node;
 	const char *name;
@@ -96,7 +96,7 @@
 
 struct mailbox_node *
 mailbox_tree_get(struct mailbox_tree_context *ctx, const char *path,
-		 int *created)
+		 bool *created)
 {
 	return mailbox_tree_traverse(ctx, path, TRUE, created);
 }
--- a/src/lib-storage/mailbox-tree.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/mailbox-tree.h	Fri Jan 13 22:25:57 2006 +0200
@@ -16,7 +16,7 @@
 
 struct mailbox_node *
 mailbox_tree_get(struct mailbox_tree_context *ctx, const char *path,
-		 int *created);
+		 bool *created);
 
 struct mailbox_node *
 mailbox_tree_update(struct mailbox_tree_context *ctx, const char *path);
--- a/src/lib-storage/subscription-file/subscription-file.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/subscription-file/subscription-file.c	Fri Jan 13 22:25:57 2006 +0200
@@ -23,7 +23,7 @@
 	struct istream *input;
 	const char *path;
 
-	int failed;
+	bool failed;
 };
 
 static void subsfile_set_syscall_error(struct mail_storage *storage,
@@ -41,7 +41,7 @@
 }
 
 static const char *next_line(struct mail_storage *storage, const char *path,
-			     struct istream *input, int *failed)
+			     struct istream *input, bool *failed)
 {
 	const char *line;
 
@@ -68,14 +68,15 @@
 }
 
 int subsfile_set_subscribed(struct mail_storage *storage, const char *path,
-			    const char *temp_prefix, const char *name, int set)
+			    const char *temp_prefix, const char *name, bool set)
 {
 	struct dotlock_settings dotlock_set;
 	struct dotlock *dotlock;
 	const char *line;
 	struct istream *input;
 	struct ostream *output;
-	int fd_in, fd_out, found, failed = FALSE;
+	int fd_in, fd_out;
+	bool found, failed = FALSE;
 
 	if (strcasecmp(name, "INBOX") == 0)
 		name = "INBOX";
@@ -185,7 +186,7 @@
 
 int subsfile_list_deinit(struct subsfile_list_context *ctx)
 {
-	int failed;
+	bool failed;
 
 	failed = ctx->failed;
 	if (ctx->input != NULL)
--- a/src/lib-storage/subscription-file/subscription-file.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib-storage/subscription-file/subscription-file.h	Fri Jan 13 22:25:57 2006 +0200
@@ -7,13 +7,14 @@
 struct subsfile_list_context *
 subsfile_list_init(struct mail_storage *storage, const char *path);
 
-/* Deinitialize subscription file listing. Returns FALSE if some error occurred
-   while listing. */
+/* Deinitialize subscription file listing. Returns 0 if ok, or -1 if some
+   error occurred while listing. */
 int subsfile_list_deinit(struct subsfile_list_context *ctx);
 /* Returns the next subscribed mailbox, or NULL. */
 const char *subsfile_list_next(struct subsfile_list_context *ctx);
 
 int subsfile_set_subscribed(struct mail_storage *storage, const char *path,
-			    const char *temp_prefix, const char *name, int set);
+			    const char *temp_prefix, const char *name,
+			    bool set);
 
 #endif
--- a/src/lib/array.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/array.h	Fri Jan 13 22:25:57 2006 +0200
@@ -81,7 +81,7 @@
 	array->buffer = NULL;
 }
 
-static inline int
+static inline bool
 array_is_created(const array_t *array)
 {
 	return array->buffer != NULL;
@@ -262,7 +262,7 @@
 	return array->buffer->used / array->element_size;
 }
 
-static inline int
+static inline bool
 array_cmp(const array_t *array1, const array_t *array2)
 {
 	if (!array_is_created(array1) || array1->buffer->used == 0)
--- a/src/lib/buffer.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/buffer.c	Fri Jan 13 22:25:57 2006 +0200
@@ -290,7 +290,7 @@
 	return buf->alloc;
 }
 
-int buffer_cmp(const buffer_t *buf1, const buffer_t *buf2)
+bool buffer_cmp(const buffer_t *buf1, const buffer_t *buf2)
 {
 	if (buf1->used != buf2->used)
 		return FALSE;
--- a/src/lib/buffer.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/buffer.h	Fri Jan 13 22:25:57 2006 +0200
@@ -85,7 +85,7 @@
 size_t buffer_get_size(const buffer_t *buf);
 
 /* Returns TRUE if buffer contents are identical. */
-int buffer_cmp(const buffer_t *buf1, const buffer_t *buf2);
+bool buffer_cmp(const buffer_t *buf1, const buffer_t *buf2);
 
 /* Returns pointer to beginning of buffer data. Current used size of buffer is
    stored in used_size if it's non-NULL. */
--- a/src/lib/compat.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/compat.h	Fri Jan 13 22:25:57 2006 +0200
@@ -11,6 +11,14 @@
 #  define LLONG_MAX 9223372036854775807LL
 #endif
 
+#ifndef __cplusplus
+#ifdef HAVE__BOOL
+typedef _Bool bool;
+#else
+typedef int bool;
+#endif
+#endif
+
 #if defined (UOFF_T_INT)
 typedef unsigned int uoff_t;
 #elif defined (UOFF_T_LONG)
--- a/src/lib/data-stack.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/data-stack.c	Fri Jan 13 22:25:57 2006 +0200
@@ -202,12 +202,12 @@
 	return block;
 }
 
-static void *t_malloc_real(size_t size, int permanent)
+static void *t_malloc_real(size_t size, bool permanent)
 {
 	struct stack_block *block;
         void *ret;
 #ifdef DEBUG
-	int warn = FALSE;
+	bool warn = FALSE;
 #endif
 
 	if (size == 0 || size > SSIZE_T_MAX)
@@ -284,7 +284,7 @@
         return mem;
 }
 
-int t_try_realloc(void *mem, size_t size)
+bool t_try_realloc(void *mem, size_t size)
 {
 	size_t last_alloc_size;
 
@@ -489,7 +489,7 @@
 	return mem;
 }
 
-int t_try_realloc(void *mem __attr_unused__, size_t size __attr_unused__)
+bool t_try_realloc(void *mem __attr_unused__, size_t size __attr_unused__)
 {
 	return FALSE;
 }
--- a/src/lib/data-stack.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/data-stack.h	Fri Jan 13 22:25:57 2006 +0200
@@ -58,7 +58,7 @@
 
 /* Try growing allocated memory. Returns TRUE if successful. Works only
    for last allocated memory in current stack frame. */
-int t_try_realloc(void *mem, size_t size);
+bool t_try_realloc(void *mem, size_t size);
 
 /* Returns the number of bytes available in data stack without allocating
    more memory. */
--- a/src/lib/fd-close-on-exec.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/fd-close-on-exec.c	Fri Jan 13 22:25:57 2006 +0200
@@ -9,7 +9,7 @@
 #include <sys/stat.h>
 #include <sys/un.h>
 
-void fd_close_on_exec(int fd, int set)
+void fd_close_on_exec(int fd, bool set)
 {
 	int flags;
 
--- a/src/lib/fd-close-on-exec.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/fd-close-on-exec.h	Fri Jan 13 22:25:57 2006 +0200
@@ -2,7 +2,7 @@
 #define __FD_CLOSE_ON_EXEC_H
 
 /* Change close-on-exec flag of fd. */
-void fd_close_on_exec(int fd, int set);
+void fd_close_on_exec(int fd, bool set);
 
 /* Verify that fds in given range don't exist. */
 void fd_debug_verify_leaks(int first_fd, int last_fd);
--- a/src/lib/fd-set-nonblock.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/fd-set-nonblock.c	Fri Jan 13 22:25:57 2006 +0200
@@ -5,7 +5,7 @@
 
 #include <fcntl.h>
 
-int fd_set_nonblock(int fd, int nonblock)
+int fd_set_nonblock(int fd, bool nonblock)
 {
 	int flags;
 
--- a/src/lib/fd-set-nonblock.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/fd-set-nonblock.h	Fri Jan 13 22:25:57 2006 +0200
@@ -2,6 +2,6 @@
 #define __FD_SET_NONBLOCK_H
 
 /* Set file descriptor to blocking/nonblocking state */
-int fd_set_nonblock(int fd, int nonblock);
+int fd_set_nonblock(int fd, bool nonblock);
 
 #endif
--- a/src/lib/file-dotlock.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/file-dotlock.c	Fri Jan 13 22:25:57 2006 +0200
@@ -46,7 +46,7 @@
 	time_t last_ctime, last_mtime;
 	time_t last_change;
 
-	int have_pid;
+	bool have_pid;
 	time_t last_pid_check;
 };
 
@@ -229,7 +229,7 @@
 }
 
 static int
-create_temp_file(const char *prefix, const char **path_r, int write_pid)
+create_temp_file(const char *prefix, const char **path_r, bool write_pid)
 {
 	string_t *path;
 	size_t len;
@@ -274,7 +274,7 @@
 	return fd;
 }
 
-static int try_create_lock_hardlink(struct lock_info *lock_info, int write_pid)
+static int try_create_lock_hardlink(struct lock_info *lock_info, bool write_pid)
 {
 	const char *temp_prefix = lock_info->set->temp_prefix;
 	const char *str, *p;
@@ -320,7 +320,7 @@
 	return 1;
 }
 
-static int try_create_lock_excl(struct lock_info *lock_info, int write_pid)
+static int try_create_lock_excl(struct lock_info *lock_info, bool write_pid)
 {
 	int fd;
 
@@ -345,7 +345,7 @@
 }
 
 static int dotlock_create(const char *path, struct dotlock *dotlock,
-			  enum dotlock_create_flags flags, int write_pid)
+			  enum dotlock_create_flags flags, bool write_pid)
 {
 	const struct dotlock_settings *set = &dotlock->settings;
 	const char *lock_path;
@@ -354,7 +354,8 @@
 	unsigned int stale_notify_threshold;
 	unsigned int change_secs, wait_left;
 	time_t now, max_wait_time, last_notify;
-	int do_wait, ret;
+	int ret;
+	bool do_wait;
 
 	now = time(NULL);
 
--- a/src/lib/file-dotlock.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/file-dotlock.h	Fri Jan 13 22:25:57 2006 +0200
@@ -26,7 +26,7 @@
 	/* Callback is called once in a while. stale is set to TRUE if stale
 	   lock is detected and will be overridden in secs_left. If callback
 	   returns FALSE then, the lock will not be overridden. */
-	int (*callback)(unsigned int secs_left, int stale, void *context);
+	bool (*callback)(unsigned int secs_left, bool stale, void *context);
 	void *context;
 
 	/* Rely on O_EXCL locking to work instead of using hardlinks.
--- a/src/lib/hash.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/hash.c	Fri Jan 13 22:25:57 2006 +0200
@@ -36,7 +36,7 @@
 	size_t pos;
 };
 
-static int hash_resize(struct hash_table *table, int grow);
+static bool hash_resize(struct hash_table *table, bool grow);
 
 static int direct_cmp(const void *p1, const void *p2)
 {
@@ -114,7 +114,7 @@
 	p_free(table->table_pool, table);
 }
 
-void hash_clear(struct hash_table *table, int free_nodes)
+void hash_clear(struct hash_table *table, bool free_nodes)
 {
 	if (!table->node_pool->alloconly_pool)
 		hash_destroy_nodes(table);
@@ -158,8 +158,8 @@
 	return node != NULL ? node->value : NULL;
 }
 
-int hash_lookup_full(const struct hash_table *table, const void *lookup_key,
-		     void **orig_key, void **value)
+bool hash_lookup_full(const struct hash_table *table, const void *lookup_key,
+		      void **orig_key, void **value)
 {
 	struct hash_node *node;
 
@@ -177,7 +177,7 @@
 
 static struct hash_node *
 hash_insert_node(struct hash_table *table, void *key, void *value,
-		 int check_existing)
+		 bool check_existing)
 {
 	struct hash_node *node, *prev;
 	unsigned int hash;
@@ -355,8 +355,8 @@
 	return node;
 }
 
-int hash_iterate(struct hash_iterate_context *ctx,
-		 void **key_r, void **value_r)
+bool hash_iterate(struct hash_iterate_context *ctx,
+		  void **key_r, void **value_r)
 {
 	struct hash_node *node;
 
@@ -398,7 +398,7 @@
 	}
 }
 
-static int hash_resize(struct hash_table *table, int grow)
+static bool hash_resize(struct hash_table *table, bool grow)
 {
 	struct hash_node *old_nodes, *node, *next;
 	size_t next_size, old_size, i;
--- a/src/lib/hash.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/hash.h	Fri Jan 13 22:25:57 2006 +0200
@@ -20,11 +20,11 @@
 /* Remove all nodes from hash table. If free_collisions is TRUE, the
    memory allocated from node_pool is freed, or discarded with
    alloconly pools. */
-void hash_clear(struct hash_table *table, int free_collisions);
+void hash_clear(struct hash_table *table, bool free_collisions);
 
 void *hash_lookup(const struct hash_table *table, const void *key);
-int hash_lookup_full(const struct hash_table *table, const void *lookup_key,
-		     void **orig_key, void **value);
+bool hash_lookup_full(const struct hash_table *table, const void *lookup_key,
+		      void **orig_key, void **value);
 
 /* Insert/update node in hash table. The difference is that hash_insert()
    replaces the key in table to given one, while hash_update() doesnt. */
@@ -38,8 +38,8 @@
    functions while iterating, but if you add any new nodes, they may or may
    not be called for in this iteration. */
 struct hash_iterate_context *hash_iterate_init(struct hash_table *table);
-int hash_iterate(struct hash_iterate_context *ctx,
-		 void **key_r, void **value_r);
+bool hash_iterate(struct hash_iterate_context *ctx,
+		  void **key_r, void **value_r);
 void hash_iterate_deinit(struct hash_iterate_context *ctx);
 
 /* Hash table isn't resized, and removed nodes aren't removed from
--- a/src/lib/hex-binary.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/hex-binary.c	Fri Jan 13 22:25:57 2006 +0200
@@ -5,7 +5,7 @@
 #include "hex-binary.h"
 
 static const char *
-binary_to_hex_case(const unsigned char *data, size_t size, int ucase)
+binary_to_hex_case(const unsigned char *data, size_t size, bool ucase)
 {
 	char *buf, *p, base_char;
 	size_t i;
--- a/src/lib/ioloop-epoll.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ioloop-epoll.c	Fri Jan 13 22:25:57 2006 +0200
@@ -103,7 +103,7 @@
 	return events;
 }
 
-static int iolist_add(struct io_list *list, struct io *io)
+static bool iolist_add(struct io_list *list, struct io *io)
 {
 	int i, idx;
 
@@ -129,9 +129,10 @@
 	return TRUE;
 }
 
-static int iolist_del(struct io_list *list, struct io *io)
+static bool iolist_del(struct io_list *list, struct io *io)
 {
-	int i, last = TRUE;
+	bool last = TRUE;
+	int i;
 
 	for (i = 0; i < EPOLL_IOS_PER_FD; i++) {
 		if (list->ios[i] != NULL) {
@@ -149,7 +150,8 @@
 	struct ioloop_handler_context *ctx = ioloop->handler_context;
 	struct io_list **list;
 	struct epoll_event event;
-	int ret, first, op, fd = io->fd;
+	int ret, op, fd = io->fd;
+	bool first;
 
 	list = array_idx_modifyable(&ctx->fd_index, fd);
 	if (*list == NULL)
@@ -182,7 +184,8 @@
 	struct ioloop_handler_context *ctx = ioloop->handler_context;
 	struct io_list **list;
 	struct epoll_event event;
-	int ret, last, op;
+	int ret, op;
+	bool last;
 
 	list = array_idx_modifyable(&ctx->fd_index, io->fd);
 	last = iolist_del(*list, io);
@@ -209,7 +212,8 @@
 	struct io *io;
 	struct timeval tv;
 	unsigned int t_id;
-	int msecs, ret, i, call;
+	int msecs, ret, i;
+	bool call;
 
         /* get the time left for next timeout task */
 	msecs = io_loop_get_wait_time(ioloop->timeouts, &tv, NULL);
--- a/src/lib/ioloop-notify-dn.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ioloop-notify-dn.c	Fri Jan 13 22:25:57 2006 +0200
@@ -17,7 +17,7 @@
 
 struct ioloop_notify_handler_context {
 	struct io *event_io;
-	int disabled;
+	bool disabled;
 
 	int event_pipe[2];
 };
--- a/src/lib/ioloop-notify-inotify.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ioloop-notify-inotify.c	Fri Jan 13 22:25:57 2006 +0200
@@ -26,10 +26,10 @@
 	struct io *event_io;
 
 	buffer_t *buf;
-	int disabled;
+	bool disabled;
 };
 
-static int event_read_next(struct ioloop *ioloop)
+static bool event_read_next(struct ioloop *ioloop)
 {
 	struct ioloop_notify_handler_context *ctx =
 		ioloop->notify_handler_context;
--- a/src/lib/ioloop-poll.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ioloop-poll.c	Fri Jan 13 22:25:57 2006 +0200
@@ -135,7 +135,8 @@
         struct timeval tv;
 	struct io *io;
 	unsigned int t_id;
-	int msecs, ret, call;
+	int msecs, ret;
+	bool call;
 
         /* get the time left for next timeout task */
 	msecs = io_loop_get_wait_time(ioloop->timeouts, &tv, NULL);
--- a/src/lib/ioloop.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ioloop.c	Fri Jan 13 22:25:57 2006 +0200
@@ -240,7 +240,7 @@
         ioloop->running = TRUE;
 }
 
-int io_loop_is_running(struct ioloop *ioloop)
+bool io_loop_is_running(struct ioloop *ioloop)
 {
         return ioloop->running;
 }
--- a/src/lib/ioloop.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ioloop.h	Fri Jan 13 22:25:57 2006 +0200
@@ -47,7 +47,7 @@
 void io_loop_run(struct ioloop *ioloop);
 void io_loop_stop(struct ioloop *ioloop); /* safe to run in signal handler */
 
-int io_loop_is_running(struct ioloop *ioloop);
+bool io_loop_is_running(struct ioloop *ioloop);
 
 /* call these if you wish to run the iteration only once */
 void io_loop_set_running(struct ioloop *ioloop);
--- a/src/lib/istream-data.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream-data.c	Fri Jan 13 22:25:57 2006 +0200
@@ -23,14 +23,14 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	stream->skip = v_offset;
 	stream->istream.v_offset = v_offset;
 }
 
 static const struct stat *
-_stat(struct _istream *stream, int exact __attr_unused__)
+_stat(struct _istream *stream, bool exact __attr_unused__)
 {
 	stream->statbuf.st_size = stream->pos;
 	return &stream->statbuf;
--- a/src/lib/istream-file.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream-file.c	Fri Jan 13 22:25:57 2006 +0200
@@ -160,7 +160,7 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	struct file_istream *fstream = (struct file_istream *) stream;
 
@@ -207,7 +207,7 @@
 }
 
 static const struct stat *
-_stat(struct _istream *stream, int exact __attr_unused__)
+_stat(struct _istream *stream, bool exact __attr_unused__)
 {
 	struct file_istream *fstream = (struct file_istream *) stream;
 
@@ -220,7 +220,7 @@
 }
 
 struct istream *i_stream_create_file(int fd, pool_t pool,
-				     size_t max_buffer_size, int autoclose_fd)
+				     size_t max_buffer_size, bool autoclose_fd)
 {
 	struct file_istream *fstream;
 	struct stat st;
--- a/src/lib/istream-internal.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream-internal.h	Fri Jan 13 22:25:57 2006 +0200
@@ -12,9 +12,9 @@
 
 /* methods: */
 	ssize_t (*read)(struct _istream *stream);
-	void (*seek)(struct _istream *stream, uoff_t v_offset, int mark);
+	void (*seek)(struct _istream *stream, uoff_t v_offset, bool mark);
 	void (*sync)(struct _istream *stream);
-	const struct stat *(*stat)(struct _istream *stream, int exact);
+	const struct stat *(*stat)(struct _istream *stream, bool exact);
 
 /* data: */
 	struct istream istream;
--- a/src/lib/istream-limit.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream-limit.c	Fri Jan 13 22:25:57 2006 +0200
@@ -81,7 +81,7 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	struct limit_istream *lstream = (struct limit_istream *) stream;
 
@@ -92,7 +92,7 @@
 	stream->skip = stream->pos = 0;
 }
 
-static const struct stat *_stat(struct _istream *stream, int exact)
+static const struct stat *_stat(struct _istream *stream, bool exact)
 {
 	struct limit_istream *lstream = (struct limit_istream *) stream;
 	const struct stat *st;
--- a/src/lib/istream-mmap.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream-mmap.c	Fri Jan 13 22:25:57 2006 +0200
@@ -142,7 +142,7 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	struct mmap_istream *mstream = (struct mmap_istream *) stream;
 
@@ -186,7 +186,7 @@
 }
 
 static const struct stat *
-_stat(struct _istream *stream, int exact __attr_unused__)
+_stat(struct _istream *stream, bool exact __attr_unused__)
 {
 	struct mmap_istream *mstream = (struct mmap_istream *) stream;
 
@@ -198,7 +198,7 @@
 
 struct istream *i_stream_create_mmap(int fd, pool_t pool, size_t block_size,
 				     uoff_t start_offset, uoff_t v_size,
-				     int autoclose_fd)
+				     bool autoclose_fd)
 {
 	struct mmap_istream *mstream;
         struct istream *istream;
--- a/src/lib/istream-seekable.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream-seekable.c	Fri Jan 13 22:25:57 2006 +0200
@@ -163,7 +163,7 @@
 	return ret;
 }
 
-static int read_from_buffer(struct seekable_istream *sstream, ssize_t *ret)
+static bool read_from_buffer(struct seekable_istream *sstream, ssize_t *ret)
 {
 	struct _istream *stream = &sstream->istream;
 	const unsigned char *data;
@@ -256,14 +256,14 @@
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset,
-		  int mark __attr_unused__)
+		  bool mark __attr_unused__)
 {
 	stream->istream.stream_errno = 0;
 	stream->istream.v_offset = v_offset;
 	stream->skip = stream->pos = 0;
 }
 
-static const struct stat *_stat(struct _istream *stream, int exact)
+static const struct stat *_stat(struct _istream *stream, bool exact)
 {
 	struct seekable_istream *sstream = (struct seekable_istream *)stream;
 	uoff_t old_offset;
--- a/src/lib/istream.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream.c	Fri Jan 13 22:25:57 2006 +0200
@@ -110,7 +110,7 @@
 		_stream->sync(_stream);
 }
 
-const struct stat *i_stream_stat(struct istream *stream, int exact)
+const struct stat *i_stream_stat(struct istream *stream, bool exact)
 {
 	struct _istream *_stream = stream->real_stream;
 
@@ -120,7 +120,7 @@
 	return _stream->stat(_stream, exact);
 }
 
-int i_stream_have_bytes_left(struct istream *stream)
+bool i_stream_have_bytes_left(struct istream *stream)
 {
 	struct _istream *_stream = stream->real_stream;
 
@@ -232,7 +232,7 @@
 		       size_t *size, size_t threshold)
 {
 	ssize_t ret = 0;
-	int read_more = FALSE;
+	bool read_more = FALSE;
 
 	do {
 		*data = i_stream_get_data(stream, size);
--- a/src/lib/istream.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/istream.h	Fri Jan 13 22:25:57 2006 +0200
@@ -15,10 +15,10 @@
 };
 
 struct istream *i_stream_create_file(int fd, pool_t pool,
-				     size_t max_buffer_size, int autoclose_fd);
+				     size_t max_buffer_size, bool autoclose_fd);
 struct istream *i_stream_create_mmap(int fd, pool_t pool, size_t block_size,
 				     uoff_t start_offset, uoff_t v_size,
-				     int autoclose_fd);
+				     bool autoclose_fd);
 struct istream *i_stream_create_from_data(pool_t pool, const void *data,
 					  size_t size);
 struct istream *i_stream_create_limit(pool_t pool, struct istream *input,
@@ -64,9 +64,9 @@
    If exact=FALSE, the stream may not return exactly correct values, but the
    returned values can be compared to see if anything had changed (eg. in
    compressed stream st_size could be compressed size) */
-const struct stat *i_stream_stat(struct istream *stream, int exact);
+const struct stat *i_stream_stat(struct istream *stream, bool exact);
 /* Returns TRUE if there are any bytes left to be read or in buffer. */
-int i_stream_have_bytes_left(struct istream *stream);
+bool i_stream_have_bytes_left(struct istream *stream);
 
 /* Gets the next line from stream and returns it, or NULL if more data is
    needed to make a full line. Note that if the stream ends with LF not being
--- a/src/lib/lib-signals.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/lib-signals.c	Fri Jan 13 22:25:57 2006 +0200
@@ -14,7 +14,7 @@
 	signal_handler_t *handler;
 	void *context;
 
-	int delayed;
+	bool delayed;
         struct signal_handler *next;
 };
 
@@ -29,7 +29,7 @@
 static void sig_handler(int signo)
 {
 	struct signal_handler *h;
-	int delayed_sent = FALSE;
+	bool delayed_sent = FALSE;
 
 	if (signo < 0 || signo > MAX_SIGNAL_VALUE)
 		return;
@@ -93,7 +93,7 @@
 	}
 }
 
-void lib_signals_set_handler(int signo, int delayed,
+void lib_signals_set_handler(int signo, bool delayed,
 			     signal_handler_t *handler, void *context)
 {
 	struct signal_handler *h;
--- a/src/lib/lib-signals.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/lib-signals.h	Fri Jan 13 22:25:57 2006 +0200
@@ -8,7 +8,7 @@
 /* Set signal handler for specific signal. If delayed is TRUE, the handler
    will be called later, ie. not as a real signal handler. If handler is NULL,
    the signal is ignored. */
-void lib_signals_set_handler(int signo, int delayed,
+void lib_signals_set_handler(int signo, bool delayed,
 			     signal_handler_t *handler, void *context);
 void lib_signals_unset_handler(int signo,
 			       signal_handler_t *handler, void *context);
--- a/src/lib/mempool-alloconly.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/mempool-alloconly.c	Fri Jan 13 22:25:57 2006 +0200
@@ -215,7 +215,7 @@
 	}
 }
 
-static int pool_try_grow(struct alloconly_pool *apool, void *mem, size_t size)
+static bool pool_try_grow(struct alloconly_pool *apool, void *mem, size_t size)
 {
 	/* see if we want to grow the memory we allocated last */
 	if (POOL_BLOCK_DATA(apool->block) +
--- a/src/lib/module-dir.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/module-dir.c	Fri Jan 13 22:25:57 2006 +0200
@@ -37,7 +37,7 @@
 	return ret;
 }
 
-static void *get_symbol(struct module *module, const char *symbol, int quiet)
+static void *get_symbol(struct module *module, const char *symbol, bool quiet)
 {
 	if (quiet)
 		return dlsym(module->handle, symbol);
@@ -57,7 +57,7 @@
 }
 
 static struct module *
-module_load(const char *path, const char *name, int require_init_funcs)
+module_load(const char *path, const char *name, bool require_init_funcs)
 {
 	void *handle;
 	void (*init)(void);
@@ -108,7 +108,7 @@
 	return strcmp(n1, n2);
 }
 
-struct module *module_dir_load(const char *dir, int require_init_funcs)
+struct module *module_dir_load(const char *dir, bool require_init_funcs)
 {
 	DIR *dirp;
 	struct dirent *d;
@@ -200,7 +200,8 @@
 
 #else
 
-struct module *module_dir_load(const char *dir __attr_unused__, int require_init_funcs __attr_unused__)
+struct module *module_dir_load(const char *dir __attr_unused__,
+			       bool require_init_funcs __attr_unused__)
 {
 	i_error("Dynamically loadable module support not built in");
 	return NULL;
--- a/src/lib/module-dir.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/module-dir.h	Fri Jan 13 22:25:57 2006 +0200
@@ -11,7 +11,7 @@
 };
 
 /* Load all modules in given directory. */
-struct module *module_dir_load(const char *dir, int require_init_funcs);
+struct module *module_dir_load(const char *dir, bool require_init_funcs);
 /* Unload all modules */
 void module_dir_unload(struct module *modules);
 
--- a/src/lib/network.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/network.c	Fri Jan 13 22:25:57 2006 +0200
@@ -25,7 +25,7 @@
 #  define SIZEOF_SOCKADDR(so) (sizeof(so.sin))
 #endif
 
-int net_ip_compare(const struct ip_addr *ip1, const struct ip_addr *ip2)
+bool net_ip_compare(const struct ip_addr *ip1, const struct ip_addr *ip2)
 {
 	if (ip1->family != ip2->family)
 		return 0;
@@ -204,16 +204,18 @@
 }
 
 /* Set socket blocking/nonblocking */
-void net_set_nonblock(int fd, int nonblock)
+void net_set_nonblock(int fd, bool nonblock)
 {
 	if (fd_set_nonblock(fd, nonblock) < 0)
 		i_fatal("fd_set_nonblock(%d) failed: %m", fd);
 }
 
-int net_set_cork(int fd __attr_unused__, int cork __attr_unused__)
+int net_set_cork(int fd __attr_unused__, bool cork __attr_unused__)
 {
 #ifdef TCP_CORK
-	return setsockopt(fd, IPPROTO_TCP, TCP_CORK, &cork, sizeof(cork));
+	int val = cork;
+
+	return setsockopt(fd, IPPROTO_TCP, TCP_CORK, &val, sizeof(val));
 #else
 	errno = ENOPROTOOPT;
 	return -1;
@@ -639,24 +641,24 @@
 	return entry == NULL ? NULL : entry->s_name;
 }
 
-int is_ipv4_address(const char *addr)
+bool is_ipv4_address(const char *addr)
 {
 	while (*addr != '\0') {
 		if (*addr != '.' && !i_isdigit(*addr))
-			return 0;
+			return FALSE;
                 addr++;
 	}
 
-	return 1;
+	return TRUE;
 }
 
-int is_ipv6_address(const char *addr)
+bool is_ipv6_address(const char *addr)
 {
 	while (*addr != '\0') {
 		if (*addr != ':' && !i_isxdigit(*addr))
-			return 0;
+			return FALSE;
                 addr++;
 	}
 
-	return 1;
+	return TRUE;
 }
--- a/src/lib/network.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/network.h	Fri Jan 13 22:25:57 2006 +0200
@@ -40,7 +40,7 @@
 #define IPADDR_IS_V6(ip) ((ip)->family == AF_INET6)
 
 /* returns 1 if IPADDRs are the same */
-int net_ip_compare(const struct ip_addr *ip1, const struct ip_addr *ip2);
+bool net_ip_compare(const struct ip_addr *ip1, const struct ip_addr *ip2);
 
 /* Connect to socket with ip address */
 int net_connect_ip(const struct ip_addr *ip, unsigned int port,
@@ -51,10 +51,10 @@
 void net_disconnect(int fd);
 
 /* Set socket blocking/nonblocking */
-void net_set_nonblock(int fd, int nonblock);
+void net_set_nonblock(int fd, bool nonblock);
 /* Set TCP_CORK if supported, ie. don't send out partial frames.
    Returns 0 if ok, -1 if failed. */
-int net_set_cork(int fd, int cork);
+int net_set_cork(int fd, bool cork);
 
 /* Set IP to contain INADDR_ANY for IPv4 or IPv6. The IPv6 any address may
    include IPv4 depending on the system (Linux yes, BSD no). */
@@ -100,7 +100,7 @@
 /* Get name of TCP service */
 const char *net_getservbyport(unsigned short port);
 
-int is_ipv4_address(const char *addr);
-int is_ipv6_address(const char *addr);
+bool is_ipv4_address(const char *addr);
+bool is_ipv6_address(const char *addr);
 
 #endif
--- a/src/lib/ostream-crlf.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ostream-crlf.c	Fri Jan 13 22:25:57 2006 +0200
@@ -15,7 +15,7 @@
 	struct _ostream ostream;
 
         struct ostream *output;
-	int last_cr;
+	bool last_cr;
 };
 
 static const struct const_iovec cr_iov = { "\r", 1 };
@@ -38,7 +38,7 @@
 	o_stream_set_max_buffer_size(cstream->output, max_size);
 }
 
-static void _cork(struct _ostream *stream, int set)
+static void _cork(struct _ostream *stream, bool set)
 {
 	struct crlf_ostream *cstream = (struct crlf_ostream *)stream;
 
@@ -55,7 +55,7 @@
 	return o_stream_flush(cstream->output);
 }
 
-static void _flush_pending(struct _ostream *stream, int set)
+static void _flush_pending(struct _ostream *stream, bool set)
 {
 	struct crlf_ostream *cstream = (struct crlf_ostream *)stream;
 
@@ -117,7 +117,7 @@
 	struct const_iovec new_iov;
 	unsigned int vec, i, len, start, new_iov_count = 0, new_iov_size = 0;
 	ssize_t ret, total;
-	int last_cr;
+	bool last_cr;
 
 	last_cr = cstream->last_cr;
 
--- a/src/lib/ostream-file.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ostream-file.c	Fri Jan 13 22:25:57 2006 +0200
@@ -209,7 +209,7 @@
 	return IS_STREAM_EMPTY(fstream) ? 1 : 0;
 }
 
-static void _cork(struct _ostream *stream, int set)
+static void _cork(struct _ostream *stream, bool set)
 {
 	struct file_ostream *fstream = (struct file_ostream *)stream;
 	int ret;
@@ -242,7 +242,7 @@
 	return buffer_flush(fstream);
 }
 
-static void _flush_pending(struct _ostream *stream, int set)
+static void _flush_pending(struct _ostream *stream, bool set)
 {
 	struct file_ostream *fstream = (struct file_ostream *) stream;
 
@@ -722,7 +722,7 @@
 
 struct ostream *
 o_stream_create_file(int fd, pool_t pool, size_t max_buffer_size,
-		     int autoclose_fd)
+		     bool autoclose_fd)
 {
 	struct file_ostream *fstream;
 	struct ostream *ostream;
--- a/src/lib/ostream-internal.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ostream-internal.h	Fri Jan 13 22:25:57 2006 +0200
@@ -9,9 +9,9 @@
 	struct _iostream iostream;
 
 /* methods: */
-	void (*cork)(struct _ostream *stream, int set);
+	void (*cork)(struct _ostream *stream, bool set);
 	int (*flush)(struct _ostream *stream);
-	void (*flush_pending)(struct _ostream *stream, int set);
+	void (*flush_pending)(struct _ostream *stream, bool set);
 	size_t (*get_used_size)(struct _ostream *stream);
 	int (*seek)(struct _ostream *stream, uoff_t offset);
 	ssize_t (*sendv)(struct _ostream *stream, const struct const_iovec *iov,
--- a/src/lib/ostream.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ostream.c	Fri Jan 13 22:25:57 2006 +0200
@@ -66,7 +66,7 @@
 	return _stream->flush(_stream);
 }
 
-void o_stream_set_flush_pending(struct ostream *stream, int set)
+void o_stream_set_flush_pending(struct ostream *stream, bool set)
 {
 	struct _ostream *_stream = stream->real_stream;
 
--- a/src/lib/ostream.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/ostream.h	Fri Jan 13 22:25:57 2006 +0200
@@ -25,7 +25,7 @@
    If max_buffer_size is 0, an "optimal" buffer size is used (max 128kB). */
 struct ostream *
 o_stream_create_file(int fd, pool_t pool, size_t max_buffer_size,
-		     int autoclose_fd);
+		     bool autoclose_fd);
 
 /* Reference counting. References start from 1, so calling o_stream_unref()
    destroys the stream if o_stream_ref() is never used. */
@@ -52,7 +52,7 @@
 int o_stream_flush(struct ostream *stream);
 /* Set "flush pending" state of stream. If set, the flush callback is called
    when more data is allowed to be sent, even if the buffer itself is empty. */
-void o_stream_set_flush_pending(struct ostream *stream, int set);
+void o_stream_set_flush_pending(struct ostream *stream, bool set);
 /* Returns number of bytes currently in buffer. */
 size_t o_stream_get_buffer_used_size(struct ostream *stream);
 
--- a/src/lib/printf-upper-bound.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/printf-upper-bound.c	Fri Jan 13 22:25:57 2006 +0200
@@ -69,7 +69,7 @@
 {
   const char *format = *format_p;
   size_t len = 1;
-  int fix_format = FALSE;
+  bool fix_format = FALSE;
 
   if (!format)
     return len;
@@ -96,7 +96,7 @@
       else
         {
           PrintfArgSpec spec;
-          int seen_l = FALSE, conv_done = FALSE;
+          bool seen_l = FALSE, conv_done = FALSE;
           unsigned int conv_len = 0;
 
           memset(&spec, 0, sizeof(spec));
--- a/src/lib/restrict-access.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/restrict-access.c	Fri Jan 13 22:25:57 2006 +0200
@@ -122,7 +122,7 @@
 	t_pop();
 }
 
-void restrict_access_by_env(int disallow_root)
+void restrict_access_by_env(bool disallow_root)
 {
 	const char *env;
 	gid_t gid;
--- a/src/lib/restrict-access.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/restrict-access.h	Fri Jan 13 22:25:57 2006 +0200
@@ -11,6 +11,6 @@
 /* chroot, setuid() and setgid() based on environment variables.
    If disallow_roots is TRUE, we'll kill ourself if we didn't have the
    environment settings and we have root uid or gid. */
-void restrict_access_by_env(int disallow_root);
+void restrict_access_by_env(bool disallow_root);
 
 #endif
--- a/src/lib/restrict-process-size.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/restrict-process-size.h	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,6 @@
 
 /* Restrict max. process size. The size is in megabytes, setting it to
    (unsigned int)-1 sets it unlimited. */
-void restrict_process_size(unsigned int size __attr_unused__,
-			   unsigned int max_processes __attr_unused__);
+void restrict_process_size(unsigned int size, unsigned int max_processes);
 
 #endif
--- a/src/lib/seq-range-array.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/seq-range-array.c	Fri Jan 13 22:25:57 2006 +0200
@@ -4,7 +4,7 @@
 #include "array.h"
 #include "seq-range-array.h"
 
-static int seq_range_lookup(array_t *array, uint32_t seq, unsigned int *idx_r)
+static bool seq_range_lookup(array_t *array, uint32_t seq, unsigned int *idx_r)
 {
         ARRAY_SET_TYPE(array, struct seq_range);
 	struct seq_range *data;
@@ -167,7 +167,7 @@
 	}
 }
 
-int seq_range_exists(array_t *array, uint32_t seq)
+bool seq_range_exists(array_t *array, uint32_t seq)
 {
 	unsigned int idx;
 
--- a/src/lib/seq-range-array.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/seq-range-array.h	Fri Jan 13 22:25:57 2006 +0200
@@ -7,6 +7,6 @@
 
 void seq_range_array_add(array_t *array, unsigned int init_count, uint32_t seq);
 void seq_range_array_remove(array_t *array, uint32_t seq);
-int seq_range_exists(array_t *array, uint32_t seq);
+bool seq_range_exists(array_t *array, uint32_t seq);
 
 #endif
--- a/src/lib/strfuncs.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/strfuncs.c	Fri Jan 13 22:25:57 2006 +0200
@@ -352,7 +352,7 @@
         return str;
 }
 
-int is_numeric(const char *str, char end_char)
+bool is_numeric(const char *str, char end_char)
 {
 	if (*str == '\0' || *str == end_char)
 		return FALSE;
@@ -619,7 +619,7 @@
 	return str;
 }
 
-int strarray_remove(const char **arr, const char *value)
+bool strarray_remove(const char **arr, const char *value)
 {
 	const char **dest;
 
--- a/src/lib/strfuncs.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/strfuncs.h	Fri Jan 13 22:25:57 2006 +0200
@@ -36,7 +36,7 @@
 
 /* Return TRUE if all characters in string are numbers.
    Stop when `end_char' is found from string. */
-int is_numeric(const char *str, char end_char);
+bool is_numeric(const char *str, char end_char);
 
 /* Like strlcpy(), but return -1 if buffer was overflown, 0 if not. */
 int strocpy(char *dest, const char *src, size_t dstsize);
@@ -74,7 +74,7 @@
 /* Return all strings from array joined into one string. */
 const char *t_strarray_join(const char *const *arr, const char *separator);
 /* Removes a value from NULL-terminated string array. Returns TRUE if found. */
-int strarray_remove(const char **arr, const char *value);
+bool strarray_remove(const char **arr, const char *value);
 
 /* INTERNAL */
 char *_vstrconcat(const char *str1, va_list args, size_t *ret_len);
--- a/src/lib/unlink-directory.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/unlink-directory.c	Fri Jan 13 22:25:57 2006 +0200
@@ -148,7 +148,7 @@
 	return 0;
 }
 
-int unlink_directory(const char *dir, int unlink_dir)
+int unlink_directory(const char *dir, bool unlink_dir)
 {
 	int fd, ret, old_errno;
 
--- a/src/lib/unlink-directory.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/unlink-directory.h	Fri Jan 13 22:25:57 2006 +0200
@@ -3,6 +3,6 @@
 
 /* Unlink directory and/or everything under it.
    Returns 0 if successful, -1 if error. */
-int unlink_directory(const char *dir, int unlink_dir);
+int unlink_directory(const char *dir, bool unlink_dir);
 
 #endif
--- a/src/lib/var-expand.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/lib/var-expand.c	Fri Jan 13 22:25:57 2006 +0200
@@ -97,7 +97,7 @@
 	const char *(*modifier[MAX_MODIFIER_COUNT])
 		(const char *, struct var_expand_context *);
 	unsigned int i, modifier_count;
-	int zero_padding = FALSE;
+	bool zero_padding = FALSE;
 
 	memset(&ctx, 0, sizeof(ctx));
 	for (; *str != '\0'; str++) {
--- a/src/login-common/client-common.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/client-common.c	Fri Jan 13 22:25:57 2006 +0200
@@ -49,7 +49,7 @@
 	return tab;
 }
 
-static int have_key(const struct var_expand_table *table, const char *str)
+static bool have_key(const struct var_expand_table *table, const char *str)
 {
 	char key;
 	unsigned int i;
--- a/src/login-common/client-common.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/client-common.h	Fri Jan 13 22:25:57 2006 +0200
@@ -26,7 +26,7 @@
 	/* ... */
 };
 
-struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip,
+struct client *client_create(int fd, bool ssl, const struct ip_addr *local_ip,
 			     const struct ip_addr *ip);
 
 void client_syslog(struct client *client, const char *msg);
--- a/src/login-common/common.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/common.h	Fri Jan 13 22:25:57 2006 +0200
@@ -11,8 +11,8 @@
 
 extern const char *login_protocol;
 
-extern int disable_plaintext_auth, process_per_connection, greeting_capability;
-extern int verbose_proctitle, verbose_ssl, verbose_auth;
+extern bool disable_plaintext_auth, process_per_connection, greeting_capability;
+extern bool verbose_proctitle, verbose_ssl, verbose_auth;
 extern const char *greeting, *log_format;
 extern const char *const *log_format_elements;
 extern unsigned int max_logging_users;
--- a/src/login-common/main.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/main.c	Fri Jan 13 22:25:57 2006 +0200
@@ -18,8 +18,8 @@
 #include <unistd.h>
 #include <syslog.h>
 
-int disable_plaintext_auth, process_per_connection, greeting_capability;
-int verbose_proctitle, verbose_ssl, verbose_auth;
+bool disable_plaintext_auth, process_per_connection, greeting_capability;
+bool verbose_proctitle, verbose_ssl, verbose_auth;
 const char *greeting, *log_format;
 const char *const *log_format_elements;
 unsigned int max_logging_users;
@@ -30,7 +30,7 @@
 static struct ioloop *ioloop;
 static struct io *io_listen, *io_ssl_listen;
 static int main_refcount;
-static int is_inetd, closing_down;
+static bool is_inetd, closing_down;
 
 void main_ref(void)
 {
@@ -133,7 +133,7 @@
 }
 
 static void auth_connect_notify(struct auth_client *client __attr_unused__,
-				int connected, void *context __attr_unused__)
+				bool connected, void *context __attr_unused__)
 {
 	if (connected)
                 clients_notify_auth_connected();
@@ -268,7 +268,8 @@
 	unsigned int local_port;
 	struct ssl_proxy *proxy = NULL;
 	struct client *client;
-	int i, fd = -1, master_fd = -1, ssl = FALSE;
+	int i, fd = -1, master_fd = -1;
+	bool ssl = FALSE;
 
 	is_inetd = getenv("DOVECOT_MASTER") == NULL;
 
--- a/src/login-common/master.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/master.c	Fri Jan 13 22:25:57 2006 +0200
@@ -225,7 +225,7 @@
 	master_pos = 0;
 }
 
-void master_init(int fd, int notify)
+void master_init(int fd, bool notify)
 {
 	main_ref();
 
--- a/src/login-common/master.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/master.h	Fri Jan 13 22:25:57 2006 +0200
@@ -5,7 +5,7 @@
 
 #include "../master/master-login-interface.h"
 
-typedef void master_callback_t(struct client *client, int success);
+typedef void master_callback_t(struct client *client, bool success);
 
 void master_request_login(struct client *client, master_callback_t *callback,
 			  unsigned int auth_pid, unsigned int auth_id);
@@ -20,7 +20,7 @@
 /* inetd: Connect to existing master process, or create new one. */
 int master_connect(const char *group_name);
 
-void master_init(int fd, int notify);
+void master_init(int fd, bool notify);
 void master_deinit(void);
 
 #endif
--- a/src/login-common/sasl-server.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/sasl-server.c	Fri Jan 13 22:25:57 2006 +0200
@@ -22,7 +22,7 @@
 	return auth_flags;
 }
 
-static void master_callback(struct client *client, int success)
+static void master_callback(struct client *client, bool success)
 {
 	client->authenticating = FALSE;
 	client->sasl_callback(client, success ? SASL_SERVER_REPLY_SUCCESS :
@@ -35,7 +35,7 @@
 {
 	struct client *client = context;
 	unsigned int i;
-	int nologin;
+	bool nologin;
 
 	if (!client->authenticating) {
 		/* client aborted */
--- a/src/login-common/ssl-proxy-gnutls.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/ssl-proxy-gnutls.c	Fri Jan 13 22:25:57 2006 +0200
@@ -54,7 +54,7 @@
 
 static void ssl_input(void *context);
 static void plain_input(void *context);
-static int ssl_proxy_destroy(struct ssl_proxy *proxy);
+static bool ssl_proxy_destroy(struct ssl_proxy *proxy);
 
 static const char *get_alert_text(struct ssl_proxy *proxy)
 {
--- a/src/login-common/ssl-proxy-openssl.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/ssl-proxy-openssl.c	Fri Jan 13 22:25:57 2006 +0200
@@ -54,7 +54,7 @@
 static void ssl_write(struct ssl_proxy *proxy);
 static void ssl_step(void *context);
 static void ssl_proxy_destroy(struct ssl_proxy *proxy);
-static int ssl_proxy_unref(struct ssl_proxy *proxy);
+static void ssl_proxy_unref(struct ssl_proxy *proxy);
 
 static void ssl_set_io(struct ssl_proxy *proxy, enum ssl_io_action action)
 {
@@ -86,7 +86,7 @@
 	}
 }
 
-static void plain_block_input(struct ssl_proxy *proxy, int block)
+static void plain_block_input(struct ssl_proxy *proxy, bool block)
 {
 	if (block) {
 		if (proxy->io_plain_read != NULL) {
@@ -105,7 +105,7 @@
 {
 	struct ssl_proxy *proxy = context;
 	ssize_t ret;
-	int corked = FALSE;
+	bool corked = FALSE;
 
 	if (proxy->sslout_size == sizeof(proxy->sslout_buf)) {
 		/* buffer full, block input until it's written */
@@ -374,7 +374,7 @@
 	return sfd[1];
 }
 
-int ssl_proxy_has_valid_client_cert(struct ssl_proxy *proxy)
+bool ssl_proxy_has_valid_client_cert(struct ssl_proxy *proxy)
 {
 	return proxy->cert_received && !proxy->cert_broken;
 }
@@ -404,17 +404,16 @@
 	ssl_proxy_unref(proxy);
 }
 
-static int ssl_proxy_unref(struct ssl_proxy *proxy)
+static void ssl_proxy_unref(struct ssl_proxy *proxy)
 {
 	if (--proxy->refcount > 0)
-		return TRUE;
+		return;
 	i_assert(proxy->refcount == 0);
 
 	SSL_free(proxy->ssl);
 	i_free(proxy);
 
 	main_unref();
-	return FALSE;
 }
 
 static void ssl_proxy_destroy(struct ssl_proxy *proxy)
--- a/src/login-common/ssl-proxy.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/ssl-proxy.c	Fri Jan 13 22:25:57 2006 +0200
@@ -3,7 +3,7 @@
 #include "lib.h"
 #include "ssl-proxy.h"
 
-int ssl_initialized = FALSE;
+bool ssl_initialized = FALSE;
 
 #ifndef HAVE_SSL
 
@@ -16,7 +16,7 @@
 	return -1;
 }
 
-int ssl_proxy_has_valid_client_cert(struct ssl_proxy *proxy __attr_unused__)
+bool ssl_proxy_has_valid_client_cert(struct ssl_proxy *proxy __attr_unused__)
 {
 	return FALSE;
 }
--- a/src/login-common/ssl-proxy.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/login-common/ssl-proxy.h	Fri Jan 13 22:25:57 2006 +0200
@@ -4,13 +4,13 @@
 struct ip_addr;
 struct ssl_proxy;
 
-extern int ssl_initialized;
+extern bool ssl_initialized;
 
 /* establish SSL connection with the given fd, returns a new fd which you
    must use from now on, or -1 if error occurred. Unless -1 is returned,
    the given fd must be simply forgotten. */
 int ssl_proxy_new(int fd, struct ip_addr *ip, struct ssl_proxy **proxy_r);
-int ssl_proxy_has_valid_client_cert(struct ssl_proxy *proxy);
+bool ssl_proxy_has_valid_client_cert(struct ssl_proxy *proxy);
 const char *ssl_proxy_get_peer_name(struct ssl_proxy *proxy);
 void ssl_proxy_free(struct ssl_proxy *proxy);
 
--- a/src/master/auth-process.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/auth-process.c	Fri Jan 13 22:25:57 2006 +0200
@@ -91,7 +91,7 @@
 	t_pop();
 }
 
-static int
+static bool
 auth_process_input_user(struct auth_process *process, const char *args)
 {
 	void *context;
@@ -120,7 +120,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 auth_process_input_notfound(struct auth_process *process, const char *args)
 {
 	void *context;
@@ -140,7 +140,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 auth_process_input_spid(struct auth_process *process, const char *args)
 {
 	unsigned int pid;
@@ -167,7 +167,7 @@
 	return TRUE;
 }
 
-static int
+static bool
 auth_process_input_fail(struct auth_process *process, const char *args)
 {
 	void *context;
@@ -196,7 +196,7 @@
 {
 	struct auth_process *process = context;
 	const char *line;
-	int ret;
+	bool ret;
 
 	switch (i_stream_read(process->input)) {
 	case 0:
--- a/src/master/common.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/common.h	Fri Jan 13 22:25:57 2006 +0200
@@ -45,6 +45,6 @@
 /* misc */
 #define VALIDATE_STR(str) \
 	validate_str(str, sizeof(str))
-int validate_str(const char *str, size_t max_len);
+bool validate_str(const char *str, size_t max_len);
 
 #endif
--- a/src/master/log.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/log.c	Fri Jan 13 22:25:57 2006 +0200
@@ -27,12 +27,12 @@
 static struct timeout *to;
 static unsigned int throttle_count;
 
-static int log_it(struct log_io *log_io, const char *line, int continues);
+static int log_it(struct log_io *log_io, const char *line, bool continues);
 static void log_read(void *context);
 static void log_io_free(struct log_io *log_io);
 static void log_throttle_timeout(void *context);
 
-static int log_write_pending(struct log_io *log_io)
+static bool log_write_pending(struct log_io *log_io)
 {
 	const char *line;
 
@@ -80,7 +80,7 @@
 			    IO_READ, log_read, log_io);
 }
 
-static int log_it(struct log_io *log_io, const char *line, int continues)
+static int log_it(struct log_io *log_io, const char *line, bool continues)
 {
 	const char *prefix;
 
--- a/src/master/login-process.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/login-process.c	Fri Jan 13 22:25:57 2006 +0200
@@ -51,7 +51,7 @@
 
 static void login_process_destroy(struct login_process *p);
 static void login_process_unref(struct login_process *p);
-static int login_process_init_group(struct login_process *p);
+static bool login_process_init_group(struct login_process *p);
 
 static void login_group_create(struct settings *set)
 {
@@ -163,7 +163,7 @@
 	return NULL;
 }
 
-static int login_process_read_group(struct login_process *p)
+static bool login_process_read_group(struct login_process *p)
 {
 	struct login_group *group;
 	const char *name, *proto;
@@ -667,7 +667,7 @@
 	return ret;
 }
 
-static int login_process_init_group(struct login_process *p)
+static bool login_process_init_group(struct login_process *p)
 {
 	p->group->processes++;
 	p->group->listening_processes++;
--- a/src/master/mail-process.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/mail-process.c	Fri Jan 13 22:25:57 2006 +0200
@@ -25,8 +25,8 @@
 
 static unsigned int mail_process_count = 0;
 
-static int validate_uid_gid(struct settings *set, uid_t uid, gid_t gid,
-			    const char *user)
+static bool validate_uid_gid(struct settings *set, uid_t uid, gid_t gid,
+			     const char *user)
 {
 	if (uid == 0) {
 		i_error("Logins with UID 0 not permitted (user %s)", user);
@@ -58,7 +58,7 @@
 	return TRUE;
 }
 
-static int validate_chroot(struct settings *set, const char *dir)
+static bool validate_chroot(struct settings *set, const char *dir)
 {
 	const char *const *chroot_dirs;
 
@@ -304,10 +304,10 @@
 		       set->mail_executable);
 }
 
-int create_mail_process(struct login_group *group, int socket,
-			const struct ip_addr *local_ip,
-			const struct ip_addr *remote_ip,
-			const char *user, const char *const *args)
+bool create_mail_process(struct login_group *group, int socket,
+			 const struct ip_addr *local_ip,
+			 const struct ip_addr *remote_ip,
+			 const char *user, const char *const *args)
 {
 	struct settings *set = group->set;
 	const struct var_expand_table *var_expand_table;
--- a/src/master/mail-process.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/mail-process.h	Fri Jan 13 22:25:57 2006 +0200
@@ -6,10 +6,10 @@
 
 void mail_process_exec(const char *protocol, const char *section);
 
-int create_mail_process(struct login_group *group, int socket,
-			const struct ip_addr *local_ip,
-			const struct ip_addr *remote_ip,
-			const char *user, const char *const *args);
+bool create_mail_process(struct login_group *group, int socket,
+			 const struct ip_addr *local_ip,
+			 const struct ip_addr *remote_ip,
+			 const char *user, const char *const *args);
 
 void mail_process_destroyed(pid_t pid);
 
--- a/src/master/main.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/main.c	Fri Jan 13 22:25:57 2006 +0200
@@ -43,13 +43,13 @@
 int null_fd, inetd_login_fd;
 uid_t master_uid;
 #ifdef DEBUG
-static int gdb;
+static bool gdb;
 #endif
 
-static void listen_fds_open(int retry);
+static void listen_fds_open(bool retry);
 static void listen_fds_close(struct server_settings *server);
 
-int validate_str(const char *str, size_t max_len)
+bool validate_str(const char *str, size_t max_len)
 {
 	size_t i;
 
@@ -330,7 +330,7 @@
 	}
 }
 
-static void listen_protocols(struct settings *set, int retry)
+static void listen_protocols(struct settings *set, bool retry)
 {
 	struct ip_addr *ip;
 	const char *const *proto;
@@ -421,7 +421,7 @@
 		set->ssl_listen_fd = null_fd;
 }
 
-static void listen_fds_open(int retry)
+static void listen_fds_open(bool retry)
 {
 	struct server_settings *server;
 
@@ -455,7 +455,7 @@
 	}
 }
 
-static int have_stderr_set(struct settings *set)
+static bool have_stderr_set(struct settings *set)
 {
 	if (set->log_path != NULL &&
 	    strcmp(set->log_path, "/dev/stderr") == 0)
@@ -468,7 +468,7 @@
 	return FALSE;
 }
 
-static int have_stderr(struct server_settings *server)
+static bool have_stderr(struct server_settings *server)
 {
 	while (server != NULL) {
 		if (server->imap != NULL && have_stderr_set(server->imap))
@@ -697,7 +697,7 @@
 {
 	/* parse arguments */
 	const char *exec_protocol = NULL, *exec_section = NULL;
-	int foreground = FALSE;
+	bool foreground = FALSE;
 	int i;
 
 #ifdef DEBUG
--- a/src/master/master-login-interface.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/master-login-interface.h	Fri Jan 13 22:25:57 2006 +0200
@@ -23,7 +23,7 @@
 
 struct master_login_reply {
 	unsigned int tag;
-	int success;
+	bool success;
 };
 
 #endif
--- a/src/master/master-settings.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/master-settings.c	Fri Jan 13 22:25:57 2006 +0200
@@ -394,7 +394,7 @@
 	}
 }
 
-static int get_login_uid(struct settings *set)
+static bool get_login_uid(struct settings *set)
 {
 	struct passwd *pw;
 
@@ -416,7 +416,7 @@
 	return TRUE;
 }
 
-static int auth_settings_verify(struct auth_settings *auth)
+static bool auth_settings_verify(struct auth_settings *auth)
 {
 	struct passwd *pw;
 
@@ -458,7 +458,7 @@
 	return TRUE;
 }
 
-static int namespace_settings_verify(struct namespace_settings *ns)
+static bool namespace_settings_verify(struct namespace_settings *ns)
 {
 	const char *name;
 
@@ -489,7 +489,7 @@
 	}
 }
 
-static int settings_is_active(struct settings *set)
+static bool settings_is_active(struct settings *set)
 {
 	if (set->protocol == MAIL_PROTOCOL_IMAP) {
 		if (strstr(set->protocols, "imap") == NULL)
@@ -502,7 +502,7 @@
 	return TRUE;
 }
 
-static int settings_have_connect_sockets(struct settings *set)
+static bool settings_have_connect_sockets(struct settings *set)
 {
 	struct auth_settings *auth;
 	struct server_settings *server;
@@ -518,7 +518,7 @@
 	return FALSE;
 }
 
-static int settings_verify(struct settings *set)
+static bool settings_verify(struct settings *set)
 {
 	const char *dir;
 	int facility;
@@ -914,8 +914,8 @@
 	return server;
 }
 
-static int parse_section(const char *type, const char *name, void *context,
-			 const char **errormsg)
+static bool parse_section(const char *type, const char *name, void *context,
+			  const char **errormsg)
 {
 	struct settings_parse_ctx *ctx = context;
 	struct server_settings *server;
@@ -1046,7 +1046,7 @@
 	return FALSE;
 }
 
-int master_settings_read(const char *path, int nochecks)
+bool master_settings_read(const char *path, bool nochecks)
 {
 	struct settings_parse_ctx ctx;
 	struct server_settings *server, *prev;
--- a/src/master/master-settings.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/master-settings.h	Fri Jan 13 22:25:57 2006 +0200
@@ -26,16 +26,16 @@
 	const char *listen;
 	const char *ssl_listen;
 
-	int ssl_disable;
+	bool ssl_disable;
 	const char *ssl_ca_file;
 	const char *ssl_cert_file;
 	const char *ssl_key_file;
 	const char *ssl_parameters_file;
 	unsigned int ssl_parameters_regenerate;
 	const char *ssl_cipher_list;
-	int ssl_verify_client_cert;
-	int disable_plaintext_auth;
-	int verbose_ssl;
+	bool ssl_verify_client_cert;
+	bool disable_plaintext_auth;
+	bool verbose_ssl;
 
 	/* login */
 	const char *login_dir;
@@ -45,9 +45,9 @@
 	const char *login_log_format_elements;
 	const char *login_log_format;
 
-	int login_process_per_connection;
-	int login_chroot;
-	int login_greeting_capability;
+	bool login_process_per_connection;
+	bool login_chroot;
+	bool login_greeting_capability;
 
 	unsigned int login_process_size;
 	unsigned int login_processes_count;
@@ -58,7 +58,7 @@
 	const char *valid_chroot_dirs;
 	const char *mail_chroot;
 	unsigned int max_mail_processes;
-	int verbose_proctitle;
+	bool verbose_proctitle;
 
 	unsigned int first_valid_uid, last_valid_uid;
 	unsigned int first_valid_gid, last_valid_gid;
@@ -68,32 +68,32 @@
 	const char *mail_cache_fields;
 	const char *mail_never_cache_fields;
 	unsigned int mailbox_idle_check_interval;
-	int mail_debug;
-	int mail_full_filesystem_access;
-	int mail_max_keyword_length;
-	int mail_save_crlf;
-	int mail_read_mmaped;
-	int mmap_disable;
-	int mmap_no_write;
+	bool mail_debug;
+	bool mail_full_filesystem_access;
+	bool mail_max_keyword_length;
+	bool mail_save_crlf;
+	bool mail_read_mmaped;
+	bool mmap_disable;
+	bool mmap_no_write;
 	const char *lock_method;
-	int maildir_stat_dirs;
-	int maildir_copy_with_hardlinks;
+	bool maildir_stat_dirs;
+	bool maildir_copy_with_hardlinks;
 	const char *mbox_read_locks;
 	const char *mbox_write_locks;
 	unsigned int mbox_lock_timeout;
 	unsigned int mbox_dotlock_change_timeout;
-	int mbox_dirty_syncs;
-	int mbox_very_dirty_syncs;
-	int mbox_lazy_writes;
+	bool mbox_dirty_syncs;
+	bool mbox_very_dirty_syncs;
+	bool mbox_lazy_writes;
 	unsigned int dbox_rotate_size;
 	unsigned int dbox_rotate_min_size;
 	unsigned int dbox_rotate_days;
 	unsigned int umask;
-	int mail_drop_priv_before_exec;
+	bool mail_drop_priv_before_exec;
 
 	const char *mail_executable;
 	unsigned int mail_process_size;
-	int mail_use_modules;
+	bool mail_use_modules;
 	const char *mail_modules;
 	const char *mail_log_prefix;
 
@@ -103,9 +103,9 @@
 	const char *imap_client_workarounds;
 
 	/* pop3 */
-	int pop3_no_flag_updates;
-	int pop3_enable_last;
-	int pop3_reuse_xuidl;
+	bool pop3_no_flag_updates;
+	bool pop3_enable_last;
+	bool pop3_reuse_xuidl;
 	const char *pop3_uidl_format;
 	const char *pop3_client_workarounds;
 	const char *pop3_logout_format;
@@ -140,7 +140,7 @@
 
 	const char *driver;
 	const char *args;
-	int deny;
+	bool deny;
 };
 
 struct auth_userdb_settings {
@@ -169,9 +169,9 @@
 	const char *anonymous_username;
 	const char *krb5_keytab;
 
-	int verbose, debug;
-	int ssl_require_client_cert;
-	int ssl_username_from_cert;
+	bool verbose, debug;
+	bool ssl_require_client_cert;
+	bool ssl_username_from_cert;
 
 	unsigned int count;
 	unsigned int worker_max_count;
@@ -194,8 +194,8 @@
 	const char *prefix;
 	const char *location;
 
-	int inbox;
-	int hidden;
+	bool inbox;
+	bool hidden;
 };
 
 struct server_settings {
@@ -214,7 +214,7 @@
 
 extern struct server_settings *settings_root;
 
-int master_settings_read(const char *path, int nochecks);
+bool master_settings_read(const char *path, bool nochecks);
 
 void master_settings_init(void);
 void master_settings_deinit(void);
--- a/src/master/ssl-init.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/ssl-init.c	Fri Jan 13 22:25:57 2006 +0200
@@ -13,7 +13,7 @@
 #include <sys/stat.h>
 
 static struct timeout *to;
-static int generating;
+static bool generating;
 
 static void generate_parameters_file(const char *fname)
 {
@@ -64,7 +64,7 @@
 	generating = FALSE;
 }
 
-static int check_parameters_file_set(struct settings *set)
+static bool check_parameters_file_set(struct settings *set)
 {
 	struct stat st;
 	time_t regen_time;
--- a/src/master/syslog-util.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/syslog-util.c	Fri Jan 13 22:25:57 2006 +0200
@@ -51,7 +51,7 @@
 	{ NULL, 0 }
 };
 
-int syslog_facility_find(const char *name, int *facility_r)
+bool syslog_facility_find(const char *name, int *facility_r)
 {
 	int i;
 
--- a/src/master/syslog-util.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/master/syslog-util.h	Fri Jan 13 22:25:57 2006 +0200
@@ -9,6 +9,6 @@
 extern struct syslog_facility_list syslog_facilities[];
 
 /* Returns TRUE if found. */
-int syslog_facility_find(const char *name, int *facility_r);
+bool syslog_facility_find(const char *name, int *facility_r);
 
 #endif
--- a/src/plugins/imap-quota/imap-quota-plugin.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/imap-quota/imap-quota-plugin.c	Fri Jan 13 22:25:57 2006 +0200
@@ -46,7 +46,7 @@
 	t_pop();
 }
 
-static int cmd_getquotaroot(struct client_command_context *cmd)
+static bool cmd_getquotaroot(struct client_command_context *cmd)
 {
 	struct mail_storage *storage;
 	struct mailbox *box;
@@ -109,7 +109,7 @@
 	return TRUE;
 }
 
-static int cmd_getquota(struct client_command_context *cmd)
+static bool cmd_getquota(struct client_command_context *cmd)
 {
 	const char *root_name;
         struct quota_root *root;
@@ -134,7 +134,7 @@
 	return TRUE;
 }
 
-static int cmd_setquota(struct client_command_context *cmd)
+static bool cmd_setquota(struct client_command_context *cmd)
 {
 	struct quota_root *root;
         struct imap_arg *args, *arg;
--- a/src/plugins/quota/quota-dict.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota-dict.c	Fri Jan 13 22:25:57 2006 +0200
@@ -23,7 +23,7 @@
 struct dict_quota_root_iter {
 	struct quota_root_iter iter;
 
-	int sent;
+	bool sent;
 };
 
 extern struct quota dict_quota;
@@ -226,7 +226,7 @@
 
 static int
 dict_quota_try_alloc(struct quota_transaction_context *ctx,
-		     struct mail *mail, int *too_large_r)
+		     struct mail *mail, bool *too_large_r)
 {
 	uoff_t size;
 
--- a/src/plugins/quota/quota-dirsize.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota-dirsize.c	Fri Jan 13 22:25:57 2006 +0200
@@ -26,7 +26,7 @@
 struct dirsize_quota_root_iter {
 	struct quota_root_iter iter;
 
-	int sent;
+	bool sent;
 };
 
 extern struct quota dirsize_quota;
@@ -261,7 +261,7 @@
 
 static int
 dirsize_quota_try_alloc(struct quota_transaction_context *ctx,
-			struct mail *mail, int *too_large_r)
+			struct mail *mail, bool *too_large_r)
 {
 	uoff_t size;
 
--- a/src/plugins/quota/quota-fs.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota-fs.c	Fri Jan 13 22:25:57 2006 +0200
@@ -36,7 +36,7 @@
 struct fs_quota_root_iter {
 	struct quota_root_iter iter;
 
-	int sent;
+	bool sent;
 };
 
 extern struct quota fs_quota;
@@ -251,7 +251,7 @@
 static int
 fs_quota_try_alloc(struct quota_transaction_context *ctx __attr_unused__,
 		   struct mail *mail __attr_unused__,
-		   int *too_large_r __attr_unused__)
+		   bool *too_large_r __attr_unused__)
 {
 	/* no-op */
 	return 1;
--- a/src/plugins/quota/quota-private.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota-private.h	Fri Jan 13 22:25:57 2006 +0200
@@ -38,7 +38,7 @@
 	void (*transaction_rollback)(struct quota_transaction_context *ctx);
 
 	int (*try_alloc)(struct quota_transaction_context *ctx,
-			 struct mail *mail, int *too_large_r);
+			 struct mail *mail, bool *too_large_r);
 	void (*alloc)(struct quota_transaction_context *ctx, struct mail *mail);
 	void (*free)(struct quota_transaction_context *ctx, struct mail *mail);
 
--- a/src/plugins/quota/quota-storage.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota-storage.c	Fri Jan 13 22:25:57 2006 +0200
@@ -28,7 +28,7 @@
 };
 
 static unsigned int quota_storage_module_id = 0;
-static int quota_storage_module_id_set = FALSE;
+static bool quota_storage_module_id_set = FALSE;
 
 static int quota_mail_expunge(struct mail *_mail)
 {
@@ -156,7 +156,7 @@
 		enum mail_flags flags, struct mail_keywords *keywords,
 		time_t received_date, int timezone_offset,
 		const char *from_envelope, struct istream *input,
-		int want_mail __attr_unused__)
+		bool want_mail __attr_unused__)
 {
 	struct quota_mailbox *qbox = QUOTA_CONTEXT(t->box);
 	const struct stat *st;
--- a/src/plugins/quota/quota.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota.c	Fri Jan 13 22:25:57 2006 +0200
@@ -124,7 +124,7 @@
 }
 
 int quota_try_alloc(struct quota_transaction_context *ctx,
-		    struct mail *mail, int *too_large_r)
+		    struct mail *mail, bool *too_large_r)
 {
 	return ctx->quota->try_alloc(ctx, mail, too_large_r);
 }
--- a/src/plugins/quota/quota.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/quota/quota.h	Fri Jan 13 22:25:57 2006 +0200
@@ -53,7 +53,7 @@
    -1 if error. If mail size is larger than even maximum allowed quota,
    too_large_r is set to TRUE. */
 int quota_try_alloc(struct quota_transaction_context *ctx,
-		    struct mail *mail, int *too_large_r);
+		    struct mail *mail, bool *too_large_r);
 /* Update quota by allocating/freeing space used by mail. */
 void quota_alloc(struct quota_transaction_context *ctx, struct mail *mail);
 void quota_free(struct quota_transaction_context *ctx, struct mail *mail);
--- a/src/plugins/trash/trash-plugin.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/trash/trash-plugin.c	Fri Jan 13 22:25:57 2006 +0200
@@ -46,7 +46,7 @@
 
 static void (*trash_next_hook_mail_storage_created)
 	(struct mail_storage *storage);
-static int quota_initialized;
+static bool quota_initialized;
 static unsigned int trash_quota_module_id;
 
 static pool_t config_pool;
@@ -169,7 +169,7 @@
 
 static int
 trash_quota_try_alloc(struct quota_transaction_context *ctx,
-		      struct mail *mail, int *too_large_r)
+		      struct mail *mail, bool *too_large_r)
 {
 	struct trash_quota *tquota = TRASH_CONTEXT(quota);
 	int ret, i;
--- a/src/plugins/zlib/istream-zlib.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/zlib/istream-zlib.c	Fri Jan 13 22:25:57 2006 +0200
@@ -147,7 +147,7 @@
 	return ret;
 }
 
-static void _seek(struct _istream *stream, uoff_t v_offset, int mark)
+static void _seek(struct _istream *stream, uoff_t v_offset, bool mark)
 {
 	struct zlib_istream *zstream = (struct zlib_istream *) stream;
 	uoff_t start_offset = stream->istream.v_offset - stream->skip;
@@ -199,7 +199,7 @@
 	}
 }
 
-static const struct stat *_stat(struct _istream *stream, int exact)
+static const struct stat *_stat(struct _istream *stream, bool exact)
 {
 	struct zlib_istream *zstream = (struct zlib_istream *) stream;
 	size_t size;
--- a/src/plugins/zlib/zlib-plugin.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/plugins/zlib/zlib-plugin.c	Fri Jan 13 22:25:57 2006 +0200
@@ -24,7 +24,7 @@
 	(struct mail_storage *storage);
 
 static unsigned int zlib_storage_module_id = 0;
-static int zlib_storage_module_id_set = FALSE;
+static bool zlib_storage_module_id_set = FALSE;
 
 static const char *
 mbox_get_path(struct index_storage *storage, const char *name)
--- a/src/pop3-login/client-authenticate.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3-login/client-authenticate.c	Fri Jan 13 22:25:57 2006 +0200
@@ -19,7 +19,7 @@
 
 #include <stdlib.h>
 
-int cmd_capa(struct pop3_client *client, const char *args __attr_unused__)
+bool cmd_capa(struct pop3_client *client, const char *args __attr_unused__)
 {
 	const struct auth_mech_desc *mech;
 	unsigned int i, count;
@@ -83,13 +83,13 @@
 	safe_memset(line, 0, strlen(line));
 }
 
-static int client_handle_args(struct pop3_client *client,
-			      const char *const *args, int nologin)
+static bool client_handle_args(struct pop3_client *client,
+			       const char *const *args, bool nologin)
 {
 	const char *reason = NULL, *host = NULL, *destuser = NULL, *pass = NULL;
 	string_t *reply;
 	unsigned int port = 110;
-	int proxy = FALSE, temp = FALSE;
+	bool proxy = FALSE, temp = FALSE;
 
 	for (; *args != NULL; args++) {
 		if (strcmp(*args, "nologin") == 0)
@@ -203,7 +203,7 @@
 	client_unref(client);
 }
 
-int cmd_auth(struct pop3_client *client, const char *args)
+bool cmd_auth(struct pop3_client *client, const char *args)
 {
 	const struct auth_mech_desc *mech;
 	const char *mech_name, *p;
@@ -248,7 +248,7 @@
 	return TRUE;
 }
 
-int cmd_user(struct pop3_client *client, const char *args)
+bool cmd_user(struct pop3_client *client, const char *args)
 {
 	if (!client->common.secured && disable_plaintext_auth) {
 		if (verbose_auth) {
@@ -267,7 +267,7 @@
 	return TRUE;
 }
 
-int cmd_pass(struct pop3_client *client, const char *args)
+bool cmd_pass(struct pop3_client *client, const char *args)
 {
 	string_t *plain_login, *base64;
 
@@ -304,7 +304,7 @@
 	return TRUE;
 }
 
-int cmd_apop(struct pop3_client *client, const char *args)
+bool cmd_apop(struct pop3_client *client, const char *args)
 {
 	buffer_t *apop_data, *base64;
 	const char *p;
--- a/src/pop3-login/client-authenticate.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3-login/client-authenticate.h	Fri Jan 13 22:25:57 2006 +0200
@@ -1,10 +1,10 @@
 #ifndef __CLIENT_AUTHENTICATE_H
 #define __CLIENT_AUTHENTICATE_H
 
-int cmd_capa(struct pop3_client *client, const char *args);
-int cmd_user(struct pop3_client *client, const char *args);
-int cmd_pass(struct pop3_client *client, const char *args);
-int cmd_auth(struct pop3_client *client, const char *args);
-int cmd_apop(struct pop3_client *client, const char *args);
+bool cmd_capa(struct pop3_client *client, const char *args);
+bool cmd_user(struct pop3_client *client, const char *args);
+bool cmd_pass(struct pop3_client *client, const char *args);
+bool cmd_auth(struct pop3_client *client, const char *args);
+bool cmd_apop(struct pop3_client *client, const char *args);
 
 #endif
--- a/src/pop3-login/client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3-login/client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -109,7 +109,7 @@
 	return 1;
 }
 
-static int cmd_stls(struct pop3_client *client)
+static bool cmd_stls(struct pop3_client *client)
 {
 	if (client->common.tls) {
 		client_send_line(client, "-ERR TLS is already active.");
@@ -144,15 +144,15 @@
 	return TRUE;
 }
 
-static int cmd_quit(struct pop3_client *client)
+static bool cmd_quit(struct pop3_client *client)
 {
 	client_send_line(client, "+OK Logging out");
 	client_destroy(client, "Aborted login");
 	return TRUE;
 }
 
-static int client_command_execute(struct pop3_client *client, const char *cmd,
-				  const char *args)
+static bool client_command_execute(struct pop3_client *client, const char *cmd,
+				   const char *args)
 {
 	cmd = t_str_ucase(cmd);
 	if (strcmp(cmd, "CAPA") == 0)
@@ -174,7 +174,7 @@
 	return FALSE;
 }
 
-int client_read(struct pop3_client *client)
+bool client_read(struct pop3_client *client)
 {
 	switch (i_stream_read(client->input)) {
 	case -2:
@@ -298,7 +298,7 @@
 					     client->apop_challenge, NULL));
 }
 
-struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip,
+struct client *client_create(int fd, bool ssl, const struct ip_addr *local_ip,
 			     const struct ip_addr *ip)
 {
 	struct pop3_client *client;
@@ -408,7 +408,7 @@
 	client->refcount++;
 }
 
-int client_unref(struct pop3_client *client)
+bool client_unref(struct pop3_client *client)
 {
 	if (--client->refcount > 0)
 		return TRUE;
--- a/src/pop3-login/client.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3-login/client.h	Fri Jan 13 22:25:57 2006 +0200
@@ -38,11 +38,11 @@
 
 void client_send_line(struct pop3_client *client, const char *line);
 
-int client_read(struct pop3_client *client);
+bool client_read(struct pop3_client *client);
 void client_input(void *context);
 
 void client_ref(struct pop3_client *client);
-int client_unref(struct pop3_client *client);
+bool client_unref(struct pop3_client *client);
 
 void clients_init(void);
 void clients_deinit(void);
--- a/src/pop3/client.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3/client.c	Fri Jan 13 22:25:57 2006 +0200
@@ -57,7 +57,8 @@
         struct mailbox_status status;
 	struct mail *mail;
 	buffer_t *message_sizes_buf;
-	int i, failed;
+	int i;
+	bool failed;
 
 	message_sizes_buf = buffer_create_dynamic(default_pool, 512);
 
@@ -130,7 +131,7 @@
 {
 	struct client *client;
         enum mailbox_open_flags flags;
-	int syntax_error, temporary_error;
+	bool syntax_error, temporary_error;
 
 	/* always use nonblocking I/O */
 	net_set_nonblock(hin, TRUE);
@@ -300,7 +301,7 @@
 void client_send_storage_error(struct client *client)
 {
 	const char *error;
-	int syntax, temporary_error;
+	bool syntax, temporary_error;
 
 	if (mailbox_is_inconsistent(client->mailbox)) {
 		client_send_line(client, "-ERR Mailbox is in inconsistent "
--- a/src/pop3/commands.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3/commands.c	Fri Jan 13 22:25:57 2006 +0200
@@ -90,7 +90,7 @@
 static int cmd_capa(struct client *client, const char *args __attr_unused__)
 {
 	client_send_line(client, "+OK\r\n"POP3_CAPABILITY_REPLY".");
-	return TRUE;
+	return 1;
 }
 
 static int cmd_dele(struct client *client, const char *args)
@@ -98,7 +98,7 @@
 	unsigned int msgnum;
 
 	if (get_msgnum(client, args, &msgnum) == NULL)
-		return FALSE;
+		return 0;
 
 	if (!client->deleted) {
 		client->deleted_bitmask = i_malloc(MSGS_BITMASK_SIZE(client));
@@ -109,7 +109,7 @@
 	client->deleted_count++;
 	client->deleted_size += client->message_sizes[msgnum];
 	client_send_line(client, "+OK Marked to be deleted.");
-	return TRUE;
+	return 1;
 }
 
 struct cmd_list_context {
@@ -161,35 +161,35 @@
 		unsigned int msgnum;
 
 		if (get_msgnum(client, args, &msgnum) == NULL)
-			return FALSE;
+			return 0;
 
 		client_send_line(client, "+OK %u %"PRIuUOFF_T, msgnum+1,
 				 client->message_sizes[msgnum]);
 	}
 
-	return TRUE;
+	return 1;
 }
 
 static int cmd_last(struct client *client, const char *args __attr_unused__)
 {
 	client_send_line(client, "+OK %u", client->last_seen);
-	return TRUE;
+	return 1;
 }
 
 static int cmd_noop(struct client *client, const char *args __attr_unused__)
 {
 	client_send_line(client, "+OK");
-	return TRUE;
+	return 1;
 }
 
-static int expunge_mails(struct client *client)
+static bool expunge_mails(struct client *client)
 {
 	struct mail_search_arg search_arg;
         struct mail_search_seqset seqset;
 	struct mail_search_context *ctx;
 	struct mail *mail;
 	uint32_t idx;
-	int ret = TRUE;
+	bool ret = TRUE;
 
 	if (client->deleted_bitmask == NULL)
 		return TRUE;
@@ -225,8 +225,9 @@
 	if (client->deleted) {
 		if (!expunge_mails(client)) {
 			client_send_storage_error(client);
-			client_disconnect(client, "Storage error during logout.");
-			return TRUE;
+			client_disconnect(client,
+				"Storage error during logout.");
+			return 1;
 		}
 	}
 
@@ -239,7 +240,7 @@
 		client_send_line(client, "+OK Logging out, messages deleted.");
 
 	client_disconnect(client, "Logout.");
-	return TRUE;
+	return 1;
 }
 
 struct fetch_context {
@@ -252,7 +253,7 @@
         struct mail_search_seqset seqset;
 
 	unsigned char last;
-	int cr_skipped, in_body;
+	bool cr_skipped, in_body;
 };
 
 static void fetch_deinit(struct fetch_context *ctx)
@@ -412,7 +413,7 @@
 	unsigned int msgnum;
 
 	if (get_msgnum(client, args, &msgnum) == NULL)
-		return FALSE;
+		return 0;
 
 	if (client->last_seen <= msgnum)
 		client->last_seen = msgnum+1;
@@ -422,7 +423,7 @@
 	client->byte_counter_offset = client->output->offset;
 
 	fetch(client, msgnum, (uoff_t)-1);
-	return TRUE;
+	return 1;
 }
 
 static int cmd_rset(struct client *client, const char *args __attr_unused__)
@@ -467,7 +468,7 @@
 	}
 
 	client_send_line(client, "+OK");
-	return TRUE;
+	return 1;
 }
 
 static int cmd_stat(struct client *client, const char *args __attr_unused__)
@@ -475,7 +476,7 @@
 	client_send_line(client, "+OK %u %"PRIuUOFF_T, client->
 			 messages_count - client->deleted_count,
 			 client->total_size - client->deleted_size);
-	return TRUE;
+	return 1;
 }
 
 static int cmd_top(struct client *client, const char *args)
@@ -485,16 +486,16 @@
 
 	args = get_msgnum(client, args, &msgnum);
 	if (args == NULL)
-		return FALSE;
+		return 0;
 	if (get_size(client, args, &max_lines) == NULL)
-		return FALSE;
+		return 0;
 
 	client->top_count++;
 	client->byte_counter = &client->top_bytes;
 	client->byte_counter_offset = client->output->offset;
 
 	fetch(client, msgnum, max_lines);
-	return TRUE;
+	return 1;
 }
 
 struct cmd_uidl_context {
@@ -506,7 +507,7 @@
 	struct mail_search_seqset seqset;
 };
 
-static int list_uids_iter(struct client *client, struct cmd_uidl_context *ctx)
+static bool list_uids_iter(struct client *client, struct cmd_uidl_context *ctx)
 {
 	static struct var_expand_table static_tab[] = {
 		{ 'v', NULL },
@@ -518,7 +519,8 @@
 	struct var_expand_table *tab;
 	string_t *str;
 	const char *uidl;
-	int ret, found = FALSE;
+	int ret;
+	bool found = FALSE;
 
 	tab = t_malloc(sizeof(static_tab));
 	memcpy(tab, static_tab, sizeof(static_tab));
@@ -646,14 +648,14 @@
 		unsigned int msgnum;
 
 		if (get_msgnum(client, args, &msgnum) == NULL)
-			return FALSE;
+			return 0;
 
 		ctx = cmd_uidl_init(client, msgnum+1);
 		if (!list_uids_iter(client, ctx))
 			client_send_line(client, "-ERR Message not found.");
 	}
 
-	return TRUE;
+	return 1;
 }
 
 int client_command_execute(struct client *client,
--- a/src/pop3/common.h	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3/common.h	Fri Jan 13 22:25:57 2006 +0200
@@ -18,7 +18,7 @@
 
 extern struct ioloop *ioloop;
 extern enum client_workarounds client_workarounds;
-extern int enable_last_command, no_flag_updates, reuse_xuidl;
+extern bool enable_last_command, no_flag_updates, reuse_xuidl;
 extern const char *uidl_format, *logout_format;
 extern enum uidl_keys uidl_keymask;
 
--- a/src/pop3/main.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/pop3/main.c	Fri Jan 13 22:25:57 2006 +0200
@@ -40,9 +40,9 @@
 static struct module *modules;
 static char log_prefix[128]; /* syslog() needs this to be permanent */
 enum client_workarounds client_workarounds = 0;
-int enable_last_command = FALSE;
-int no_flag_updates = FALSE;
-int reuse_xuidl = FALSE;
+bool enable_last_command = FALSE;
+bool no_flag_updates = FALSE;
+bool reuse_xuidl = FALSE;
 const char *uidl_format, *logout_format;
 enum uidl_keys uidl_keymask;
 
--- a/src/util/rawlog.c	Fri Jan 13 17:11:47 2006 +0200
+++ b/src/util/rawlog.c	Fri Jan 13 22:25:57 2006 +0200
@@ -230,7 +230,7 @@
 
 static struct rawlog_proxy *
 rawlog_proxy_create(int client_in_fd, int client_out_fd, int server_fd,
-		    const char *path, int write_timestamps)
+		    const char *path, bool write_timestamps)
 {
 	struct rawlog_proxy *proxy;
 
@@ -261,7 +261,7 @@
 	return proxy;
 }
 
-static void rawlog_open(int write_timestamps)
+static void rawlog_open(bool write_timestamps)
 {
 	const char *home, *path;
 	struct stat st;