From 304a4e9eb64d80b896839738e446b2cd42cfc8ec Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Fri, 13 Jul 2001 17:35:51 +0000 Subject: [PATCH] Let people install as non-root, but give them a bigass warning so they're 2001-07-13 Peter Williams * Makefile.am (install-exec-local): Let people install as non-root, but give them a bigass warning so they're not allowed to complain when it doesn't work right. * camel-remote-store.c (sync_remote_folder): New function: hash table callback. (remote_disconnect): If cleanly disconnecting, sync our folders. Fixes deadlocks on exit (folders syncing after store disconnects) and also makes sense. --- camel/ChangeLog | 12 ++++++++++++ camel/Makefile.am | 26 ++++++++++++++++++++++---- camel/camel-remote-store.c | 14 ++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index d5760cc..d1abaa0 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,15 @@ +2001-07-13 Peter Williams + + * Makefile.am (install-exec-local): Let people install as non-root, + but give them a bigass warning so they're not allowed to complain when + it doesn't work right. + + * camel-remote-store.c (sync_remote_folder): New function: + hash table callback. + (remote_disconnect): If cleanly disconnecting, sync our folders. Fixes + deadlocks on exit (folders syncing after store disconnects) and also makes + sense. + 2001-07-13 Jeffrey Stedfast * camel-uid-cache.c (camel_uid_cache_new): We now use a structure diff --git a/camel/Makefile.am b/camel/Makefile.am index 408a0e3..7dafb8b 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -204,13 +204,31 @@ camel-lock-helper: camel-lock-helper.o camel-lock.o if CAMEL_LOCK_HELPER_SETUID install-exec-local: - chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(sbindir)/camel-lock-helper - chmod u+s $(DESTDIR)$(sbindir)/camel-lock-helper + @if test `whoami` = root ; then \ + chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(sbindir)/camel-lock-helper ; \ + chmod u+s $(DESTDIR)$(sbindir)/camel-lock-helper ; \ + else \ + echo '*** WARNING ***' ; \ + echo "Camel will not be able to open mbox files until you perform the following steps:" ; \ + echo " 1. Become root" ; \ + echo " 2. chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(sbindir)/camel-lock-helper" ; \ + echo " 3. chmod u+s $(DESTDIR)$(sbindir)/camel-lock-helper" ; \ + echo '*** WARNING ***' ; \ + fi endif if CAMEL_LOCK_HELPER_SETGID install-exec-local: - chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(sbindir)/camel-lock-helper - chmod g+s $(DESTDIR)$(sbindir)/camel-lock-helper + @if test `whoami` = root ; then \ + chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(sbindir)/camel-lock-helper ; \ + chmod g+s $(DESTDIR)$(sbindir)/camel-lock-helper ; \ + else \ + echo '*** WARNING ***' ; \ + echo "Camel will not be able to open mbox files until you perform the following steps:" ; \ + echo " 1. Become root" ; \ + echo " 2. chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(sbindir)/camel-lock-helper" ; \ + echo " 3. chmod g+s $(DESTDIR)$(sbindir)/camel-lock-helper" ; \ + echo '*** WARNING ***' ; \ + fi endif diff --git a/camel/camel-remote-store.c b/camel/camel-remote-store.c index 6544518..823a467 100644 --- a/camel/camel-remote-store.c +++ b/camel/camel-remote-store.c @@ -281,6 +281,16 @@ remote_connect (CamelService *service, CamelException *ex) return TRUE; } + +static void +sync_remote_folder (gpointer key, gpointer value, gpointer data) +{ + CamelFolder *folder = CAMEL_FOLDER (value); + + if (!camel_exception_is_set ((CamelException *) data)) + camel_folder_sync (folder, FALSE, (CamelException *) data); +} + static gboolean remote_disconnect (CamelService *service, gboolean clean, CamelException *ex) { @@ -292,6 +302,10 @@ remote_disconnect (CamelService *service, gboolean clean, CamelException *ex) store->timeout_id = 0; } + if (clean) + /* sync all folders */ + g_hash_table_foreach (CAMEL_STORE (store)->folders, sync_remote_folder, ex); + if (!CAMEL_SERVICE_CLASS (store_class)->disconnect (service, clean, ex)) return FALSE; -- 2.7.4